Write a query to display the details of all the bills whose 'total_units' greater than 10000, sorted by total_units in descending order.
Question
Write a query to display the details of all the bills whose total_units
greater than 10000, sorted by total_units
in descending order.
Solution
To display the details of all the bills where the total_units
is greater than 10,000, sorted by total_units
in descending order, you can use the following SQL query:
SELECT *
FROM bills
WHERE total_units > 10000
ORDER BY total_units DESC;
Explanation:
SELECT *
fetches all the columns from thebills
table.- The
WHERE total_units > 10000
clause filters the results to include only those records wheretotal_units
exceeds 10,000. ORDER BY total_units DESC
sorts the resulting records in descending order based on thetotal_units
column.
This query will give you a clear view of all relevant bills while making it easy to identify those with high 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 all the 'bills' whose payment_date is on the year 2018, sorted by payable_amount in descending order
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 the details of the 'bill' whose payment is not completed. Display the records in ascending order based on due_date.
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.