(SCREENSHOT INPUT & OUTPUT) MYSQL (FOLLOW INFO GIVEN HERE this LINK) https://www
ID: 3717693 • Letter: #
Question
(SCREENSHOT INPUT & OUTPUT) MYSQL (FOLLOW INFO GIVEN HERE this LINK)
https://www.chegg.com/homework-help/questions-and-answers/1-n-1-n-employee-orders-customer-employee-id-orderld-customer-id-first-name-customer-id-fi-q28858460
Screen shots of SQL queries you used to retrieve data from the tables along with the query results. For each query, explain in a complete, coherent sentence what it is intended to do, what data is expected as a result and how they are different from previous queries. Clearly identify each screen shot you paste into this section. To create queries, use the following structures: 4. A query that is based on two tables and includes both an arithmetic and a special operator in the conditional expression. a. b. A query that is based on more than two tables and includes both an arithmetic and a special operator in the conditional expression. Both the arithmetic and the special operator must be different from the ones used in part a c. A query that includes a sub-query.Explanation / Answer
a.
SELECT COUNT(*)
FROM Order_Line
WHERE Order_Line.OrderID = Orders.OrderID
Orders.EmployeeID != 1234;
This query counts the number of orders made by all the employees except the one with employee id as 1234.
arithmetic opertaor = '='
special operator = '!='
b.
SELECT COUNT(*)
FROM Item I
WHERE I.OutDate - I.InDate < 10
JOIN Order_Line L ON L.ItemID = I.ItemID
JOIN Orders O ON O.OrderID = L.OrderID
JOIN Customer C ON C.CustomerID = O.CustomerID
AND C.FirstName = 'David';
This query counts the number of items bought by David which are bought within 10 days of its arrival in store
arithmetic opertaor = '-'
special operator = '>'
c.
SELECT FirstName
FROM Employee
WHERE EmployeeID IN (SELECT EmployeeID
FROM Order_Line O
JOIN Item I ON I.ItemID = O.ItemID
AND I.Cost > 5000);
This query displays the first name of all the employees who sold items of worth above 5000
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.