Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Consider the following employee database

Consider the following employee database. (RGPV 2019)

Employee (empname,street, city) 

work (empname,companyname,salary) 

company (companyname,city) 

manages (empname,management). 

Give an expression in the SQL for each request.

i) Find the names of all employees who work for first Bank corporation.

select employee.empname from employee, works 

where employee.empname=works.empname 

and companyname = ‘First bank corporation’.

ii) Find the names, street address and cities of residence of all employees who work for first Bank corporation and earn more than 200000 per annum.

select employee.empname, employee.street, employee.city from

employee, works where employee.empname=works.empname 

and companyname = ‘First bank corporation’ and salary > 200000).

iii) Find the names of all employee in this database who live in the same city as the company for which they work.

select employee.empname from employee e, works w, company c

where e.empname = w.empname 

and e.city = c.city 

and w.companyname = c.companyname.