Knowee
Questions
Features
Study Tools

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.Note:1. Display only the unique records present in the column named h12 in the electricity_reading table.2. Order by is mandatory

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.Note:1. Display only the unique records present in the column named h12 in the electricity_reading table.2. Order by is mandatory

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

Solution

Here is the SQL query you need:

SELECT DISTINCT h12
FROM electricity_reading
ORDER BY h12 DESC;

This query works as follows:

  1. SELECT DISTINCT h12 FROM electricity_reading: This part of the query selects all unique values from the column h12 in the table electricity_reading.

  2. ORDER BY h12 DESC: This part of the query sorts the results in descending order based on the values in the h12 column.

This problem has been solved

Similar Questions

Write a query to display the meter_id and total_units of electricity_reading whose '13th' hour reading is lesser than the '14th' hour reading, Display the records in descending order based on their total_units.Note:1. Display only the columns meter_id and total_units present in the electricity_reading table.2. Specify the condition and retrieve the correct rows in the result. (condition need to be specified on h13 and h14 column)3. You can compare your executed result with the sample output given below.4. Order by is mandatorySample output: [Only few records are shown here]

Write a query to display the meter_number from the meter table which got minimum total_units during 9PM for a day in the electricity_reading. Display the records in ascending order based on their meter_number.Note:1. Display only the meter_number from the meter table which got minimum total_units during 9PM. ( 9PM reading will be in h21 column).2. Tables involved are meter and electricity_reading3. Compare your executed result with the sample output given below.

Write a query to display all the details of the 'electricity_reading' whose 'total_units' per day is between 500 and 1000.Display the records in ascending order based on their total_units.

Write a query to display the sum of 12th hour unit consumption from electricity_reading table. Give an alias name to the sum of 12th hour consumption as 'sum_12th_hour_consumption'.Note:1. Display only the sum of 12th hour unit consumption from electricity reading.(12th hour reading will be h12 column).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 electricity readings for the meters with meter number 'SG923564' and 'SG288942' in descending order based on the total units consumed per day.

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.