Question: Employee ( Lastname , FirstName , MidInitial , gender, street, city) Works ( Lastname , FirstName , MidInitial , company-name , salary) company ( company-name
Employee (Lastname, FirstName, MidInitial, gender, street, city)
Works (Lastname, FirstName, MidInitial, company-name, salary)
company (company-name, city)
Manages(Lastname, FirstName, MidInitial, ManagerLastname, MFirstName, MMidInitial, start-date)
Note: Bold - Primary Key
bold/italics - foreign key
Write SQL queries for the following:-
Q1. Find all employees in the database who live in the same cities and on the same streets as do their managers.
Q2. Find the names of the companies which have employees residing in all cities where employees of Mutual of Omaha (MOO) live.(So if MOO has employees living in three cities, each company returned by this query must have employees living in all these three cities.)
Q3. For those employees whose last name initial is not a character C and who earn less than the average salary of all employees of their own companies,
find their full names and cities they live.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
