1. Write a SELECT statement that joins the Categories table to the Products table and returns these columns: CategoryName, ProductName, ListPrice. Sort the result set by CategoryName and then by Product Name in ascending order. 2. Write a SELECT statement that joins the Customers table to the Addresses table and returns these columns: FirstName, LastName, Linel, City, State, ZipCode. Return one row for each address for the customer with an email address of allan.sherwood@yahoo.com. 3. Write a SELECT statement that joins the Customers table to the Addresses table and returns these columns: FirstName, LastName, Linel, City, State, ZipCode. Code the join so only addresses that are the shipping address for a customer are returned. 4. Write a SELECT statement that joins the Customers, Orders, OrderItems, and Products tables. This statement should return these columns: LastName, FirstName, OrderDate, ProductName, ItemPrice, DiscountAmount, and Quantity. Use aliases for the tables. Sort the final result set by LastName, OrderDate, and ProductName. 5. Write a SELECT statement that returns the ProductName and ListPrice columns from the Products table. Return one row for each product that has the same list price as another product. (Hint: Use a self-join to check that the ProductID columns aren't equal but the ListPrice column is equal.) Sort the result set by ProductName.
1. Write a SELECT statement that joins the Categories table to the Products table and returns these columns: CategoryName, ProductName, ListPrice. Sort the result set by CategoryName and then by Product Name in ascending order. 2. Write a SELECT statement that joins the Customers table to the Addresses table and returns these columns: FirstName, LastName, Linel, City, State, ZipCode. Return one row for each address for the customer with an email address of allan.sherwood@yahoo.com. 3. Write a SELECT statement that joins the Customers table to the Addresses table and returns these columns: FirstName, LastName, Linel, City, State, ZipCode. Code the join so only addresses that are the shipping address for a customer are returned. 4. Write a SELECT statement that joins the Customers, Orders, OrderItems, and Products tables. This statement should return these columns: LastName, FirstName, OrderDate, ProductName, ItemPrice, DiscountAmount, and Quantity. Use aliases for the tables. Sort the final result set by LastName, OrderDate, and ProductName. 5. Write a SELECT statement that returns the ProductName and ListPrice columns from the Products table. Return one row for each product that has the same list price as another product. (Hint: Use a self-join to check that the ProductID columns aren't equal but the ListPrice column is equal.) Sort the result set by ProductName.
Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter12: Database Queries With Sql
Section: Chapter Questions
Problem 1E
Related questions
Question
Having trouble with my SQL statements returning errors for these. Guidance would be awesome.
![1. Write a SELECT statement that joins the Categories table to the Products table and returns these
columns: CategoryName, ProductName, ListPrice.
Sort the result set by CategoryName and then by Product Name in ascending order.
2. Write a SELECT statement that joins the Customers table to the Addresses table and returns these
columns: FirstName, LastName, Linel, City, State, ZipCode.
Return one row for each address for the customer with an email address of
allan.sherwood@yahoo.com.
3. Write a SELECT statement that joins the Customers table to the Addresses table and returns these
columns: FirstName, LastName, Linel, City, State, ZipCode.
Code the join so only addresses that are the shipping address for a customer are returned.
4. Write a SELECT statement that joins the Customers, Orders, OrderItems, and Products tables. This
statement should return these columns: LastName, FirstName, OrderDate, ProductName, ItemPrice,
DiscountAmount, and Quantity.
Use aliases for the tables.
Sort the final result set by LastName, OrderDate, and ProductName.
5. Write a SELECT statement that returns the ProductName and ListPrice columns from the Products
table.
Return one row for each product that has the same list price as another product. (Hint: Use a self-join
to check that the ProductID columns aren't equal but the ListPrice column is equal.)
Sort the result set by ProductName.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fbd6012b1-8e66-4d34-94b3-3dee4ebd8c4b%2Fdf9cd527-44e1-47da-9e72-d718144a7d74%2Fjeils4f_processed.png&w=3840&q=75)
Transcribed Image Text:1. Write a SELECT statement that joins the Categories table to the Products table and returns these
columns: CategoryName, ProductName, ListPrice.
Sort the result set by CategoryName and then by Product Name in ascending order.
2. Write a SELECT statement that joins the Customers table to the Addresses table and returns these
columns: FirstName, LastName, Linel, City, State, ZipCode.
Return one row for each address for the customer with an email address of
allan.sherwood@yahoo.com.
3. Write a SELECT statement that joins the Customers table to the Addresses table and returns these
columns: FirstName, LastName, Linel, City, State, ZipCode.
Code the join so only addresses that are the shipping address for a customer are returned.
4. Write a SELECT statement that joins the Customers, Orders, OrderItems, and Products tables. This
statement should return these columns: LastName, FirstName, OrderDate, ProductName, ItemPrice,
DiscountAmount, and Quantity.
Use aliases for the tables.
Sort the final result set by LastName, OrderDate, and ProductName.
5. Write a SELECT statement that returns the ProductName and ListPrice columns from the Products
table.
Return one row for each product that has the same list price as another product. (Hint: Use a self-join
to check that the ProductID columns aren't equal but the ListPrice column is equal.)
Sort the result set by ProductName.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
![Oracle 12c: SQL](https://www.bartleby.com/isbn_cover_images/9781305251038/9781305251038_smallCoverImage.gif)
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
![Oracle 12c: SQL](https://www.bartleby.com/isbn_cover_images/9781305251038/9781305251038_smallCoverImage.gif)
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
![A Guide to SQL](https://www.bartleby.com/isbn_cover_images/9781111527273/9781111527273_smallCoverImage.gif)
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781305627482/9781305627482_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781285196145/9781285196145_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning