Question: Chapter 8 ( A Guide to SQL ) Use the KimTay Pet Supplies database only. You must use Oracle. Case Exercises: Odd numbers, pg .

Chapter 8(A Guide to SQL) Use the KimTay Pet Supplies database only. You must use Oracle.
Case Exercises: Odd numbers, pg.284-285.
KimTay Pet Supplies
Use the KimTay Pet Supplies database (see Figure 1-2 in Module 1) to complete the following
exercises. If directed to do so by your instructor, use the information provided with the Module 3
Exercises to print your output or save it to a file.
1. List the item ID and description for all items. The descriptions should appear in uppercase letters.
2. List the customer ID and first and last names for all customers located in the city of Cody. Your query should ignore case. For example, a customer with the city Cody should be included, as should customers whose city is CODY, cody, cOdY, and so on.
3. List the customer ID, first and last names, and balance for all customers. The balance should be rounded to the nearest dollar.
4. KimTay Pet Supplies is running a promotion that is valid for up to 20 days after an order is placed. List the invoice number, customer ID, customer first and last names, and the pro-motion date for each invoice. The promotion date is 20 days after the invoice was placed.
5. Write MySQL, PL/SQL, or T-SQL procedures to accomplish the following tasks:
a. Obtain the name and credit limit of the customer whose ID currently is stored in I_CUST_ID. Place these values in the variables I_CUSTOMER_NAME and I_CREDIT_LIMIT, respectively. Output the contents of I_CUSTOMER_NAME and I_CREDIT_LIMIT.
b. Obtain the invoice date, customer ID, and first and last names for the invoice whose number currently is stored in I_INVOICE_NUM. Place these values in the variables I_INVOICE_DATE, I_CUST_ID, and I_CUST_NAME, respectively. Output the contents of I_INVOICE_DATE, I_CUST_ID, and I_CUST_NAME.
c. Add a row to the INVOICE table.
d. Change the date of the invoice whose number is stored in I_INVOICE_NUM to the date currently found in I_INVOICE_DATE.
e. Delete the invoice whose number is stored in I_INVOICE_NUM.
6. Write MySQL, PL/SQL, or T-SQL procedures to retrieve and output the item ID, description, location, and price of every item in the category stored in I_CATEGORY.
7. Write a stored procedure in MySQL, PL/SQL, or T-SQL that changes the price of an item with a given item ID. How would you use this stored procedure to change the price of item
AD72 to $84.99?
8. Write the code for the following triggers in MySQL, PL/SQL, or T-SQL following the style shown in the text.
a. When adding a customer, add the customers balance multiplied by the sales reps commission rate to the commission for the corresponding sales rep.
b. When updating a customer, add the difference between the new balance and the old balance multiplied by the sales reps commission rate to the commission for the corresponding sales rep.
c. When deleting a customer, subtract the balance multiplied by the sales reps commission rate from the commission for the corresponding sales rep.
Chapter 8 ( A Guide to SQL ) Use the KimTay Pet

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!