You are on page 1of 8

Graphic Era University

Dept. of Computer Science & Engg.

Graphic Era University, Dehradun


B.tech CSE & IT 5th Semester

DBMS Lab (PCS 503)


LIST OF PROGRAMS

Assignment No:1 Q. 1 Define the working of SQL commands of Data Definition Language, Data Manipulation language, Data Control Language and Transaction Control Language. Q. 2 Write about the different data types used in SQL. Assignment No: 2 Q.1 Create a table employee having following columns: firstname, lastname, title, age and salary Q.2 Enter the data of eight employee into employee table. Q.3 On the basis of employee table answer the following questions: i) Select all columns for everyone in your emp table. ii) Select first and last names for everybody thats under 30 year old. iii) Select all columns for everyone with a salary over 30000. iv) Select firstname, lastname and salary for anyone with Programmer in their title. v) Select the firstname for everyone whose lastname contains a. vi) select all columns for everyone whose firstname starts with D. Assignment No: 3 Q1. Create the following tables: i) client_master columnname client_no name city state pincode bal_due ii) Product_master Columnname Product_no Description datatype varchar2 varchar2 size 10 10 Page | 6 datatype varchar2 varchar2 varchar2 varchar2 number6 number10,2 size 6 20 15 15

Graphic Era University Profit_percent Unit_measure Qty_on_hand Reoder_lvl Sell_price Cost_price number10 varchar2 number5 number5 number6, 2 number6, 2 5

Dept. of Computer Science & Engg.

Q2- Insert the following data into their respective tables: Data for Clint Master: Clientno 0001 0002 0003 0004 0005 0006 Name city pincode state bal.due

Ivan Bombay 400054 Maharashtra 15000 Vandana Madras 780001Tamilnadu 0 Pramada Bombay 400057Maharashtra 5000 Basu Bombay 400056Maharashtra 0 Ravi Delhi 100001 2000 Amit Bombay 400050Maharashtra 0

Data for Product Master: Product No. Desciption P000011.44floppies P03453Monitors P06734Mouse P078651.22 floppies P07868Keyboards P07885CD Drive P07965540 HDD P079751.44 Drive P088651.22 Drive 5 6 5 6 2 2.5 4 3 5

Profit % Unit Percent piece piece piece piece piece piece piece piece piece

Qty measured 100 10 20 100 10 10 10 10 2 20 3 5 20 3 3 3 3 3

Reorder Sell on hand lvl 525 12000 1050 525 3150 5250 8400 1050 1050 500 11200 500 500 3050 5100 8000 1000 1000

Cost price

price

Page | 7

Graphic Era University

Dept. of Computer Science & Engg.

Q3:- On the basis of above two tables answer the following Questionnaires: i) Find out the names of all the clients. ii) Retrieve the list of names and cities of all the clients. iii) Display the information for client no 0001 and 0002. iv) Find all the products whose sell price is greater then 5000.

Assignment-4
Q.1 i. ii. iii. iv. v. Using the table client master and product master answer the following Questionnaires. Change the selling price of 1.44 floppy drive to Rs.1150.00 Delete the record with client 0001 from the client master table. Change the city of client_no0005 to Bombay. Change the bal_due of client_no 0001, to 1000. Find the products whose selling price is more than 1500 and also find the new selling price as original selling price *15.

Assignments-5
Q.1 Create the following tables: Sales_master Columnname Salesman_no Sal_name Address City State Pincode Sal_amt Tgt_to_get Ytd_sales Remarks Datatype varchar2 varchar2 varchar2 varchar2 20 varchar2 20 Number Number Number Number Varchar2 Size 6 20 30 6 8,2 6,2 6,2 30 Attributes Primary key/first letter must start with s Not null Not null

Not null, cannot be 0 Not null, cannot be 0 Not null, cannot be 0

Page | 8

Graphic Era University

Dept. of Computer Science & Engg.

Sales_order Columnname S_order_no S_order_date Client_no Dely_add Salesman_no Dely_type Billed_yn Dely_date Order_status Datatype varchar2 Date Varchar2 Varchar2 Varchar2 Char Char Date Varchar2 Size 6 6 25 6 6 1 1 10 Attributes Primary key Foreign key reference clientno of client_master table

Foreign key references salesman_no of salesman_master table Delivery part(p)/full(f),default f Can not be lessthan s_order_date Values (in process;fulfilled;back order;canceled Size 6 Attributes Primary key/foreign key references s_order_no of sales_order Primary key/foreign key references product_no of product_master

Sales_order_details Column S_order_no

Datatype Varchar2

Product_no

Varchar2

Qty_order Qty_disp Product_rate

Number Number Number

8 8 10,2

Insert the following data into their respective tables using insert statement: Data for sales_man master table Page | 9

Graphic Era University Salesman Salesma _no n name 500001 Kiran 500002 500003 500004 Manish Ravi Ashish Address City

Dept. of Computer Science & Engg. Pin code State 400002 400001 400032 400044 Mah Mah Mah Mah Salamt 3000 3000 3000 3500 Tgt_to_ Ytd get Sales 100 50 200 200 200 100 100 150 Remark Good Good Good Good

A/14 worli Bom bay 65,narima Bom n bay P-7 Bom Bandra bay A/5 Juhu Bom bay Client no 0001 0002 0003 0001 0004 0005

Data for salesorder table: S_orderno S_orderdate 019001 019002 016865 019003 046866 010008 12-jan-96 25-jan-96 18-feb-96 03-apr-96 20-may-96 24-may-96

Dely type F P F F P F

Bill yn N N Y Y N N

Salesman no 50001 50002 500003 500001 500002 500004

Delay date 20-jan96 27-jan96 20-feb96 07-apr96 22may-96 26may-96

Orderstatus Ip C F F C Ip

Data for sales_order_details table: S_order no 019001 019001 019001 019002 046865 046865 019003 019003 046866 046866 010008 010008 Product no P00001 P07965 P07885 P00001 P07868 P07885 P00001 P03453 P06734 P07965 P07975 P00001 Qty ordered 4 2 2 10 3 10 4 2 1 1 1 10 Qty disp 4 1 1 0 3 10 4 2 1 0 0 5 Product_rate 525 8400 5250 525 3150 5250 1050 1050 12000 8400 1050 525

Page | 10

Graphic Era University

Dept. of Computer Science & Engg.

Assignment 6
Q.1. Create the following tables: Table Name : Challan_Header Column namedata type size Challan_no varchar2 s_order_no varchar2 challan_date billed_yn date char Attributes 6 Primary key 6 Foreign key references s_order_no of sales_order table not null 1 values (Y,N). Default N

Table Name : Challan_Details Column namedata type size Challan_no varchar2 Qty_disp number4,2 Attributes 6 Primary key/Foreign key references Product_no of product_master not null

Q2. Insert the following values into the challan header and challan_details tables: (i) Challan No CH9001 CH865 CH3965 S_order No Challan Date Y Y Y Billed_yn

01900112-DEC-95 04686512-NOV-95 01000812-OCT-95

Data for challan_details table Challan No CH9001 CH9001 CH9001 CH6865 CH6865 CH6865 CH3965 CH3965 Product No P00001 P07965 P07885 P07868 P03453 P00001 P00001 P07975 Qty Disp 4 1 1 3 4 10 5 2

Q.3. Using the table of assignment 4&5 answer the following Questionnaires. i. ii. iii. Select product_no, total qty_ordered for each product. Select product_no, product description and qty ordered for each product. Find the order No, Client No and salesman No. where a client has been received by more Page | 11

Graphic Era University than one salesman.

Dept. of Computer Science & Engg.

Assignment-7
Using the table of assignment 4&5 answer the following Questionnaires. i. ii. iii. iv. v. Select the orders placed by Ravi Select the names of persons who are in Mr. Ravis department and who have also worked on an inventory control system. Select all the clients and the salesman in the city of Bombay. Select salesman name in Bombay who has atleast one client located at Bombay Select the product_no, description, qty_on-hand,cost_price of non_moving items in the product_master table.

Assignment-8
Using the table of assignment 4&5 answer the following Questionnaires. 1. 2. 3. 4. Find out the product which has been sold to Ivan Sayross. Find out the product and their quantities that will have do delivered. Find the product_no and description of moving products. Find out the names of clients who have purchased CD DRIVE

Assignment-9
Using the table of assignment 4&5 answer the following Questionnaires. 1. Find the client names who have placed order before the month of may 95. 2. Find out if product 1.44 Drive is ordered by only client and print the client_no name to whom it was sold. 3. Find the names of client who have placed orders worth Rs.15000 or more. Assignment-10 1. Apply commit operation on the table clint_master and product_master. 2. Apply rollback operation on the table clint_master and product_master.

Page | 12

Graphic Era University

Dept. of Computer Science & Engg.

Page | 13

You might also like