1. Write a SELECT statement that returns four columns from the Products table: ProductCode, ProductName, ListPrice, and DiscountPercent. Then, run this statement to make sure it works correctly. Add an ORDER BY clause to this statement that sorts the result set by list price in descending sequence. Then, run this statement again to make sure it works correctly. This is a good way to build and test a statement, one clause at a time. 2. Write a SELECT statement that returns one column from the Customers table named FullName that joins the LastName and FirstName columns. Format this column with the last name, a comma, a space, and the first name like this: Doe, John Sort the result set by last name in ascending sequence. Return only the customers whose last name begins with a letter from M to Z. 3. Write a SELECT statement that returns these column names and data from the Products table: ProductName ListPrice DateAdded The ProductName column The ListPrice column The DateAdded 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 DateAdded column. 4. Write a SELECT statement that returns these column names and data from the Products table: ProductName ListPrice DiscountPercent DiscountAmount DiscountPrice The Product Name column The ListPrice column The DiscountPercent column A column that's calculated from the previous two columns A column that's calculated from the previous three columns Sort the result set by discount price in descending sequence. 5. Write a SELECT statement that returns these column names and data from the OrderItems table: ItemID The ItemID column The ItemPrice column ItemPrice DiscountAmount The DiscountAmount column Quantity PriceTotal DiscountTotal ItemTotal The Quantity column A column that's calculated by multiplying the item price by the quantity A column that's calculated by multiplying the discount amount by the quantity A column that's calculated by subtracting the discount amount from the item price and then multiplying by the quantity Only return rows where the ItemTotal is greater than 500. Sort the result set by item total in descending sequence.

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
Question

Trying to write SQL statements for these shown here and having issues with them working. Explanation on this would be appreciated.

1. Write a SELECT statement that returns four columns from the Products table: ProductCode,
ProductName, ListPrice, and DiscountPercent. Then, run this statement to make sure it works
correctly.
Add an ORDER BY clause to this statement that sorts the result set by list price in descending
sequence. Then, run this statement again to make sure it works correctly. This is a good way to build
and test a statement, one clause at a time.
2. Write a SELECT statement that returns one column from the Customers table named FullName that
joins the LastName and FirstName columns.
Format this column with the last name, a comma, a space, and the first name like this:
Doe, John
Sort the result set by last name in ascending sequence.
Return only the customers whose last name begins with a letter from M to Z.
3. Write a SELECT statement that returns these column names and data from the Products table:
ProductName
ListPrice
DateAdded
The ProductName column
The ListPrice column
The DateAdded 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 DateAdded column.
4. Write a SELECT statement that returns these column names and data from the Products table:
ProductName
ListPrice
DiscountPercent
DiscountAmount
DiscountPrice
The Product Name column
The ListPrice column
The DiscountPercent column
A column that's calculated from the previous two columns
A column that's calculated from the previous three columns
Sort the result set by discount price in descending sequence.
Transcribed Image Text:1. Write a SELECT statement that returns four columns from the Products table: ProductCode, ProductName, ListPrice, and DiscountPercent. Then, run this statement to make sure it works correctly. Add an ORDER BY clause to this statement that sorts the result set by list price in descending sequence. Then, run this statement again to make sure it works correctly. This is a good way to build and test a statement, one clause at a time. 2. Write a SELECT statement that returns one column from the Customers table named FullName that joins the LastName and FirstName columns. Format this column with the last name, a comma, a space, and the first name like this: Doe, John Sort the result set by last name in ascending sequence. Return only the customers whose last name begins with a letter from M to Z. 3. Write a SELECT statement that returns these column names and data from the Products table: ProductName ListPrice DateAdded The ProductName column The ListPrice column The DateAdded 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 DateAdded column. 4. Write a SELECT statement that returns these column names and data from the Products table: ProductName ListPrice DiscountPercent DiscountAmount DiscountPrice The Product Name column The ListPrice column The DiscountPercent column A column that's calculated from the previous two columns A column that's calculated from the previous three columns Sort the result set by discount price in descending sequence.
5. Write a SELECT statement that returns these column names and data from the OrderItems table:
ItemID
The ItemID column
The ItemPrice column
ItemPrice
DiscountAmount
The DiscountAmount column
Quantity
PriceTotal
DiscountTotal
ItemTotal
The Quantity column
A column that's calculated by multiplying the item price by the
quantity
A column that's calculated by multiplying the discount amount
by the quantity
A column that's calculated by subtracting the discount amount
from the item price and then multiplying by the quantity
Only return rows where the ItemTotal is greater than 500.
Sort the result set by item total in descending sequence.
Transcribed Image Text:5. Write a SELECT statement that returns these column names and data from the OrderItems table: ItemID The ItemID column The ItemPrice column ItemPrice DiscountAmount The DiscountAmount column Quantity PriceTotal DiscountTotal ItemTotal The Quantity column A column that's calculated by multiplying the item price by the quantity A column that's calculated by multiplying the discount amount by the quantity A column that's calculated by subtracting the discount amount from the item price and then multiplying by the quantity Only return rows where the ItemTotal is greater than 500. Sort the result set by item total in descending sequence.
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Similar questions
  • SEE MORE QUESTIONS
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