Dbms Exp 6
Dbms Exp 6
2. Name all the employees who lives in same city of the company in which they
work
mysql> select emp.ename from emp,works,comp where emp.ename=works.ename and
works.cname=comp.cname and emp.city=comp.city;
5. Name of all employees who earn more than every employee of Infosys
mysql> select ename from works where salary>
-> (select max(salary) from works where cname='INFOSYS');
6. Name of all the employees who earn more than avg salary of all employees of
their companies
mysql> select w1.ename from works w1 where salary>
-> (select avg(salary) from works w2 where w1.cname=w2.cname);