Consider the table ORDERS given below and write the output of the SQL queries that follow: ORDNO 1001 1002 1003 1004 1005 1006 1007 ITEM RICE PULSES RICE WHEAT PULSES WHEAT WHEAT QTY 23 12 25 28 16
Advertisements
Question
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 |
12 |
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 |
SELECT ITEM, SUM (QTY) FROM ORDERS GROUP BY ITEM;SELECT ITEM, QTY FROM ORDERS WHERE ORDATE BETWEEN '2023-11-01 ' AND '2023-12-31';SELECT ORDNO, ORDATE FROM ORDERS WHERE ITEM = 'WHEAT' AND RATE>=60;.
Short Answer
Advertisements
Solution
i.
| ITEM | SUM(QTY) |
| RICE | 48 |
| PULSES | 29 |
| WHEAT | 80 |
ii.
| ITEM | QTY |
| RICE | 25 |
| WHEAT | 28 |
iii.
| ORDNO | ORDATE |
| 1004 | 2023-12-25 |
| 1007 | 2024-04-30 |
shaalaa.com
Is there an error in this question or solution?
