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.
Question
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
.
Solution
Sure, here is a SQL query that should give you the desired result:
SELECT *
FROM bill
WHERE payment_status = 'Not Completed'
ORDER BY due_date ASC;
Here's a step-by-step breakdown of the query:
-
SELECT * FROM bill
: This part of the query selects all records from the 'bill' table. -
WHERE payment_status = 'Not Completed'
: This is the condition that filters the records. It only selects the bills where the payment status is 'Not Completed'. -
ORDER BY due_date ASC
: This part of the query sorts the selected records in ascending order based on the 'due_date' field. If you wanted to sort the records in descending order, you would useDESC
instead ofASC
.
Similar Questions
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, payable_amount and fine_amount of bill table. Display the records in descending order based on their total_units
Write a query to display travel_card_id, entry_time and exit_time from the travel_payment.Display the records in ascending order based on the entry_time.
Write a query to display the details of all the bills whose 'total_units' greater than 10000, sorted by total_units in descending orde
Write a query to display the second minimum fine_amount from bill table. Give an alias name to the second minimum fine amount as 'second_min_fine_amount'.
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.