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

Select all data from the Orders table, ordered by OrderDate, newest date on top,

ID: 3757106 • Letter: S

Question

Select all data from the Orders table, ordered by OrderDate, newest date on top, for orders shipped between January 1997 and August 1997 Select all data from the Orders table, ordered by OrderDate, newest date on top, for orders placed between July 1996 and January 1997 Select all data from the Orders table, for orders placed in January 1998. Select count of Orders shipped in 1996, 1997 and 1998. (one query containing all values) -> 2 columns (count and year), 3 rows (1 row per year). 1. 2. 3. 4. 5. Select all records from Employee table that any title related to "Sale" 6. Select all data from Orders table whose freight is more than 500 7. List all employees who have worked in company Northwind for more than 25 years 8. Calculate the average number of days it takes Northwind for all orders from "Ordered" (OrderDate) to "Shipped" (ShippedDate) status. FEEL FREE TO MAKE UP ANY NAMES FOR UNDEFINED TABLES

Explanation / Answer

If you have any doubts, please give me comment...

-- 1)

SELECT *

FROM Orders

WHERE ShippedDate >= '1997-01-01' AND ShippedDate<='1997-08-31';

-- 2)

SELECT *

FROM Orders

WHERE OrderDate >= '1996-07-01' AND ShippedDate<='1997-01-31';

-- 3)

SELECT *

FROM Orders

WHERE OrderDate >= '1998-01-01' AND ShippedDate<='1997-01-31';

-- 4)

SELECT COUNT(*) count, YEAR(ShippedDate) AS year

FROM Orders

WHERE YEAR(ShippedDate) IN (1996, 1997, 1998);

-- 5)

SELECT *

FROM Employee

WHERE title LIKE '%Sale%';

-- 6)

SELECT *

FROM Orders

WHERE freight > 500;

-- 7)

SELECT *

FROM Employee E, Worked W

WHERE E.EmpID = W.EmpID AND DATEDIFF(year, CURDATE(), DateJoined) >25;

-- 8)

SELECT AVG(DATEDIFF(ShippedDate, OrderDate))

FROM Orders;

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