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.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 is_payed column. If is_payed is 0, then the payment is not completed.)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]

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.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 is_payed column. If is_payed is 0, then the payment is not completed.)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]

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

Solution

Here is the SQL query you need to write to get the desired output:

SELECT *
FROM bill
WHERE is_payed = 0
ORDER BY due_date ASC;

Let's break it down:

  • SELECT * means you're selecting all columns from the table.
  • FROM bill specifies the table you're selecting from, which is 'bill'.
  • WHERE is_payed = 0 is the condition you're applying to filter the rows. It means you're only selecting rows where the 'is_payed' column is 0, which indicates the payment is not completed.
  • ORDER BY due_date ASC sorts the result in ascending order based on the 'due_date' column. 'ASC' stands for ascending. If you wanted to sort in descending order, you would use 'DESC' instead.

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.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 due_date 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]SubmitSaveExecutePrevious Submission

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

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

Write a query to display all the 'bills' with 'meter' details. Display the records in ascending order based on meter number.Note:1. Display all the columns of bill and meter table2. Use Joins3. Tables involved bill and meter4. Order by is mandatory5. Compare your executed result with the sample output given below.Sample output: [Only few records are shown here]ID METER_ID MONTH YEAR DUE_DATE TOTAL_UNITS PAYABLE_AMOUNT IS_PAYED PAYMENT_D FINE_AMOUNT ID METER_NUMBER BUILDING_ID39 26 8 2017 01-SEP-17 20700 724500 1 14-SEP-17 72450 26 SG190123 2614 10 10 2017 01-NOV-17 750 16875 1 09-NOV-17 1687.5 10 SG198329 10

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.