forked from Code-the-Dream-School/Backend-sqlruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql.txt
More file actions
19 lines (13 loc) · 991 Bytes
/
sql.txt
File metadata and controls
19 lines (13 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
SELECT with JOIN practice:
Join the OrderDetails and Products tables, to show a report where the columns are OrderID, ProductName, and Quantity.
Paste the SQL statement you used below.
SELECT OrderDetails.OrderID, Products.ProductName, OrderDetails.Quantity
FROM OrderDetails
INNER JOIN Products ON OrderDetails.ProductID = Products.ProductID;
Join the Orders, OrderDetails, and Employees tables to return a report with with the EmployeeName, ProductID, and Quantity.
Paste the SQL statement you used below. Hint: EmployeeName is not a column in the Employee table, but you can generate a
report with EmployeeName by starting your SQL this way: SELECT (Employees.FirstName || " " || Employees.LastName) AS EmployeeName,
SELECT (Employees.FirstName || " " || Employees.LastName) AS EmployeeName, OrderDetails.ProductID, OrderDetails.Quantity
FROM OrderDetails
INNER JOIN Orders ON OrderDetails.OrderID = Orders.OrderID
INNER JOIN Employees ON Orders.EmployeeID = Employees.EmployeeID;