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

Using mysql statemnts to answer these questions: no need to create prgram, Just

ID: 3716793 • Letter: U

Question

Using mysql statemnts to answer these questions: no need to create prgram, Just typed out statemnts.

Use the following relations schema and give an expression in SQL for each of the following queries:

Table: employee, works, department, mangers

1.Find the names,street adress and cities of residence for all employess who work for "computer Science" and earn more than $1000?
2.Find the names of all employees in the database who live in the same cities as the department for which they work?
3.Find the names of all employees in the database who live in the same cities and on the same streets as do their managers.
4.Find the names of all employees in the database who do not work for "computer Science
5.Find the names of all employees in the database who work for 'Business Administration'

Explanation / Answer

You haven't provided full definition of schema

As far as i can deduce full definition of schema's are

Employee(Eid,name,street,city,salary)

Works(Eid,Did)

department(Did,Dname,city)

managers(Mid,Eid,name,street,city,salary)

Eid's in manager tells the employees under him.

1).SELECT E.name,E.street,E.city

FROM employee E,works W,department D

WHERE E.Eid = W.Eid AND

W.Did = D.Did AND

E.salary > 1000 AND

D.name = 'Computer science'

2).SELECT E.name

FROM employee E,works W,department D

WHERE E.Eid = W.Eid AND

W.Did = D.Did AND

E.city = D.city

3).SELECT E.name

FROM employee E,manager M

WHERE E.Eid = M.Eid AND

E.city = M.city AND

E.street = M.street

4).SELECT E.name

FROM employee E,works W,department D

WHERE E.Eid = W.Eid AND

W.Did = D.Did AND

D.name !=''computer science''

5).SELECT E.name

FROM employee E,works W,department D

WHERE E.Eid = W.Eid AND

W.Did = D.Did AND

D.name = 'Business Administration'

  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote