EMP_NO NOT NULL NUMBER(4) EMP_NAME VARCHAR(25) DESIGNATION CHAR(4) JOINING_DATE DATE SALARY NUMBER(7,2) DEPT_NO NUMBER(2)
DEPT_NO NOT NULL NUMBER(2) DEPT_NAME VARCHAR(25) BUDGET NUMBER(15,2) MANAGER VARCHAR(25)
Create tables EMP, and DEPT, the structure for which are given above.
Write SQL queries for the following :
Display each employee‚??s name and date of joining.
Display employees earning more than Rs.5,000. Label the column name ‚??Employee‚??.
Display all employee names and employee numbers in the alphabetical order of names.
Display all employee names containing the letter ‚??S‚??.
Display the employees hired in 1981.
Display the minimum and maximum salary.
Display the list of employees along with their department name and its manager.
Display the number of different employees listed for each department.
Delete the records of all the employees hired in 1981 from EMP table.
Update the salary of all the employees to Rs. 10,000.
Check the following queries:
1)SELECT EMP_NAME, JOINING_DATE from emp; 2)SELECT EMP_NAME from emp where SALARY>5000; 3)SELECT EMP_NO,EMP_NAME FROM emp ORDER BY EMP_NAME; 4)SELECT EMP_NAME FROM emp WHERE EMP_NAME like '%a%'; 5)SELECT * from emp where YEAR(JOINING_DATE)=1981; 6)SELECT MAX(SALARY),MIN(SALARY) from emp; 7)SELECT e.EMP_NAME,d.DEPT_NAME,d.MANAGER FROM emp e,dept d WHERE e.DEPT_NO = d.DEPT_NO; 8)SELECT DEPT_NO,COUNT(*) AS "Number of employees" FROM emp GROUP BY DEPT_NO; 9)DELETE FROM emp where YEAR(JOINING_DATE)=1981; 10)UPDATE emp set SALARY=10000;
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.