Write a query to display the entire contents of bill table. Display the records sorted in ascending order based on month and then in descending order based on total_units.
Question
Write a query to display the entire contents of bill table. Display the records sorted in ascending order based on month and then in descending order based on total_units.
Solution 1
Sure, here is the SQL query you asked for:
SELECT *
FROM bill
ORDER BY month ASC, total_units DESC;
This query will select all records from the bill table and sort them in ascending order by the month column. If there are records with the same month, they will be sorted in descending order by the total_units column.
Solution 2
Sure, here is the SQL query you asked for:
SELECT *
FROM bill
ORDER BY month ASC, total_units DESC;
This query will select all records from the bill table and sort them first in ascending order by month and then in descending order by total_units.
Solution 3
Sure, here is the SQL query you asked for:
SELECT *
FROM bill
ORDER BY month ASC, total_units DESC;
This query will select all records from the bill table and sort them first in ascending order by month and then in descending order by total_units.
Solution 4
Sure, here is the SQL query you need:
SELECT *
FROM bill
ORDER BY month ASC, total_units DESC;
This query will select all columns from the bill table and then sort the results first in ascending order by month and then in descending order by total_units.
Similar Questions
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 bills whose payment_date is on 2nd day of the month and also display the records in descending order based on the total_units.
Write a query to display the month and sum of fine_amount collected on the month between July to October. Give an alias name as 'monthly_fine_amount' also display the records in ascending order based on month.Note:1. Display only the month and sum of fine_amount collected in the month between July to October from bill table. (month will be 01, 02, 03,...12)2. Specify the alias name without any mistake.3. Order by is mandatory4. Group by month to get the month wise sum of fine_amount5. Compare your executed result with the sample output given below.
Write a query to display owner name,address ,meter number and total units consumed by all the customers in the month december 2017.Display the records in descending order by total_units.Note:1. Display only the below 4 columns, i. owner name ii. address iii. meter number iv. Total unitsby all the customers in the month december 2017.2. Use Joins3. Tables involved building, meter and bill4. Specify condition on year, month column of bill table5. Order by is mandatory.
Write a query to display the meter_number from the meter table which got minimum amount of total_units in a month. 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 amount of total_units in a month.2. Tables involved are meter and bill3. Order by is mandatory4. Compare your executed result with the sample output given below.Sample output:
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.