Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Chapter 4 How to retrieve data from two or more tables Exercises 1. Write a SELECT statement that joins the Categories table to the Products

image text in transcribed
Chapter 4 How to retrieve data from two or more tables Exercises 1. Write a SELECT statement that joins the Categories table to the Products table and returns these columns: category_name, product_name, list price. Sort the result set by category_name and then by product name in ascending sequence. 2. Write a SELECT statement that joins the Customers table to the Addresses table and returns these columns: first_name, last name, linel, city, state, zip code. 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: first_name, last_name, linel, city, state, zip code. 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, Order Items, and Products tables. This statement should return these columns: last_name, first name, order date, product name, item price, discount_amount, and quantity. Use aliases for the tables Sort the final result set by last name, order date, and product name Write a SELECT statement that returns the product name and list price 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 product id columns aren't equal to the list price columns are equal Sort the result set by product name 6. Write a SELECT statement that returns these two columns category_name The category_name column from the Categories table product id The product_id column from the Products table Return one row for each category that has never been used. Hint: Use an outer join and only return rows where the product_ column contains a mulle

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions