Professional Documents
Culture Documents
1.
select [name] from employee,salary
where employee.empno=salary.empno and pay>8000
2.
select employee.[name] from employee,department
where employee.deptid=department.deptid
and dt_join='11-oct-1991'
3.
select employee.[name] from employee,department
where employee.deptid=department.deptid
and department.[name]<>'Consultancy'
4.
select [name] from employee,salary
where employee.empno=salary.empno and pay<=5000
5.
select [name] from employee,salary
where employee.empno=salary.empno and pay>=8000
6.
select count(*) as num_rows from employee
7.
select count(empno) no_emp_d1 from employee where deptid='d1'
8.
select count(employee.empno) from employee,salary
where employee.empno=salary.empno and pay<6000 and deptid='d1'
9.
select count(distinct deptid) from employee
10.
select sum(basic) as tot_basic from salary
11.
select sum(basic)
from salary
where empno in
(select empno
from employee
where deptid='d1')
12.
Using Join
select sum(basic) from
employee e, department d, salary s
where e.deptid=d.deptid and e.empno=s.empno
and e.deptid='d1' and not pay < 6000
13.
select sum(pay)
from salary
where empno in
(select empno
from employee
where deptid='d1')
14.
Using joins
select sum(basic) from
employee e, department d, salary s
where e.deptid=d.deptid and e.empno=s.empno
and e.deptid='d1' and basic between 6000 and 8000