Professional Documents
Culture Documents
Assignment 6 DBMS
Assignment 6 DBMS
Assignment 6 DBMS
Find out the ename, job,sal of the employees whose salaries are less than that of an employee whose
empno= 7876 from employees table
QUERY:-
QUESTION 2:-
Display the name of the employees/employee who gets the second highest salary. (use employee
table).
QUERY:-
SELECT * FROM HR.EMPLOYEES WHERE employee_id IN (SELECT employee_id FROM HR.EMPLOYEES
WHERE salary = (SELECT MAX(salary) FROM HR.EMPLOYEES WHERE salary < (SELECT MAX(salary)
FROM HR.EMPLOYEES)))
OUTPUT:-
FIRST_NAM HIRE_DAT
EMPLOYEE_ID LAST_NAME EMAIL PHONE_NUMBER JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
E E
21-SEP-
101 Neena Kochhar NKOCHHAR 515.123.4568 AD_VP 17000 - 100 90
05
13-JAN-
102 Lex De Haan LDEHAAN 515.123.4569 AD_VP 17000 - 100 90
01
QUESTION 3:-
Display firstname, lastname, salary of those sales representatives whoearns a higher salary than the
minimum salary a sales manager receives
QUERY:-
QUESTION 4:-
List the employees that makes the same salary as other employee whichhas same job as empno=7521.
QUERY:-
select * from HR.employees where salary = (select salary from hr.employees where employee_id=150);
OUTPUT:-
FIRST_NAM HIRE_DAT COMMISSION_PC
EMPLOYEE_ID LAST_NAME EMAIL PHONE_NUMBER JOB_ID SALARY MANAGER_ID DEPARTMENT_ID
E E T
PTUCKE 30-JAN-
150 Peter Tucker 011.44.1344.129268 SA_REP 10000 .3 145 80
R 05
30-JAN-
156 Janette King JKING 011.44.1345.429268 SA_REP 10000 .35 146 80
04
23-MAR-
169 Harrison Bloom HBLOOM 011.44.1343.829268 SA_REP 10000 .2 148 80
06
07-JUN-
204 Hermann Baer HBAER 515.123.8888 PR_REP 10000 - 101 70
02
QUESTION 5:-
Display the employee detail with salary less than those whose job is ‘ST_MAN’.
QUERY:-
select * from HR.employees where salary < (select min(salary) from HR.employees where job_id
='ST_MAN');
OUTPUT:-
EMPLOYEE_I FIRST_NAM PHONE_NUMBE HIRE_DAT SALAR COMMISSION_PC MANAGER_I DEPARTMENT_I
LAST_NAME EMAIL JOB_ID
D E R E Y T D D
590.423.456 25-JUN-
105 David Austin DAUSTIN IT_PROG 4800 - 103 60
9 05
VPATABA 590.423.456 05-FEB-
106 Valli Pataballa IT_PROG 4800 - 103 60
L 0 06
DLORENT 590.423.556 07-FEB-
107 Diana Lorentz IT_PROG 4200 - 103 60
Z 7 07
515.127.456 18-MAY- PU_CLER
115 Alexander Khoo AKHOO 3100 - 114 30
2 03 K
515.127.456 24-DEC- PU_CLER
116 Shelli Baida SBAIDA 2900 - 114 30
3 05 K
515.127.456 24-JUL- PU_CLER
117 Sigal Tobias STOBIAS 2800 - 114 30
4 05 K
515.127.456 15-NOV- PU_CLER
118 Guy Himuro GHIMURO 2600 - 114 30
5 06 K
KCOLMEN 515.127.456 10-AUG- PU_CLER
119 Karen Colmenares 2500 - 114 30
A 6 07 K
650.124.121 16-JUL- ST_CLER
125 Julia Nayer JNAYER 3200 - 120 50
4 05 K
Mikkilinen IMIKKIL 650.124.122 28-SEP- ST_CLER
126 Irene 2700 - 120 50
i I 4 06 K
650.124.133 14-JAN- ST_CLER
127 James Landry JLANDRY 2400 - 120 50
4 07 K
650.124.143 08-MAR- ST_CLER
128 Steven Markle SMARKLE 2200 - 120 50
4 08 K
650.124.523 20-AUG- ST_CLER
129 Laura Bissot LBISSOT 3300 - 121 50
4 05 K
MATKINS 650.124.623 30-OCT- ST_CLER
130 Mozhe Atkinson 2800 - 121 50
O 4 05 K
QUESTION 6:-
Finds the employee whose salary is the same as the minimum salary of the employees in the
department.
QUERY:-