SQL Lab Session 2
SQL Lab Session 2
2. To display the Tname and City of the TRAINER who joined the institute in the month of December 2001.
SELECT TNAME, CITY
FROM TRAINER
WHERE HIREDATE BETWEEN '2001-12-01' AND '2001-12-31’;
3. To display TNAME,HIREDATE,CNAME,STARTDATE from tables TRAINER and COURSE of all those courses whose
fees is less than or equal to 10000.
SELECT T.TNAME, T.HIREDATE, C.CNAME, C.STARTDATE
FROM TRAINER T NATURAL JOIN COURSE C
WHERE C.FEES <= 10000;
8. Select the average salary of trainers in each city, but only for cities with more than one trainer (using GROUP BY
and HAVING):
SELECT CITY, AVG(SALARY) AS AVERAGE_SALARY
FROM TRAINER
GROUP BY CITY
HAVING COUNT(*) > 1;
9. Select the names of trainers who were hired in the years 1994, 1996, or 2001
11. Select trainers and their courses, ordered by the course start date
13. Select the trainers who have a salary greater than the average salary of all trainers