Assignments - Lab
Assignments - Lab
Lab Assignment -1
Create following tables using DDL commands:
i) Table name : client_master
columnname datatype size
client_no Varchar 6
name Varchar 20
address1 Varchar 30
address2 Varchar 30
city Varchar 15
state Varchar 15
pincode Int 6
bal_due Float 10,2
ii) Product_master
Columnname Datatype Size
Product_no Varchar 6
Description Varchar 20
Profit_percent Int 6
Unit_measure Varchar 10
Qty_on_hand Int 6
Reorder_lvl Int 6
Sell_price Float 7,2
Cost_price Float 7,2
DEPARTMENT OF COMPUTER SCIENCE
Lab Assignment – 2
Insert the following data into the tables using DML commands
Lab Assignment – 3
Lab Assignment – 4
ii. Sales_order
Columnname Datatype Size Attributes
S_order_no varchar2 6 Primary/first letter must be 0
S_order_date Date 6 Primary key reference client
no of client_master table
Client_no Varchar2 25
Dely_add Varchar2 6
Salesman_no Varchar2 6 Foreign key references
salesman_no of
salesman_master table
Dely_type Char 1 Delivery part(p)/full(f), default f
Billed_yn Char 1
Dely_date Date Can not be less
than s_order_date
Order_status Varchar2 10 Values (‘inprocess’;
’fulfilled’; backorder’;
’canceled’
DEPARTMENT OF COMPUTER SCIENCE
iii. Sales_order_details
1. Insert the following data into their respective tables using insert statement:
Data for sales_man master table
Salesm Sales Address City Pi State Salamt Tgt_to_ Ytd Remark
an_ no man nc get Sales
name od
500001 Kiran A/14 worli Bombay 400002 Mah 3000 100 50 Good
500002 Manish 65,nariman Bombay 400001 Mah 3000 200 100 Good
500003 Ravi P-7 Bandra Bombay 400032 Mah 3000 200 100 Good
500004 Ashish A/5 Juhu Bombay 400044 Mah 3500 200 150 Good
Lab Assignment – 5
Sname Result
Sname Marks
Raj First
Raj 65
Amit Fail
Amit 32
Sanjay Second
Sanjay 45
Rohit Third
Rohit 40
Anil Third
Anil 35
DEPARTMENT OF COMPUTER SCIENCE
Lab Assignment -6
E1 001Rajku E1 Rajkumar
mar E2 Ramkumar
E2 Ramkumar E4 Ravikumar
002 3. Solve the
following queries:
E4 Ravikumar
003
Lab Assignment – 7
Lab Assignment – 8
1. Create Table ITEM with attributes (ItemNo., ItemName,Qty, UnitPrice, Pdate) and
populate with suitable data and Write queries for
i. List minimum UnitPrice. From item table
ii. List maximum UnitPrice. From item table
iii. List the total number of items in the item table.
2. Create table Bill with attributes (BillNo, Billdate, amount) and populate the table with
suitable data and Write SQL query to
i. List out the number of unique dates on which bill has been generated.
ii. List out the unique dates on which bill has been generated.
DEPARTMENT OF COMPUTER SCIENCE
Lab Assignment – 9
1. Write a query to find out the second highest salary of the employee from employee
table.
2. Write a query to find out the nth highest salary of the employee from employee table.
3. Write a query to delete duplicate rows from employee table.
4. Create a table using the existing table.
5. Write a query to find out the second lowest salary of the employee from employee
table.
6. Write a query to find out the nth lowest salary of the employee from employee table.
Lab Assignment – 10
Lab Assignment - 11