Starting from:

$30

ITSE2409-Chapter 3 Solved

How to retrieve data from a single table 

Exercises 

 

Enter and run your own SELECT statements 

In these exercises, you’ll enter and run your own SELECT statements.

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 contacts 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                The ProductName column

                ListPrice                       The ListPrice column

                DateAdded                   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
The ProductName column
ListPrice
The ListPrice column
DiscountPercent
The DiscountPercent column
DiscountAmount
A column that’s calculated from the previous two columns
DiscountPrice
A column that’s calculated from the previous three columns
Sort the result set by discount price in descending sequence.

More products