Record Mysql Emp
Record Mysql Emp
1
4. Create table dept with the following attributes:.
----------+----------+---
| Field | Type |
+----------+----------+--
| DEPTNO | int(11) |
| DNAME | char(20) |
| LOCATION | char(20)
| +----------+----------+----
2
9. Display the different deptno
11. Display the names and salary of employees who earn a salary between 2500 and
5000( both inclusive)
mysql> SELECT ENAME, SAL FROM EMP WHERE SAL BETWEEN 2500 AND 5000;
+-------+------+
| ENAME | SAL |
+-------+------+
| KING | 5000 |
| BLAKE | 2850 |
+-------+------+
2 rows in set (0.00 sec)
3
13. . Display the names of employees who are not managers
16. Display the names of employees starting with the letter K and having 3 more
characters
4
mysql> SELECT ENAME FROM EMP WHERE ENAME LIKE ‘'%G';
+-------+
| ENAME |
+-------+
| KING |
+-------+
1 row in set (0.00 sec)
18. Display the Empno, name and department name of all employees
19. Display the name salary of all employees who are at “New York”
20. Display the name and hiredate of all employees in New York hired after 2012-01-01
5
21. Display the name and salary of employees in deptno 10 in descending order of salary
22. Display the name and salary of employees in ascending order of salary
+--------+
| ENAME |
+--------+
| BLAKE |
| CLARKE |
| JAMES |
| KING |
| MARTIN |
+--------+
4 rows in set (0.05 sec)
6
24. Display the no: of employees in each department
26. Display the average salary of each job type only if the no: of employees in each type
is > 1
+--------+----------+----------+
| DEPTNO | MAX(SAL) | MIN(SAL) |
+--------+----------+----------+
| 10 | 5000 | 950 |
| 30 | 2850 | 1250 |
7
+--------+----------+----------+
2 rows in set (0.00 sec)