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.
Question
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.
Solution 1
Assuming you are using SQL, the query would look like this:
SELECT *
FROM bill
WHERE due_date = '2017-10-01'
ORDER BY payable_amount DESC;
Here's the step by step explanation:
-
SELECT * FROM bill: This part of the query is telling the database to select all columns from the table named 'bill'. -
WHERE due_date = '2017-10-01': This is the condition that the rows must meet to be included in the result set. In this case, we're only interested in rows where the 'due_date' is '2017-10-01'. -
ORDER BY payable_amount DESC: This part of the query is telling the database to sort the result set by the 'payable_amount' column in descending order. If you wanted to sort in ascending order, you could use 'ASC' instead of 'DESC'.
Solution 2
Sure, here is the SQL query you asked for:
SELECT *
FROM bill
WHERE due_date = '2017-10-01'
ORDER BY payable_amount DESC;
This query will select all records from the 'bill' table where the 'due_date' is '2017-10-01'. The results will be ordered in descending order based on the 'payable_amount'.
Solution 3
Sure, here is the SQL query you asked for:
SELECT *
FROM bill
WHERE due_date = '2017-10-01'
ORDER BY payable_amount DESC;
This query will select all records from the 'bill' table where the 'due_date' is '2017-10-01'. The results will be ordered in descending order based on the 'payable_amount'.
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 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 mandatory
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 all the 'bills' whose payment_date is on the year 2018, sorted by payable_amount in descending orde
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.