Lab 1
Lab 1
To determine the exact name of fields used in the tables for these exercises, refer to
the tables in the
JustLee Books database, or use the DESCRIBE tablename command to view the
tables structure.
1. Create a list containing the publishers name, the person usually contacted,
and the publishers telephone number. Rename the contact column Contact
Person in the displayed results. (Hint: Use the PUBLISHER table.)
2. List the customer number from the ORDERS table for each customer who has
placed an order with the bookstore. List each customer number only once.
3. List all information for each order item. Include an item total, which can be
calculated by multiplying the Quantity and Paideach columns. Use a column
alias for the calculated value to show the heading Item Total in the output.
(Hint: Use the OREDERITEMS table.)
4. Create a mailing list from the CUSTOMERS table. The mailing list should
display the name, address, city, state, and zip code for each customer. Each
customers name should be listed in order of last name followed by first
name, separated with a comma, and have the column header Name. The
city and state should be listed as one column of output, with the values
separated by a comma and the column header Location.
5. To determine the percentage of profit for a particular item, subtract the items
cost from the retail price to calculate the dollar amount of profit, and then
divide the profit by the items cost. The solution is then multiplied by 100 to
determine the profit percentage for each book. Use a SELECT statement to
display each books title and percentage of profit. For the column displaying
the percentage markup, use Profit % as the column heading.
6. Which books arent in the FAMILY LIFE category? List each books title and
category.
7. Which orders were placed on or before MARCH 31, 2009? List each order
number and order date. Write this query two different ways.
8. Display the book title and category for all books in the Fitness and Literature
categories. Create three different queries to accomplish this task: a) a search
pattern operation, b) a logical operator, and c) another operator not used in a
or b.
9.
Use a search pattern to find any book title with Y for the last letter and
contains IN in the title. List each books ISBN and title. Sort the list by title
in descending order.
10.List the title and publish date of any computer book published in 2004.
Perform the task of searching for the publish date by using three different
methods: a) a range operator,b) a logical operator, and c) a search pattern
operation.