Question 73 of 95
Q.Consider the table ORDERS given below and write the output of the SQL queries that follow: ORDNO ITEM QTY RATE ORDATE 1001 RICE 23 120 2023-09-10 1002 PULSES 13 120 2023-10-18 1003 RICE 25 110 2023-11-17 1004 WHEAT 28 65 2023-12-25 1005 PULSES 16 110 2024-01-15 1006 WHEAT 27 55 2024-04-15 1007 WHEAT 25 60 2024-04-30
(i) SELECT ITEM, SUM(QTY) FROM ORDERS GROUP BY ITEM;
(ii) SELECT ITEM, QTY FROM ORDERS WHERE ORDATE BETWEEN '2023-11-01' AND '2023-12-31';
(iii) SELECT ORDNO, ORDATE FROM ORDERS WHERE ITEM = 'WHEAT' AND RATE>=60;
Yanam BieapCBSE Class XII Board 2024Subjective· 3mImportance★★★★★
77% · 73/95 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →The three queries produce a grouped total per item, a date-range filter, and a two-condition filter on the ORDERS table. Their outputs are shown as tables below.
Query (i): grouped totals
SELECT ITEM, SUM(QTY) FROM ORDERS GROUP BY ITEM;
GROUP BY ITEM collapses rows with the same item, and SUM(QTY) totals their quantities: RICE = 23 + 25 = 48, PULSES = 13 + 16 = 29, WHEAT = 28 + 27 + 25 = 80.
| ITEM | SUM(QTY) |
|---|---|
| RICE | 48 |
| PULSES | 29 |
| WHEAT | 80 |
Query (ii): date range
SELECT ITEM, QTY FROM ORDERS WHERE ORDATE BETWEEN '2023-11-01' AND '2023-12-31';
BETWEEN is inclusive of both boundary dates, so only order 1003 (2023-11-17) and order 1004 (2023-12-25) fall in the range.
| ITEM | QTY |
|---|---|
| RICE | 25 |
| WHEAT | 28 |
Query (iii): two conditions
SELECT ORDNO, ORDATE FROM ORDERS WHERE ITEM = 'WHEAT' AND RATE>=60;
``` …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.