Page 84 - C++
P. 84
COURSE
CID CNAME FEES STARTDATE TID
C201 AGDCA 12000 2018-07-02 101
C202 ADCA 15000 2018-07-15 103
C203 DCA 10000 2018-10-01 102
C204 DDTP 9000 2018-09-15 104
C205 DHN 20000 2018-08-01 101
C206 O LEVEL 18000 2018-07-25 105
(i) Display the Trainer Name, City & Salary in descending order of their
Hiredate.
Ans. SELECT TNAME, CITY, SALARY FROM TRAINER ORDER BY
HIREDATE;
(½ Mark for SELECT TNAME, CITY, SALARY FROM TRAINER)
(½ Mark for ORDER BY HIREDATE)
(ii) To display the TNAME and CITY of Trainer who joined the Institute in the
month of December 2001.
Ans. SELECT TNAME, CITY FROM TRAINER WHERE HIREDATE
BETWEEN ‘2001-12-01’ AND ‘2001-12-31’;
OR
SELECT TNAME, CITY FROM TRAINER WHERE HIREDATE >=
‘2001-12-01’ AND HIREDATE<=‘2001-12-31’;
OR
SELECT TNAME, CITY FROM TRAINER WHERE HIREDATE LIKE
‘2001-12%’;
(½ Mark for SELECT TNAME, CITY FROM TRAINER)
(½ Mark for
WHERE HIREDATE BETWEEN ‘2001-12-01’ AND ‘2001-12-31’
OR
WHERE HIREDATE >= ‘2001-12-01’ AND HIREDATE<=‘2001-12-31
OR
WHERE HIREDATE LIKE ‘2001-12%’
(iii) To display TNAME, HIREDATE, CNAME, STARTDATE from tables
TRAINER and COURSE of all those courses whose FEES is less than or
equal to 10000.
Ans. SELECT TNAME,HIREDATE,CNAME,STARTDATE FROM
TRAINER, COURSE WHERE TRAINER.TID=COURSE.TID AND
FEES<=10000;
20