Question: For the given relational schema:
Employee(EmpId, EmpName, Street, City)
Works(EmpId, CompId, Salary)
Company(CompId, CompName, City)
A) Write down an SQL DDL definition of the database.
B) Write down an expression in the SQL for each of the given queries.
i) Find out the names of employees whose salary is greater than the average salary of all the employees of their company.
ii) Find out the names of companies which consist of the biggest number of employees.
iii) Find out the names of employees whose salary is greater than that of every employee of company named ‘ABCD’.
iv) Find out the names of companies situated in the city in which company ‘ABCD’ is situated.
v) Write down all employees a 20 percent rise in salary whose city is differs from the city they work in.
vi) Delete the company which is paying the lowest salary to an employee.