Professional Documents
Culture Documents
dml statements:
ddl statements to alter the table employee and department due to cross references:
dml statements:
s
dn
ssn name address e salary superssn
o
1234 m 30000
scott housten,tx 33344 5
5 0
3334 frankli m 40000
housten,tx 88866 5
4 n 0
9998 25000
alicia spring,tx f 98765 4
8 0
9876 jennife 43000
bellaire,tx f 88866 4
5 r 0
6668 m 38000
ramesh humble oak,tx 33344 5
8 0
4534 25000
joyce houston,tx f 33344 5
5 0
9879 m 25000
ahmad bellaire,tx 98765 4
8 0
8886 m 55000
scott houston,tx 1
6 0
6667 willia m 65000
houston,tx 33344 5
7 m 0
2223 m 65000
daniel spring,tx 88866 5
3 0
dloc
dno
1 houston
4 stafford
5 bellaire
5 sugarland
5 houston
pno hours
ssn
12345 1 32.5
12345 2 7.5
66688 3 40
45345 1 20
45345 2 20
33344 2 10
33344 3 10
33344 10 10
33344 20 10
99988 30 30
99988 10 10
98798 10 35
98798 30 5
98765 30 20
98765 20 15
88866 20
12345 3 15
output:
pno
1
2
3
20
show the resulting salaries if every employee working on the ‘iot’ project is given a 10
percent raise.
output:
select sum(salary),max(salary),min(salary),avg(salary)
from employee e,department d
where e.dno=d.dno and dname='research';
or
select sum(salary),max(salary),min(salary),avg(salary)
from employee natural join department
where dname='research';
output:
retrieve the name of each employee who works on all the projects controlledby
department number 5 (use not exists operator).
select e.name
from employee e
where not exists(select pno
from project
where dno=5 and pno not in
(select pno
from works_on
where e.ssn=ssn));
output:
name
scott
for each department that has more than five employees, retrieve the department
number and the number of its employees who are making more than rs. 6,00,000.
count(*)
dno
5 2