Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

h. There are movies with more than a dozen actors i. Some producers have been a

ID: 3834716 • Letter: H

Question

h. There are movies with more than a dozen actors i. Some producers have been a director as well. j. Most movies have one director and one producer k. There are some actors, who have had a lead role, directed a movie, and produced some movie I. No movie has a director who also acted in that movie. m. Some movies have one director but several producers. Exercise 2 Garden Glory is a partnership that provides gardening and yard maintenance services to individual and organizations. Assume that Garden Glory designs a database with the following tables: OWNER Name, Email, Type) PROPERTY(Property ID, Street, City. State, Zip, ownerlD) EMPLOYEE (nitials, Name, Cell Phone, ExperienceLevel) SERVIC PropertID Initials, Date, HoursWorked) Type is either Individual or Corporation, a ExperienceLevel is one of Junior, senior, Master or SuperMaster. Code SQL statements to answer the questions below: 1. List all columns of all tables 2. List the Name and CellPhone of all employees having an experience level of Master. 3. List the Name and CellPhone of all employees having a Name that begins with J. 4. List the Name of employees who have worked on a property in New York (use subquery) 5. Same as d,but using a join 6. Show the number of properties of Type Corporation. 7. List the Name of employees who have worked on a property owned by a Corporation

Explanation / Answer

1.select * from Owner;

select * from Property;

select * from Employee;

select * from Service;

2.select Name,CellPhone from Employee where ExperienceLevel = 'Master';

3.select Name,CellPhone from Employee where Name like 'J%';

4.select Name from Employee where Initials=(select Initials from Service where PropertyID =(select PropertyID from Property where City = 'New York'));

5.select Employee.Name from Employee Join Service on Employee.Initials=Service.Initials join Property on Service.PropertyID=Property.PropertyID where Property.City='New York';

6.select count(Property.PropertyID) from Property Join Owner on Property.OwnerID=Owner.OwnerID where Owner.Type='Corporation';

7.select Employee.Name from Employee Join Service on Employee.Initials=Service.Initials Join Property on Service.PropertyID=Property.PropertyID Join Owner on Property.OwnerID=Owner.OwnerID where Owner.Type='Corporation';

8.select Employee.Name,Sum(Service.HoursWorked) from Employee Join Service on Employee.Initials=Service.Initials group by Employee.Name;

9.select Employee.ExperienceLevel,Sum(Service.HoursWorked) from Employee Join Service on Employee.Initials=Service.Initials group by Employee.ExperienceLevel order by Employee.ExperienceLevel desc;

10.select Owner.Type,Sum(Service.HoursWorked) from Service Join Property on Service.PropertyID=Property.PropertyID Join Owner on Property.OwnerID=Owner.OwnerID group by Owner.Type;