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

How to retrieve data from two or more tables How to retrieve data from two or mo

ID: 3534392 • Letter: H

Question

How to retrieve data
from two or more tables

How to retrieve data from two or more tables Write a SELECT statement that joins the Categories table to the Products table and returns these columns: Category Name, ProductName, ListPrice. Sort the result set by CategoryName and then by ProductName in ascending order. Write a SELECT statement that joins the Customers table to the Addresses table and returns these columns: FirstName, LastName, Line1, City, State, ZipCode. Return one row for each address for the customer with an email address of allan.sherwood@yahoo.com. Write a SELECT statement that joins the Customers table to the Addresses table and returns these columns: FirstName, LastName, Line1, City, State, ZipCode. Return one row for each customer, but only return addresses that are the shipping address for a customer. Write a SELECT statement that joins the Customers, Orders, Orderltems, and Products tables. This statement should return these columns: LastName, FirstName, OrderDate, ProductName, ItemPrice, DiscountAmount, and Quantity. Use aliases forthe tables. Sort the final result set by LastName, OrderDate, and ProductName.

Explanation / Answer

1)

Select C.CategoryName, P.ProductName, P.ListPrice FROM Categories C, Products P where C.ProductID=P.ProductID order by 1,2


2)

Select C.FirstName,C.LastName,A.Line1,A.City,A.State,A.ZipCode,'allan.sherwood@yahoo.com' AS Email_Address FROM Customers C, Addresses A where C.CustomerID=A.CustomerID


3)

Select C.FirstName,C.LastName,A.Line1,A.City,A.State,A.ZipCode,'allan.sherwood@yahoo.com' AS Email_Address FROM Customers C, Addresses A where C.CustomerID=A.CustomerID and exists ( Select 1 From Addresses I where I.CustomerID=C.CustomerID and Shipping_Addresses is NOT NULL)


4)


Please provide table schema to get answer


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