You are on page 1of 3

Semester 11734

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.

1. Create PREMIER PRODUCTS(Your FullName) database.

2. Create the following tables and use the appropriate data type for each field. Also, select the
appropriate primary key for each table.

3. Enter the following data.

TABLE: CUSTOMER

TABLE: CUSTOMER_REP

TABLE: ORDER_LINE
Semester 11734

TABLE: ORDERS

TABLE: PARTS

TABLE: REP

4. Create the following queries:

i) List the number, name and balance of all customers.


ii) List the complete PART table.
iii) List the name of every customer with a $10,000 credit limit.
iv) Find the name of customer 148.
v) Find the customer name for every customer located in the city of Grove.
vi) List the number, name, credit limit and balance for all customers with credit limits that
exceed their balance.
vii) List the descriptions of all parts that that are located in warehouse 3 and for which there are
more than 20 units on hand.
viii) List the descriptions of all parts that that are located in warehouse 3 or for which there are
more than 20 units on hand or both.
ix) List the descriptions of all parts that are not in warehouse 3.
Semester 11734

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

You might also like