I have created and insert queries : Table 1: Employee Omaha Table 2: Works Table
ID: 3753301 • Letter: I
Question
I have created and insert queries :
Table 1: Employee
Omaha
Table 2: Works
Table 3: Company
Table 4: Manages
I have created and insert queries :
Questions:
1- Find the names of all employees who do not work for either Microsoft or Facebook.
2- Find cities of residence of all employees who earn either strictly less than $50,000 or strictly more
than $400,000.
3- Find the company name and their number of employees. Display the results in descending order or
the number of employees. If two companies have the same number of employees, display them in
lexicographical order.
4- Find the name of managers that have their salary smaller than some of the employee they manage.
thank you..
Employee_name Street City William Gates III University St Redmond Warren Buffett Alaskan WayOmaha
Explanation / Answer
Answers)
1- Find the names of all employees who do not work for either Microsoft or Facebook.
select Employee_name from Works where Company_name not in ('Microsoft','Facebook');
2- Find cities of residence of all employees who earn either strictly less than $50,000 or strictly more than $400,000.
select City from Employee where Employee_name in (
select Employee_name from Works where Salary < 50000 or Salary > 400000
);
3- Find the company name and their number of employees. Display the results in descending order or the number of employees. If two companies have the same number of employees, display them in lexicographical order.
select Company_name, count(Employee_name) from Works group by Company_name order by count(Employee_name) desc;