Write a query to display the sum of payable_amount of all the bills from bill table.Give an alias name to the sum of payable amount as 'sum_payable_amount'.Note:1. Display the sum of payable_amount from bill.2. Specify the alias name without any mistake.3. Compare your executed result with the sample output given below.Sample output: SubmitSaveExecutePrevious Submission
Question
Write a query to display the sum of payable_amount of all the bills from bill table.Give an alias name to the sum of payable amount as 'sum_payable_amount'.Note:1. Display the sum of payable_amount from bill.2. Specify the alias name without any mistake.3. Compare your executed result with the sample output given below.Sample output: SubmitSaveExecutePrevious Submission
Solution
To answer your question, you would write a SQL query. Here is the step by step process:
-
First, you need to select the column you want to sum. In this case, it's the
payable_amountcolumn from thebilltable. -
Next, you need to use the
SUM()function to add up all the values in thepayable_amountcolumn. -
Then, you need to give this sum a name, or alias. You can do this using the
ASkeyword. In this case, you want to name the sum 'sum_payable_amount'. -
Finally, you need to specify the table you're selecting from, which is the
billtable.
Here is the SQL query that does all of this:
SELECT SUM(payable_amount) AS sum_payable_amount
FROM bill;
This query will return the total sum of the payable_amount column from the bill table, and this sum will be labeled as 'sum_payable_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 sum of amount from the travel_payment table. Give an alias name as total_payment.Note:1. Display only the sum of amount from the travel_payment table.2. Specify the alias name without any mistake.3. Compare your executed result with the sample output given below.Sample output:SubmitSaveExecutePrevious Submission
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'.Note:1. Display only the sum of payable_amount with the given due_date from bill table.2. Specify the alias name without any mistake.3. Specify the condition and retrieve the correct rows in the result(condition need to be specified on due_date).4. Compare your executed result with the sample output given below.
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'.
Write a query to display the number of bills in which the bill payment is completed. Give an alias name as 'count_of_bills_with_payment'.Note:1. Display only the number of bills where payment is completed.(If payment is completed then is_payed will be 1, otherwise 0.)2. Specify the alias name without any mistake.3. Specify condition on is_payed column from bill table.4. Compare your executed result with the sample output given below.
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.