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.

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter6: Additional Database Objects
Section: Chapter Questions
Problem 6HOA: A new table has been requested to support tracking automated emails sent to customers. Create the...
icon
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.
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
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
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