IAS 2143 Lab Assignment SQL
IAS 2143 Lab Assignment SQL
Submit:
1. SQL codes
IAS 2143: Database System 2. output
Lab Assignment (SQL) before/ on Monday, 17th April 2017 before 5 p.m.
Instruction: Create the followings by using SQL codes. Show the SQL codes and the output for each of
the followings.
2. Create the following tables and use the appropriate data type for each field. Also, select the
appropriate primary key for each table.
TABLE: CUSTOMER
TABLE: CUSTOMER_REP
TABLE: ORDER_LINE
Semester 11734
TABLE: ORDERS
TABLE: PARTS
TABLE: REP
x) List the number, name and balance of all customers with balance greater than or equal to
$1000 and less than or equal to $5000.
xi) List the number, name and available credit for all customers (Hint: create the new attribute
as AvailableCredit).
xii) List the number, name and available credit for all customers with credit limits that exceed
their balances (Hint: create the new attribute as AvailableCredit).
xiii) List the number, name and complete address of every customer located on a street that
contains the letters Oxford.
xiv) List the customer number, name, street and credit limits of all customers. Sort the customer
by name.
xv) List the customer number and name of each customer together with the number, lastname
and firstname of the sales rep who represents the customer. Order the records by customer
number.
xvi) List the customer number and name of each customer whose credit limit is $10,000
together with the number, lastname and firstname of the sales rep who represents the
customer. Order the records by customer number.
xvii) Change the street address of customer 524 to 1445 Rivard.
xviii) Add a new sales rep to the REP table. Her number is 16, her name is Sharon Rands, and her
address is 826 Raymond, Altonville, FL 32543. She has not yet earned any commission, but
her commission rate is 5% (0.05).
xix) Delete any row in the ORDER_LINE table in which the part number is BV06.
xx) What is the customer name with the highest credit limit?
xxi) What is the name of cheapest part?
xxii) How much commission does Valerie own?
xxiii) How many customers in CUSTOMERs table?
End of Questions