For JT5893 - Using the ER diagram listed here: http://www.chegg.com/homework-hel
ID: 2246346 • Letter: F
Question
For JT5893 - Using the ER diagram listed here: http://www.chegg.com/homework-help/questions-and-answers/complete-eer-diagram-company-database-described-chapter-4-may-use-visio-powerpoint-mysql-w-q23062209?trackid=61c72524&strackid=0fe0ddea&ii=1 Need the following: Prepare the following queries:
1. Select * from each table
2. Complete a query with at least 2 joins
3. Complete a query with 2 joins and the use of an aggregate function like average or sum
4. Complete a query using an outer join
You should submit your EER diagram, DDL statements, Load DDL, and queries in a single document by the end of the course
Explanation / Answer
1.
SELECT * FROM EMPLOYEE;
SELECT * FROM DEPARTMENT;
SELECT * FROM PROJECT;
SELECT * FROM DEPENDENT;
2.
select e.fName, e.lName, c.salary, (select avg(salary) from employee) as AvgSalary
from employee e
inner join project a on e.Name = a.fName
inner join b on d.Name = b.Location
where c.salary > (select avg(salary) from job)
3.
SELECT employee.name AS Fname, COUNT(employee.ssn)
FROM EMPLOYEE
LEFT JOIN FNAME ON EMPLOYEE.NAME = EMPLOYEE.SSN
WHERE
EMPLOYEE.SSN < 120
GROUP BY EMPLOYEE.FNAME
ORDER BY DESC;
4.
SELECT employee.salary FROM EMPLOYEE WHERE OUTER JOIN employee e ON EMPLOYEE.SSN = e.SSN
WHERE e.salary = '20000' AND w.Fname = 'Michal' AND EXISTS
( SELECT * FROM DEPARTMENT m WHERE m.NAME = w.SSN);
Rate the answer an upvote.........Thankyou
Hope this helps......
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.