Write a query to display the number of electricity_reading in which the total_units per day is greater than 500. Give an alias name as 'count_total_units_500'.
Question
Write a query to display the number of electricity_reading
in which the total_units
per day is greater than 500.
Give an alias name as count_total_units_500
.
Solution
Sure, here is the SQL query you asked for:
SELECT COUNT(*) AS count_total_units_500
FROM electricity_reading
WHERE total_units > 500;
This query works as follows:
-
SELECT COUNT(*) AS count_total_units_500
: This part of the query is used to count the number of rows in the result set and give it an alias name 'count_total_units_500'. -
FROM electricity_reading
: This part of the query specifies the table from which to retrieve the data. -
WHERE total_units > 500
: This is the condition that filters the data. It only selects the rows where the total_units per day is greater than 500.
Similar Questions
Write a query to display the meter_number from the meter table which got maximum total_units during 8PM for a day in the electricity_reading.
Write a query to display the total_units and payable_amount of the particular meter number 'SG934826
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 unique 12th hour reading present in the electricity_reading table. Display the records sorted in descending order based on h12.
Write a query to display all the details of the 'meter' whose meter_number starts with 'S' and ends with '6'.
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.