Knowee
Questions
Features
Study Tools

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.

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

Solution 1

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:

  1. SELECT * FROM bill: This part of the query selects all records from the 'bill' table.

  2. 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'.

  3. 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 use DESC instead of ASC.

This problem has been solved

Solution 2

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:

  1. SELECT * FROM bill: This part of the query selects all columns from the 'bill' table.

  2. 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'.

  3. ORDER BY due_date ASC: This part of the query sorts the resulting records in ascending order based on the 'due_date' column. If you wanted to sort the records in descending order, you would use DESC instead of ASC.

This problem has been solved

Solution 3

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:

  1. SELECT * FROM bill: This part of the query selects all columns from the 'bill' table.

  2. 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'.

  3. ORDER BY due_date ASC: This part of the query sorts the resulting records in ascending order based on the 'due_date' column. If you wanted to sort the records in descending order, you would use DESC instead of ASC.

Please replace 'bill', 'payment_status', and 'due_date' with your actual table and column names if they are different.

This problem has been solved

Solution 4

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:

  1. SELECT * FROM bill: This part of the query selects all columns from the 'bill' table.

  2. 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'.

  3. ORDER BY due_date ASC: This part of the query sorts the resulting records in ascending order based on the 'due_date' column. If you wanted to sort in descending order, you would use DESC instead of ASC.

This problem has been solved

Similar Questions

Write a query to display the details of all the 'bills' with the due_date on '2017-10-01'.Display the records in descending order based on their payable_amount.

Write a query to display the owner_name, building_type name,  meter_number and payment_status of the bill which are raised in the month December 2017.Payment_Status will be payment_date is the payment is done, else if the payment is not done then display as 'Not Paid Yet'. Give an alias name as 'Payment_Status'. Display the record in ascending order based on owner_name.Note:1. 1. Display only the below 4 columns,     i. owner_name     ii. building_type name     iii. meter_number     iv. payment_statusraised in the month december 2017.2. Use Joins3. Tables involved are bill, meter, building and building_type4. Specify condition on year, month of bill table.5. Order by is mandatory. 6. Specify the alias name without any mistake.7. Compare your executed result with the sample output given below.

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.Note:1. Display all the columns present in the bill table.2. Specify the condition and retrieve the correct rows in the result(condition need to be specified on payment_date column).3. You can compare your executed result with the sample output given below.4. Order by is mandatorySample Output:

Write a query to display bill id, meter_id, month, year, total_units, payable_amount and due_date of all the bills. Display the due_date in the format like June 17, 2003. Give an alias name as 'formatted_due_date'. Display all the records sorted in ascending order based on bill id.

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.Note:1. Display all the columns present in the bill table whose payment_date is on 2nd day of the month. (day will be 01,02,03,...31)2. Order by is mandatory3. Compare your executed result with the sample output given below.

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.