Assignment 3 QP
Assignment 3 QP
Q3. Write a query to display the name of the department of EMP table,
which has maximum types of jobs.
Q4. Write a query to display the name of the department from DEPT table,
which has maximum number of employees, as shown in EMP table.
Q5. Write a query to display the name of all the employees of EMP table,
who are getting salary (SAL + COMM) less than the average salary of
all the SALESMAN.
Table: EMP
+-------+--------+-----------+------+------------+---------+------+--------+
| EMPNO | ENAME | JOB | MGR | DOJ | SAL | COMM | DEPTNO |
+-------+--------+-----------+------+------------+---------+------+--------+
| 7369 | SMITH | CLERK | 7902 | 1990-12-17 | 800.00 | NULL | 20 |
| 7499 | ALLEN | SALESMAN | 7698 | 1991-02-20 | 1600.00 | 300 | 30 |
| 7521 | WARD | SALESMAN | 7698 | 1991-02-22 | 1250.00 | 500 | 30 |
| 7566 | JONES | MANAGER | 7839 | 1991-04-02 | 2975.00 | NULL | 20 |
| 7654 | Martin | SALESMAN | 7698 | 1991-09-28 | 1250.00 | 1400 | 30 |
| 7698 | BLAKE | MANAGER | 7839 | 1991-05-01 | 2850.00 | NULL | 30 |
| 7782 | CLARK | MANAGER | 7839 | 1991-06-09 | 2450.00 | NULL | 10 |
| 7788 | SCOTT | ANALYST | 7566 | 1997-04-19 | 3000.00 | NULL | 20 |
| 7839 | KING | PRESIDENT | NULL | 1991-11-17 | 5000.00 | NULL | 10 |
| 7844 | TURNER | SALESMAN | 7698 | 1991-09-08 | 1500.00 | 0 | 30 |
| 7876 | ADAMS | CLERK | 7788 | 1997-05-23 | 1100.00 | NULL | 20 |
| 7900 | JAMES | CLERK | 7698 | 1991-12-03 | 950.00 | NULL | 30 |
| 7902 | FORD | ANALYST | 7566 | 1991-12-03 | 300.00 | NULL | 20 |
| 7934 | MILLER | CLERK | 7782 | 1992-01-23 | 1300.00 | NULL | 10 |
+-------+--------+-----------+------+------------+---------+------+--------+
14 rows in set (0.00 sec)
Table: DEPT
+--------+----------+------+----------+
| DEPTNO | DEPTNAME | MGR | LOCATION |
+--------+----------+------+----------+
| 10 | SALES | 8566 | MUMBAI |
| 20 | PERSONEL | 9698 | DELHI |
| 30 | ACCOUNTS | 4578 | CHINNAI |
| 40 | RESEARCH | 8839 | BANGLORE |
+--------+----------+------+----------+
4 rows in set (0.00 sec)