Page 85 - C++
P. 85
(1 Mark for correct query)
OR
(½ Mark for correct SELECT )
(½ Mark for correct WHERE Clause)
(iv) To display number of Trainers from each city.
Ans. SELECT CITY, COUNT(*) FROM TRAINER GROUP BY CITY;
(1 Mark for correct query)
OR
(½ Mark for correct SELECT )
(½ Mark for GROUP BY CITY)
(v) SELECT TID, TNAME, FROM TRAINER WHERE CITY NOT
IN(‘DELHI’, ‘MUMBAI’);
Ans. TIDTNAME
103 DEEPTI
106 MANIPRABHA
(½ Mark for correct output)
(vi) SELECT DISTINCT TID FROM COURSE;
Ans. DISTINCT TID
101
103
102
104
105
(½ Mark for correct output)
(vii) SELECT TID, COUNT(*), MIN(FEES) FROM COURSE GROUP BY
TID HAVING COUNT(*)>1;
Ans. TIDCOUNT(*)MIN(FEES)
101 2 12000
(½ Mark for correct output)
(viii) SELECT COUNT(*), SUM(FEES) FROM COURSE WHERE
STARTDATE< ‘2018-09-15’;
Ans. COUNT(*)SUM(FEES)
4 65000
(½ Mark for correct output)
21