Knowee
Questions
Features
Study Tools

Write a query to display the sum of payable_amount whose payment_date is on the year 2018. Give an alias name to the total payable_amount as 'sum_payable_amount'.Note:1. Display only the sum of payable_amount in the given year from bill table.(only for the year 2018).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 payment_date column).4. Compare your executed result with the sample output given below.

Question

Write a query to display the sum of payable_amount whose payment_date is on the year 2018. Give an alias name to the total payable_amount as 'sum_payable_amount'.Note:1. Display only the sum of payable_amount in the given year from bill table.(only for the year 2018).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 payment_date column).4. Compare your executed result with the sample output given below.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

The query you're looking for would look something like this:

SELECT SUM(payable_amount) AS sum_payable_amount
FROM bill
WHERE YEAR(payment_date) = 2018;

Here's a step-by-step breakdown of what this query does:

  1. SELECT SUM(payable_amount) AS sum_payable_amount: This part of the query is asking the database to add up all the values in the payable_amount column and give this total the name sum_payable_amount.

  2. FROM bill: This tells the database which table to pull the data from, in this case, the bill table.

  3. WHERE YEAR(payment_date) = 2018;: This is the condition that the rows must meet in order to be included in the sum. The YEAR() function extracts the year from the payment_date column, and we're asking the database to only include the rows where this year is 2018.

This problem has been solved

Similar Questions

Write a query to display the sum of payable_amount whose payment_date is on the year 2018. Give an alias name to the total payable_amount as 'sum_payable_amount'.

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 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 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'.Note:1. Display only the average fine_amount with the given payment_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 fine amount).4. Compare your executed result with the sample output given below.Sample output:

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

1/3

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.