0% found this document useful (0 votes)
77 views9 pages

Ass 3 Sol

The document describes creating and populating multiple tables in a database. It creates tables to store client data, product data, salesperson data, sales orders, and sales order details. Values are inserted into each table. The tables are then queried to view the inserted data.

Uploaded by

sruthi kunam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views9 pages

Ass 3 Sol

The document describes creating and populating multiple tables in a database. It creates tables to store client data, product data, salesperson data, sales orders, and sales order details. Values are inserted into each table. The tables are then queried to view the inserted data.

Uploaded by

sruthi kunam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

practical 1

Practical No :1
 
Aim : Exercise on Data creation (Creation of table, Inserting values into the
tables and display the content of the table)
 
CREATE TABLE Client_master (
Clientno varchar2(6) primary key,
Name varchar2(25) not null,
Address1 varchar2(20),
Address2 varchar2(20),
City varchar2(15),
Pincode number(8),
State varchar2(15),
Bal_due number(10,2));
 
Output
Table created:
 
Inserting values in table Client_master:
 
Insert into Client_master values (‘C001’,’Ivan Bayross’,’R-274’,‘Bandra’,‘Bombay’,400054,‘Maharashtra’,
15000);
Insert into Client_master values (‘C002’,‘Vandana  Saitwal’,‘Rp-67’,‘Pali hill’,‘Madras’,780001, ‘Tamil
Nadu’,0)
Insert into Client_master values (‘C003’,‘Pramada Jaguste’, ‘M-09’, ‘Warli’, ‘Bombay’, 400057, ‘Maharashtra’,
5000);
Insert into Client_master values (‘C004’,‘Basu Navindgi’, ‘789’, ‘Juhu’, ‘Bombay’, 400056, ‘Maharashtra’,0);
Insert into Client_master values ( ‘C005’,‘Ravi Sreedharam’,‘Z-549’, ‘C.P.’, ‘Delhi’, 110001, ‘Delhi’,2000);
Insert into Client_master values ( ‘C006’,‘Rukmini’,‘Rz-521’, ‘Khandala’, ‘Bombay’, 400050,
‘Maharashtra’,0);
 
Output
Rows created:
 
To view the Data in the table
Select * from Client_master;
 
Output
Table: Client_master
Client_n Name Address1 Address2 City Pincode State Bal_due
o
C001 Ivan Bay Ross R-274 Bandra Bombay 400054 Maharashtra 15000
C002 Vandana  Saitwal Rp-67 Pali hill Madras 780001 Tamil Nadu 0
C003 Pramada Jaguste M-09 Warli Bombay 400057 Maharashtra 5000
C004 Basu Navindgi 789 Juhu Bombay 400056 Maharashtra 0
C005 Ravi Sreedharam Z-549 C.P. Delhi 100001 Delhi 2000
C006 Rukmini Rz-521 Khandala Bombay 400050 Maharashtra 0
 
Create table Product_master(
Product_no varchar2(6) primary key,
Description varchar2(15) nol null,
Profit_percent number(4,2) nol null,
Unit_measure varchar2(10) nol null,
Qty_on_hand number(8) nol null,
Reoder_lvl number(8) nol null,
Sell_price number(8) nol null,
Cost_price number(8) nol null,);
 
Output
Table created:
 
Inserting values in table Product_Master:
 
Insert into Product_master values(‘P00001’,‘1.44 Floppies’,5,‘Piece’,100,20,525500);
Insert into Product_master values(‘P03453’,‘Monitors’,6,‘Piece’,10,3,1200011200);
Insert into Product_master values(‘P06734’,‘Mouse’,5,‘Piece’,20,5,1050,500);
Insert into Product_master values(‘P07865’,‘1.22 Floppies’,5,‘Piece’,100,20,525,500);
Insert into Product_master values(‘P07868’,‘Keyboards’,2,‘Piece’,10,3,3150,3050);
Insert into Product_master values(‘P07885’,‘CD Drive’,2.5,‘Piece’,10,3,5250,5100);
Insert into Product_master values(‘P07965’,‘540 HDD’,4,‘Piece’,10,3,8400,8000);
Insert into Product_master values(‘P07975’,‘1.44 Drive’,5,‘Piece’,10,3,1050,1000);
Insert into Product_master values(‘P08865’,‘1.22 Drive’,5,‘Piece’,2,3,1050,1000);
 
Output
Rows created:
 
To view the Data in the table
Select * from Product_Master;
 
Output
Table: Product_Master
 
Product No Name Profit Unit of Qty on Reorder Sell Price Cost Price
Percent measure hand Level
P00001 1.44 Floppies 5 Piece 100 20 525 500
P03453 Monitors 6 Piece 10 3 12000 11200
P06734 Mouse 5 Piece 20 5 1050 500
P07865 1.22 Floppies 5 Piece 100 20 525 500
P07868 Keyboards 2 Piece 10 3 3150 3050
P07885 CD Drive 2.5 Piece 10 3 5250 5100
P07965 540 HDD 4 Piece 10 3 8400 8000
P07975 1.44 Drive 5 Piece 10 3 1050 1000
P08865 1.22 Drive 5 Piece 2 3 1050 1000
 
Create table Sales_master (
Salesman_no varchar2    (6) Primary key,
Sal_name varchar2 (20) Not null,
Address varchar2   (20) Not null,
City varchar2 (20),
State varchar2 (20),      
Pincode Number     (6),
Sal_amt Number    (8,2) Not null,
Tgt_to_get   Number (6,2) Not null,
Ytd_sales Number (6,2) Not null,
Remarks Varchar2 (30));
 
Output
Table created:
 
Inserting values in table Sales_master
 
Insert into Sales_master values (‘S001’, ‘Kiran’, ‘A/14’, ‘Worli’, ‘Mumbai’, 400002, ‘Maharashtra’, 3000,
100,50,‘Good’);
Insert into Sales_master values (‘S002’,‘Manish’,‘65’,‘Nariman’,‘Mumbai’, 400001,‘Maharashtra’, 3000,
200,100,‘Good’);
Insert into Sales_master values (‘S003’,‘Ravi’,‘P-7’,‘Bandra’,‘Mumbai’,400032,‘Maharashtra’, 3000,
200,100,‘Good’);
Insert into Sales_master values (‘S004’,‘Ashish’,‘A/5’,‘Juhu’,‘Mumbai’,400044,‘Maharashtra’, 3000,
200,150,‘Good’);
 
Output
Rows created:
 
To view the Data in the table
Select * from Sales_ master;
 
Output
Table: Sales_master
 
Salesmann Salesman Address1 Address2 City Pincode State
o name
S001 Kiran A/14 Worli Mumbai 400002 Maharashtra
S002 Manish 65 Nariman Mumbai 400001 Maharashtra
S003 Ravi P-7 Bandra Mumbai 400032 Maharashtra
S004 Ashish A/5 Juhu Mumbai 400044 Maharashtra
 
Salamt Tgt_to_get ytd_sales Remarks  
 
3000 100 50 Good  
3000 200 100 Good  
3000 200 100 Good  
3000 200 150 Good                         

Create table Sales_order (


order_no varchar2(6) Primary key,
order_date Date(6),
Client_no Varchar2(25) Foreign key references clientno of Client_master,
Salesman_no Varchar2(6) Foreign key references salesman_no of Salesman_master,
Dely_type Char,
Billed_yn Char,
Dely_date Date,
Order_status Varchar2(10));
 
Output
Table created:
 
Inserting values in table Sales_order
 
Insert into Sales_order values (‘O19001’,‘12-01-10’,‘C001’,‘F’,‘N’,‘S001’,‘20-01-10’,‘In Process’);
Insert into Sales_order values (‘O19002’,‘25-01-10’,‘C002’,‘P’,‘N’,‘S002’,‘27-01-10’,‘Cancelled’);
Insert into Sales_order values (‘O46865’,‘18-02-10’,‘C003’,‘F’,‘Y’,‘S003’,‘20-02-10’,‘Fulfilled’);
Insert into Sales_order values (‘O19003’,‘03-04-10’,‘C001’,‘F’,‘Y’,‘S001’,‘07-04-10’,‘Fulfilled’);
Insert into Sales_order values (‘O46866’,‘20-05-10’,‘C004’,‘P’,‘N’,‘S002’,‘22-05-10’,‘Cancelled’);
Insert into Sales_order values (‘O19008’,‘24-05-10’,‘C005’,‘F’,‘N’,‘S004’,‘26-05-10’,‘In Process’);
 
Output
Rows created:
 
To view the Data in the table
Select * from Sales_order;
 
Output
Table Sales_order
 
Order no Order Client no Deliverytype Bill yn Salesman no Delivery date Order status
Date
O19001 12-01-10 C001 F N S001 20-01-10 In Process
O19002 25-01-10 C002 P N S002 27-01-10 Cancelled
O46865 18-02-10 C003 F Y S003 20-02-10 Fulfilled
O19003 03-04-10 C001 F Y S001 07-04-10 Fulfilled
O46866 20-05-10 C004 P N S002 22-05-10 Cancelled
O19008 24-05-10 C005 F N S004 26-05-10 In Process
 
 
Create table Sales_order_details (
S_order_no Varchar2(6) foreign key references s_order_no of sales_order,
Product_no Varchar2(6) foreign key references product_no of product_master,
Qty_order Number (8),
Qty_disp Number (8),
Product_rate Number(10,2));
 
Output
Table created:
 
Inserting values in table Sales_order_details
 
Inert into Sales_order_details values (‘O19001’,‘P00001’,4,4,525);
Inert into Sales_order_details values (‘O19001’,‘P07965’,2,1,8400);
Inert into Sales_order_details values (‘O19001’,‘P07885’,2,1,5250);
Inert into Sales_order_details values (‘O19002’,‘P00001’,10,0,525);
Inert into Sales_order_details values (‘O46865’,‘P07868’,3,3,3150);
Inert into Sales_order_details values (‘O46865’,‘P07885’,3,1,5250);
Inert into Sales_order_details values (‘O46865’,‘P00001’,10,10,525);
Inert into Sales_order_details values (‘O46865’,‘P03453’,4,4,1050);
Inert into Sales_order_details values (‘O19003’,‘P03453’,2,2,1050);
Inert into Sales_order_details values (‘O19003’,‘P06734’,1,1,12000);
Inert into Sales_order_details values (‘O46866’,‘P07965’,1,0,8400);
Inert into Sales_order_details values (‘O46866’,‘P07975’,1,0,1050);
Inert into Sales_order_details values (‘O19008’,‘P00001’,10,5,525);
Inert into Sales_order_details values (‘O19008’,‘P07975’,5,3,1050);
 
Output
Rows created:
 
To view the Data in the table
Select * from Sales_order_details;
 
Output

Order no Product no Qty ordered Qty disp Product rate Table:


Sales_order_details
O19001 P00001 4 4 525  
O19001 P07965 2 1 8400
019001 P07885 2 1 5250
019002 P00001 10 0 525
O46865 P07868 3 3 3150
O46865 P07885 3 1 5250
O46865 P00001 10 10 525
O46865 P03453 4 4 1050
019003 P03453 2 2 1050
019003 P06734 1 1 12000
O46866 P07965 1 0 8400
O46866 P07975 1 0 1050
O19008 P00001 10 5 525
O19008 P07975 5 3 1050

Library tables query :


 

CREATE TABLE CSE_book(


Cse_book_code number(10),
Cse_book_title varchar(30),
Cse_book_author varchar(30),
Cse_book_publ varchar(30),
Cse_book_price number(5),
Cse_book_eddi varchar(10));
 
Output
Table created:
 
Inserting values in table CSE_book
 
Insert into CSE_book values(10501,'dbms','navathe','pearson',500,'5');
Insert into CSE_book values(17002,'C++','herbert shield','tata mcgraw hill',250,'4');
Insert into CSE_book values(10083,'photoshop','gene hirsh','tata mcgraw hill',300,'2');
Insert into CSE_book values(10704,'Java','herbert shield','tata mcgraw hill',465,'8');
Insert into CSE_book values(41005,'C','herbert shield','tata mcgraw hill',200,'5');
 
 
Output
Rows created:
 
To view the Data in the table
Select * from CSE_book;
 
Output
Table: CSE_book
 
Cse_book_code Cse_book_title Cse_book_author Cse_book_pub Cse_book_price Cse_book_eddi
l
10501 DBMS Navathe Pearson 500 5
17002 C++ Herbert shield Tata mcgraw 250 4
Hill
10083 Photoshop Gene hirsh Tata mcgraw 300 2
Hill
10704 Java Herbert shield Tata mcgraw 465 8
Hill
41005 C Herbert shield Tata mcgraw 200 5
hill
 
 
CREATE TABLE CSE_stud(
Cse_stud_code number(10),
Cse_stud_name varchar(50),
Cse_stud_branch varchar(50),
Cse_stud_sems number(2),
Cse_stud_card_no number(5),
Cse_stud_card_type varchar(50));
Output
Table created:
 
Inserting values in table CSE_stud
 
Insert into CSE_stud values(0751042707,Honey,cse,5,2045,regular);
Insert into CSE_stud values(0731042707,Rohit,cse,5,3102,regular);
Insert into CSE_stud values(0741042707,Prashant,cse,5,2048,regular);
Insert into CSE_stud values(0721042707,Gaurav,cse,5,2078,reference);
Insert into CSE_stud values(0701042707,Jyoti,cse,5,1045,regular);
 
Output
Rows created:
 
To view the Data in the table
Select * from CSE_stud;
 
Output
Table: CSE_stud
 
Cse_stud_code Cse_stud_name Cse_stud_branc Cse_stud_sems Cse_stud_no Cse_stud_type
h
0751042707 Honey C.S.E. 5 2045 Regular
0731042707 Rohit C.S.E. 5 3102 Regular
0741042707 Prashant C.S.E. 5 2048 Regular
0721042707 Gaurav C.S.E. 5 2078 Reference
0701042707 Joyti C.S.E. 5 1045 Regular
 
 
CREATE TABLE CSE_issu_retu(
Cse_issu_doi date(10),
Cse_issu_a_dor date(10),
Cse_issu_fine number(10),
Cse_b_code number(10) Foreign key references book_code of CSE_book,
Cse_s_code number(10)Foreign key references stud_code of CSE_stud);
 
Output
Table created:
 
Inserting values in table CSE_issu_retu
 
Insert into CSE_isse_retu values('2-8-09','22-8-09',4,'41005','0701042707');
Insert into CSE_isse_retu values('8-8-09','28-8-09',0,'10083','0751042707');
Insert into CSE_isse_retu values('1-8-09','20-8-09',8,'17002','0731042707');
Insert into CSE_isse_retu values('27-7-09','14-8-09',50,'10501','0741042707');
Insert into CSE_isse_retu values('7-8-09','27-8-09',0,'10704','0721042707');
 
Output
Rows created:
 
 
To view the Data in the table
Select * from CSE_issu_retu;
 
Output
Table: CSE_issu_retu
 
Cse_issu_doi Cse_issu_a_dor Cse_issu_fine Cse_b_code Cse_s_code
2-8-09 22-8-09 4 10501 0751042707
8-8-09 28-8-09 0 17002 0731042707
1-8-09 20-8-09 8 10083 0741042707
27-7-09 14-8-09 50 10704 0721042707
7-8-09 27-8-09 0 41005 0701042707
 

You might also like