QueryQ6Write a query to display the sum of payable_amount and fine_amount of all the bills from bill table. Give an alias name to the sum of payable amount and fine amount as 'sum_payable_and_fine_amount'.
Question
QueryQ6Write a query to display the sum of payable_amount and fine_amount of all the bills from bill table. Give an alias name to the sum of payable amount and fine amount as 'sum_payable_and_fine_amount'.
Solution
Sure, here is the SQL query you asked for:
SELECT SUM(payable_amount + fine_amount) AS sum_payable_and_fine_amount
FROM bill;
This query will add together the payable_amount and fine_amount for each row in the bill table, and then sum all of these results together. The final sum is given the alias sum_payable_and_fine_amount.
Similar Questions
Write a query to display the sum of payable_amount and fine_amount of all the bills from bill table. Give an alias name to the sum of payable amount and fine amount as 'sum_payable_and_fine_amount'.Note:1. Display only the sum of payable_amount and fine_amount from bill table.2. Specify the alias name without any mistake.3. Compare your executed result with the sample output given below.Sample output:
Write a query to display the number of bills having fine_amount. Give an alias name as 'count_of_bills_with_fine'.
Write a query to display the sum of payable_amount with due_date '2017-10-01' from bill table. Give an alias name to the sum of payable amount as 'sum_payable_amount'.
Write a query to display the average fine_amount of the bills whose payment_date is on the year 2018. Give an alias name to the average fine amount as 'average_fine_amount'.
Write a query to display the average payable_amount from bill table where payable_amount is greater than 10000. Give an alias name to the average payable amount as 'average_payable_amount'.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.