1. Write a SELECT statement that returns four columns from the Products table: ProductCode, ProductName, ListPrice, and DiscountPercent. The result set should be sorted by list price in descending sequence. 2. Write a SELECT statement that returns these column names and data from the Products table: ProductName The ProductName column ListPrice The ListPrice column Date Added The Date Added column Return only the rows with a list price that's greater than 500 and less than 2000. Sort the result set in descending sequence by the Date Added column. 3. Write a SELECT statement that returns these columns from the Orders table: OrderID The OrderID column Order Date The OrderDate column ShipDate The ShipDate column Return only the rows where the ShipDate column contains a null value.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

How exactly would this be done?

6. Write a SELECT statement that returns these two columns:
CategoryName
The CategoryName column from the Categories table
The ProductID column from the Products table
ProductID
Return one row for each category that has never been used. (Hint: Use an outer join and only return
rows where the ProductID column contains a null value.)
7. Use the UNION operator to generate a result set consisting of three columns from the Orders table:
ShipStatus
A calculated column that contains a value of SHIPPED or NOT
SHIPPED
OrderID
The OrderID column
OrderDate
The OrderDate column
If the order has a value in the ShipDate column, the ShipStatus column should contain a value of
SHIPPED. Otherwise, it should contain a value of NOT SHIPPED.
Sort the result set by OrderDate.
Transcribed Image Text:6. Write a SELECT statement that returns these two columns: CategoryName The CategoryName column from the Categories table The ProductID column from the Products table ProductID Return one row for each category that has never been used. (Hint: Use an outer join and only return rows where the ProductID column contains a null value.) 7. Use the UNION operator to generate a result set consisting of three columns from the Orders table: ShipStatus A calculated column that contains a value of SHIPPED or NOT SHIPPED OrderID The OrderID column OrderDate The OrderDate column If the order has a value in the ShipDate column, the ShipStatus column should contain a value of SHIPPED. Otherwise, it should contain a value of NOT SHIPPED. Sort the result set by OrderDate.
1. Write a SELECT statement that returns four columns from the Products table: ProductCode,
ProductName, ListPrice, and DiscountPercent. The result set should be sorted by list price in
descending sequence.
2. Write a SELECT statement that returns these column names and data from the Products table:
The ProductName column
The ListPrice column
Date Added
The Date Added column
Return only the rows with a list price that's greater than 500 and less than 2000. Sort the result set in
descending sequence by the Date Added column.
3. Write a SELECT statement that returns these columns from the Orders table:
OrderID
The OrderID column
Order Date
The OrderDate column
ShipDate
The ShipDate column
Return only the rows where the ShipDate column contains a null value.
4. Write a SELECT statement that joins the Customers table to the Addresses table and returns these
columns: FirstName, LastName, Line1, City, State, ZipCode.
Product Name
ListPrice
Return one row for each customer, but only return addresses that are the shipping address for a
customer.
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. Sort the result
set by ProductName.
(Hint: Use a self-join to check that the ProductID columns aren't equal but the ListPrice column is
equal.)
Transcribed Image Text:1. Write a SELECT statement that returns four columns from the Products table: ProductCode, ProductName, ListPrice, and DiscountPercent. The result set should be sorted by list price in descending sequence. 2. Write a SELECT statement that returns these column names and data from the Products table: The ProductName column The ListPrice column Date Added The Date Added column Return only the rows with a list price that's greater than 500 and less than 2000. Sort the result set in descending sequence by the Date Added column. 3. Write a SELECT statement that returns these columns from the Orders table: OrderID The OrderID column Order Date The OrderDate column ShipDate The ShipDate column Return only the rows where the ShipDate column contains a null value. 4. Write a SELECT statement that joins the Customers table to the Addresses table and returns these columns: FirstName, LastName, Line1, City, State, ZipCode. Product Name ListPrice Return one row for each customer, but only return addresses that are the shipping address for a customer. 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. Sort the result set by ProductName. (Hint: Use a self-join to check that the ProductID columns aren't equal but the ListPrice column is equal.)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education