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
Question
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
.
Solution
To display unique 12th hour readings from the electricity_reading
table and sort them in descending order based on the h12
column, you can use the following SQL query:
SELECT DISTINCT h12
FROM electricity_reading
ORDER BY h12 DESC;
Explanation:
- SELECT DISTINCT h12: This part of the query is used to select the unique entries from the
h12
column, ensuring no duplicate readings are included in the result. - FROM electricity_reading: This indicates that the data is being retrieved from the
electricity_reading
table. - ORDER BY h12 DESC: This clause sorts the resulting unique readings in descending order, meaning the highest readings will appear first.
This query will effectively retrieve and display the unique 12th hour readings in the specified order.
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 number of electricity_reading in which the total_units per day is greater than 500. Give an alias name as 'count_total_units_500'.
Write a query to display the entire contents of the 'electricity_connection_type'. Display the records in ascending order based on their connection name.
Write a query to display the total_units, payable_amount and fine_amount of bill table. Display the records in descending order based on their total_units
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.