Advertisements
Advertisements
प्रश्न
Consider the following table:
Table: SALESMAN
| Scode | Sname | Area | Qtysold | Dateofjoin |
| S001 | Ravi | North | 120 | 2015-10-01 |
| S002 | Sandeep | South | 105 | 2012-08-01 |
| S003 | Sunil | NULL | 68 | 2018-02-01 |
| S004 | Subh | West | 280 | 2010-04-01 |
| S005 | Ankit | East | 90 | 2018-10-01 |
| S006 | Raman | North | NULL | 2019-12-01 |
Based on the given table SALESMAN Write SQL queries to perform the following operation:
- Count the total number of salesman.
- Display the maximum qtysold from each area.
- Display the average qtysold from each area where number of salesman is more than 1.
- Display all the records in ascending order of area.
कोड लेखन
Advertisements
उत्तर
SELECT COUNT(Sname) FROM SALESMAN;SELECT Area, MAX(Qtysold) FROM SALESMAN GROUP BY Area;SELECT Area, AVG(Qtysold) FROM SALESMAN GROUP BY Area HAVING COUNT(*)>1;SELECT * FROM SALESMAN ORDER BY Area;
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
