Create Tables With Following Structure
Create Tables With Following Structure
ASSIGNMENT NO 1.
[email protected]
DATE – 24/08/2022
Create tables with following structure. These tables are readily available in Oracle database, however,
you can easily create these in MySQL or other RDBMS using scripts mentioned in various online
tutorials such as http://oraclemine.com/emp-and-dept-tables-in-oracle/
Salgra
Emp Dept
de
DEPTNO GRAD
EMPNO ENAME JOB MGR HIREDATESAL
DNAME ELOS
COMM DEPTNO
LOC AL
HISAL
Post table creation and populating with sample data, try writing queries from below list to practice your skills
Mandatory
1. Find the details of all the managers (in any dept) and clerks in dept 20.
2.
3. Find the details of all the managers in dept. 10 and all clerks in dept 20 and all employees who are neither
managers nor clerks but whose salary is more than or equal to 2000/-.
4. Find the names of anyone in dept. 20 who is neither manager nor clerk.
5. Find the names of employees who earn between 1200/- and 1400/-.
6. Find the employees who are clerks, analysts or salesmen.
7. Find the employees who are not clerks, analysts or salesmen.
8. Find the employees who do not receive commission.
9. Find the different jobs of employees receiving commission.
Recommended
'1'
select * from EMP where Job = 'MANAGER' or Job = 'CLERK' and DEPTNO =
20 ;
'2'
'3'
Select ENAME from EMP where DEPTNO = 20 and Job != 'MANAGER' && Job
!= 'CLERK';
'4'
select ENAME from EMP where SAL between 1200 and 1400;
'5'
'6''1'
Select * from EMP where Job = 'MANAGER'or Job = 'CLERK' and DEPTNO =
20 ;
'2'
'3'
select ENAME from EMP where DEPTNO = 20 and Job!= 'MANAGER' &&
Job != 'CLERK';
'4'
select ENAME from EMP where SAL between 1200 and 1400;
'5'
'6'
select * from EMP where JOB != 'CLERK' and JOB != 'ANALYST' and JOB !=
'SALESMAN';
'7'
'8'
'9'
'10'
'11'
'12'
'13'
'14'
select ENAME, JOB, SAL from EMP where DEPTNO = 20 and SAL > 2000;
'15'
select * from EMP where DEPTNO = 30 and Job ='SALESMAN' and SAL >
1500;
'16'
'17'
select * from EMP where JOB != 'CLERK' and JOB != 'ANALYST' and JOB !=
'SALESMAN';
‘19’
‘20’