Вы находитесь на странице: 1из 4

Exam 2 (1)

1. Nike Shoe Supplier Database: CUSTOMERS (cust_no, cust_name, street, town, post_code, cr_limit, curr_bal) PRODUCTS (prod_cod, description, prod_group, list_price, qty_on_hand, remake_level, remake_qty) ORDERS (order_no, order_date, cust_no) ORDER_DETAILS (order_no, prod_cod, order_qty, order_price) Some attributes, such as cust_name, are self-explanatory; however, others need some definition: cr_limit: The maximum that a customer is allowed to owe curr_bal: The amount currently owed by the customer list_price: The advertised price for a single unit of a particular product remake_level: The level to which the quantity on hand is compared; if qty_on_hand falls below this level, then the Nikke shoe supplier company will usually make another batch (to the manufacturer) to avoid stockout. remake_qty: The quantity usually made in any new batch. order_price: The unit price charged on this order for this product order_date: The date on which the order was taken.
CUSTOMERS Cust_no Cust_name 1066 Bundy Shoe 13144 Target 1776 Harry Store 2001 Kmart 2002 Qshoe PRODUCTS Prod_cod Description MO9 LO9 ST1 LT1 LT9 GN9 ST1 GA2 ORDERS Order_no 0001 0002 0003 Male Runner Lady Runner Girls Runner Tennis Shoe Tennis Shoe Beach Sandal Slipper Soccer Shoe Order_date 01/07/93 02/07/93 02/07/93 Street Kings St High St Elphin Rd Burke Rd Glen Rd Prod_group Male Shoes Female Shoes Female Shoes General General General General Male Shoes Cust_no 13144 13144 1066 Town Bundoora Clayton Hawthorn Kew Kew List_ price 150 250 300 450 100 10 50 500 Post_code 3083 3800 3122 3101 3101 Cr_limit 500 3000 500 500 1000 Curr_bal 450 1000 500 0 300 Remake_qt y 5 3 15 2 20 200 20 40 Order_qty 10 2 5 10 * Order_price 45 480 45 10 *

Qty_on_ Remake_l hand evel 6 3 1 1 10 5 1 2 20 15 100 150 50 35 10 15 ORDER_DETAILS Prod_cod Order_no 0001 ST1 0001 GA2 0002 ST1 0003 GN9

a. Show the result of this the following relational algebra query prod_cod,description,list_price,order_datecr_limit-curr_bal>=500(CUSTOMERS ORDERS*ORDER_DETAILS)
b. Find out the optimal algebra expression for (a) Write SQL statement

PRODUCTS

c. corresponding to the above the algebra query (a)

d. list the details of customers who do not have any orders. e. display the details of customer who has the maximum available credit (available credit is the cr_limit minus the curr_bal). f. list of order no. and the total value of that order. The list contains only those orders worth more than $1000
g. list details of customer and the total order value between 01/01/1993 n 4/12/1993 in descending order of total value h. list the details of product and the total value of product sold by day 2. The Victorian Basketball Conference is an amateur basketball association. Each city in the state has one team that represents it. Teams are identified by their id and name. Each team has a maximum of twelve players and a minimum of nine players. Players are identified by a unique player id, and their name, address and contact phone number needs to be recorded. Each team also has up to two coaches (offensive and defensive). Coaches also have unique ids, and their name, address, and contact phone number are required. Each team plays two games (home and visitor) against each of the other teams during the season. Information needs to be kept regarding the venue of the game and the final score. As a special treat at the end of the season the association holds a break-up party for the players. At the break-up party treats are given out to all the players children who are under The association therefore requires each childs name and date of birth. Note: A city will only be in this database if it has a team Coach and player may not yet be assigned to a team (a player could be in the draft for instance )

Exam 2 (2)
1. Nike Shoe Supplier Database: CUSTOMERS (cust_no, cust_name, street, town, post_code, cr_limit, curr_bal) PRODUCTS (prod_cod, description, prod_group, list_price, qty_on_hand, remake_level, remake_qty) ORDERS (order_no, order_date, cust_no) ORDER_DETAILS (order_no, prod_cod, order_qty, order_price) Some attributes, such as cust_name, are self-explanatory; however, others need some definition: cr_limit: The maximum that a customer is allowed to owe curr_bal: The amount currently owed by the customer list_price: The advertised price for a single unit of a particular product remake_level: The level to which the quantity on hand is compared; if qty_on_hand falls below this level, then the Nikke shoe supplier company will usually make another batch (to the manufacturer) to avoid stockout. remake_qty: The quantity usually made in any new batch. order_price: The unit price charged on this order for this product order_date: The date on which the order was taken.
CUSTOMERS Cust_no Cust_name 1066 Bundy Shoe 13144 Target 1776 Harry Store 2001 Kmart 2002 Qshoe PRODUCTS Prod_cod Description MO9 LO9 ST1 LT1 LT9 GN9 ST1 GA2 ORDERS Order_no 0001 0002 0003 Male Runner Lady Runner Girls Runner Tennis Shoe Tennis Shoe Beach Sandal Slipper Soccer Shoe Order_date 01/07/93 02/07/93 02/07/93 Street Kings St High St Elphin Rd Burke Rd Glen Rd Prod_group Male Shoes Female Shoes Female Shoes General General General General Male Shoes Cust_no 13144 13144 1066 Town Bundoora Clayton Hawthorn Kew Kew List_ price 150 250 300 450 100 10 50 500 Post_code 3083 3800 3122 3101 3101 Cr_limit 500 3000 500 500 1000 Curr_bal 450 1000 500 0 300 Remake_qt y 5 3 15 2 20 200 20 40 Order_qty 10 2 5 10 Order_price 45 480 45 10

Qty_on_ Remake_l hand evel 6 3 1 1 10 5 1 2 20 15 100 150 50 35 10 15 ORDER_DETAILS Prod_cod Order_no 0001 ST1 0001 GA2 0002 ST1 0003 GN9

a. Show the result of this the following relational algebra query prod_cod,description,list_price,order_datecr_limit-curr_bal>=500(CUSTOMERS * PRODUCTS * ORDERS*ORDER_DETAILS)
b. Find out the optimal algebra expression for (a) Write SQL statement

c. corresponding to the above the algebra query (a)

d. list the details of products that is not in any orders. e. display the details of best selling products (max quantity or max total value), their quantity and total value f. list of order no. and the total value of that order between 01/01/1993 n 4/12/1993 in
descending order of total value g. list details of customer and the number of their order by month h. list the details of product and the total value of product sold by day

2. You are required to derive a set of normalized relations for the following user views of La Trobe Hospitals Statement of account, Room utilization report, and Physician Report. Make sure all relations are in 3NF (Third Normal Form).
La Trobe Hospital 1 Plenty Road, Bundoora 3083 Statement of account for: Patient Name: Baker, Mary Patient Address: 30 High St Suburb-Post Code: Kew 3105 Item Code 200 205 307 413 Patient No: 3456 Date Admitted: 26/01/2006 Date Discharged: 27/01/2006 Description Room Television X-Ray Lab Tests

Charge 150.00 10.00 25.00 35.00

Balance Due 220.00 Note: Only one date admitted and one date discharged need to be stored for each patient (you are not required to store the history of the patient). Room Utilization Report Date: 30/01/2006 Location Type of Patient No Patient Name Discharge Date Accommodation 100-1 Private 3456 Baker, Mary 27/01/2006 100-2 Private 100-3 Semi-Private 100-4 Semi-Private 1345 Rose, David 03/02/2006 100-5 Private 2345 Miller, Ruth 06/02/2006 Note: A patient can only stay in one particular room, however a room may contain more than one patient. La Trobe Hospital Physician Report Date: 30/01/2006 Physician ID: Wilcox Physician Phone: 1212 Patient Patient Name Procedure Location Procedure Procedure Date and Time 3456 Baker, Mary 190-1 Tonsillectomy 26/01/2006 09:00 1345 Rose, David 232-2 Observation 26/01/2006 11:00 2345 Miller, Ruth 237-2 Observation 27/01/2006 15:00 2345 Miller, Ruth 237-2 X-Ray 28/01/2006 09:00 2345 Miller, Ruth 235-2 Chemotherapy 29/01/2006 16:00

Вам также может понравиться