Write a query to display the standard deviation of the fine_amount whose payment_date is on the year 2018 from bill table. Give an alias name to the standard deviation to the fine amount as 'standard_deviation_amount'.
Question
Write a query to display the standard deviation of the fine_amount whose payment_date is on the year 2018 from bill table. Give an alias name to the standard deviation to the fine amount as 'standard_deviation_amount'.
Solution
Sure, here is the SQL query you asked for:
SELECT STDDEV(fine_amount) AS standard_deviation_amount
FROM bill
WHERE EXTRACT(YEAR FROM payment_date) = 2018;
This query works as follows:
-
STDDEV(fine_amount) AS standard_deviation_amount: This part of the query calculates the standard deviation of thefine_amountcolumn. TheASkeyword is used to give this calculation a more readable name,standard_deviation_amount. -
FROM bill: This part of the query specifies the table we are selecting data from, which is thebilltable. -
WHERE EXTRACT(YEAR FROM payment_date) = 2018: This is the condition that the rows must meet to be included in the calculation. TheEXTRACT(YEAR FROM payment_date)function gets the year part of thepayment_datecolumn. The= 2018part specifies that we are only interested in rows where the year is 2018.
Similar Questions
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 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.
Write a query to display the variance of the payable_amount whose payment_date is on the month of 'October'. Give an alias name to the variance as 'variance_payable_amount'.Note:1. Display only the variance of payable_amount in the given month from bill table.(only for the month october)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. Use variance() to calculate variance.5. Compare your executed result with the sample output given below.Sample output:
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 variance of the payable_amount whose payment_date is on the month of 'October'. Give an alias name to the variance as 'variance_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.