You are on page 1of 4

Chapter 8 Exercises

Name Leatherwood CH08

Page 1 of 4

Use MySQL to complete the commands as instructed below. Use the snipping tool in Windows to capture both the SQL
statements and the results of the statements for each step listed and then paste it into this document. If you need
directions for using the Snipping Tool, go to Blackboard and download the handout How to use the Snipping Tool.pdf.
Most of the exercises below will have 2 snips: the actual command and the command to display the results.
Use Microsoft Word or WordPad to complete the exercises. Name files using your lastname and chapter number for the
filename. For example: Mrs. Hall would name her file HallCh6.

TAL Distributors
1.

List the item number and description for all items. The descriptions should appear in uppercase letters.

List the customer number and name for all customers located in the city of Grove. Your query should ignore case.
For example, a customer with the city Grove should be included as should customers whose city is GROVE, grove,
GrOvE, and so on.

Chapter 8 Exercises

3.

Name Leatherwood CH08

Page 2 of 4

List the customer number, name, and balance for all customers. The balance should be rounded to the nearest
dollar.

Chapter 8 Exercises

Name Leatherwood CH08

Page 3 of 4

4. TAL Distributors is running a promotion that is valid for up to 20 days after an order is placed. List the order number,
customer number, and the promotion date for each order. The promotion date is 20 days after the order was placed.
5. MySQL includes several date and time functions. Two of these functions are CURRENT_DATE and
MONTHS_BETWEEN. Use the internet to research these functions. How does the CURRENT_DATE function differ
from the SYSDATE function? Are these functions available in Oracle SQL, SQL Server, and Access? Write a
paragraph that discusses what the functions do and any differences and/or similarities between the functions in
Oracle, SQL Server, and Access. Then perform the following tasks:
a. TAL Distributors would like to know the number of months between the current date and the order date of an
order. Write an SQL statement in MySQL that displays the order number and the number of months between
the current date and the order date. The number of months should display as an integer. (Hint: You can nest
one function within another function.)
b. The NOW() function in another function in MySQL that will retrieve the current date. How does it differ from
the DATE() function?
NOW () returns the value of current date and time in YYYY-MM-DD DATE () takes the date part out from a date time expression. -

Chapter 8 Exercises

Name Leatherwood CH08

Page 4 of 4

Solmaris Condominium Group


Use the Solmaris Condominium Group database to complete the following exercises.
1.

List the owner number, first name, and last name for all owners. The first name should appear in uppercase letters
and the last name should appear in lowercase letters.

2.

List the owner number and last name for all owners located in the city of Bowton. Your query should ignore case. For
example, a customer with the city Bowton should be included as should customers whose city is BOWTON, BowTon,
BoWtOn, and so on.

3.

Solmaris is offering a monthly discount for owners who pay their condo fees on a quarterly basis. The discount is
1.75 percent of the monthly fee. For each condo, list the location number, unit number, owner number, owners last
name, condo fee, and discount. The discount should be rounded to the nearest dollar.

4. SQL includes many numerical functions. Two of these functions are FLOOR and CEIL. Use the Internet to research
these functions. Are the functions available in Oracle, SQL Server, and Access? Write a paragraph that discusses
what the functions do and any differences and/or similarities between the functions in Oracle, SQL Server, and
Access. Then perform the following tasks:
a. Solmaris Condominium Group would like to know the impact of discounting its condo fees by 3 percent. Write
an SQL statement in MySQL that displays the condo ID, unit number, discounted condo fee, discounted
condo fee with the CEIL function, and discounted condo fee with the FLOOR function.
b. Based on your research, will the values in the three columns vary? If so, how? Use the condo with the ID of 1
to explain your answer.