0% found this document useful (0 votes)
146 views15 pages

Rdbms 1 7 Practical Solution

The document describes creating tables for customers, movies, and invoices in an Oracle database. It includes the code to create each table with the appropriate columns and data types. It also provides sample insert statements to add initial data to each table.

Uploaded by

adityahada00
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)
146 views15 pages

Rdbms 1 7 Practical Solution

The document describes creating tables for customers, movies, and invoices in an Oracle database. It includes the code to create each table with the appropriate columns and data types. It also provides sample insert statements to add initial data to each table.

Uploaded by

adityahada00
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/ 15

1-Create a table for Customer.

Column Name Format


cust_id char(5)
Lname char(15)
Fname char(15)
Area char(2)
phone_no number(8)
SOLUTION:
create table Customer (
cust_id char(5),
Lname char(15),
Fname char(15),
Area char(2),
phone_no number(8));

Describe Customer;

2-Create a table for Movie


Column Name Format
mv_no number (5)
Title char(25)
Type char(10)
Star char(25)
Price number(8,2)
SOLUTION:
create table Movie (
mv_no number (5),
Title char(25),
Type char(10),
Star char(25),
Price number(8,2));

3- Create a table for invoice


Column Name Format
inv_no char(3)
mv_no number(5)
cust_id char(5)
issue_date date
return_date date

SOLUTION:
create table invoice
(
inv_no char(3),
mv_no number(5),
cust_id char(5),
issue_date date,
return_date date
);

Describe invoice;
SOLUTION:
1->
Insert into Customer( cust_id,
Lname ,Fname,Area ,phone_no) values
('a01','Patel','Vijay','sa',381334);

Output:
2-> Insert into Customer( cust_id,
Lname ,Fname,Area ,phone_no) values ('a02', 'Saitwal',
'Vandana', 'mu', 556037);

3-> Insert into Customer( cust_id,


Lname ,Fname,Area ,phone_no) values ('a03', 'Jaguste',
'Pramada', 'da', 372631);
4-> Insert into Customer( cust_id,
Lname ,Fname,Area ,phone_no) values ('a04',
'Navindgi', 'Basu', 'ba', 666612);
5-> Insert into Customer( cust_id,
Lname ,Fname,Area ) values ('a05', 'Sreedhran', 'Ravi',
'va');

6-> Insert into Customer( cust_id,


Lname ,Fname,Area ,phone_no) values ('a06', ' ',
'Rukmini', 'ga',512527);
SOLUTION:
1-> Insert into Movie (mv_no,Title,Type,Star,Price)
values (1,'Bloody Vengeance',' action','Jackie Chan',
180.95);
2-> Insert into Movie (mv_no,Title,Type,Star,Price)
values (2,'The firm',' thriller','Tom Cruise', 200.00);
3-> Insert into Movie (mv_no,Title,Type,Star,Price)
values (3,'Pretty woman',' romantic','Richarge Gere',
150.00);
4-> Insert into Movie (mv_no,Title,Type,Star,Price)
values (4,'Home alone',' comedy','Macaulay Culkin',
150.55);
5-> Insert into Movie (mv_no,Title,Type,Star,Price)
values (5,'The fugitive',' thriller','Harrison Ford',
200.00);
6-> Insert into Movie (mv_no,Title,Type,Star,Price)
values (6,'Coma',' suspence','Michael Douglas', 100.00);
7-> Insert into Movie (mv_no,Title,Type,Star,Price)
values (7,'Dracula',' horror','Gray Oldman', 150.00);
8-> Insert into Movie (mv_no,Title,Type,Star,Price)
values (8,'Quick change',' comedy','Bill Murray',
100.00);
9-> Insert into Movie (mv_no,Title,Type,Star,Price)
values (9,'Gone with the wind',' drama','Clarke Gable',
200.00);
10-> Insert into Movie (mv_no,Title,Type,Star,Price)
values (10,'Carry on doctor',' comedy','Leslie Phillips',
100.00);
->select * from Movie;
create table invoice
(
inv_no char(3),
mv_no number(5),
cust_id char(5),
issue_date date,
return_date date
);
describe invoice;

SOLUTION:

1-> Insert into invoice (inv_no, mv_no, cust_id,


issue_date, return_date) values ('i01',4,'a01',
TO_DATE('13-jan-1996',
'DD/MM/YYYY'),TO_DATE('25-jan-1996',
'DD/MM/YYYY'));

2-> Insert into invoice (inv_no, mv_no, cust_id,


issue_date, return_date) values ('i02',3,'a02',
TO_DATE('12-feb-1996',
'DD/MM/YYYY'),TO_DATE('15-feb-1996',
'DD/MM/YYYY'));
3-> Insert into invoice (inv_no, mv_no, cust_id,
issue_date, return_date) values ('i03',1,'a02',
TO_DATE('15-feb-1996',
'DD/MM/YYYY'),TO_DATE('18-feb-1996',
'DD/MM/YYYY'));
4-> Insert into invoice (inv_no, mv_no, cust_id,
issue_date, return_date) values ('i04',6,'a03',
TO_DATE('10-mar-1996',
'DD/MM/YYYY'),TO_DATE('13-mar-1996',
'DD/MM/YYYY'));
5-> Insert into invoice (inv_no, mv_no, cust_id,
issue_date, return_date) values
('i05',7,'a04',TO_DATE('5-feb-1996',
'DD/MM/YYYY') ,TO_DATE('8-feb-1996',
'DD/MM/YYYY'));
6-> Insert into invoice (inv_no, mv_no, cust_id,
issue_date, return_date) values
('i06',2,'a06',TO_DATE('18-mar-1996',
'DD/MM/YYYY') ,TO_DATE('21-mar-1996',
'DD/MM/YYYY'));
7-> Insert into invoice (inv_no, mv_no, cust_id,
issue_date, return_date) values ('i07',9,'a05',
TO_DATE('07-jan-1996',
'DD/MM/YYYY'),TO_DATE('10-jan-1996',
'DD/MM/YYYY'));
8-> Insert into invoice (inv_no, mv_no, cust_id,
issue_date, return_date) values ('i08',9,'a01',
TO_DATE('11-feb-1996', 'DD/MM/YYYY'),
TO_DATE('14-feb-1996', 'DD/MM/YYYY'));
9->Insert into invoice (inv_no, mv_no, cust_id,
issue_date, return_date) values
('i09',1,'a05',TO_DATE('15-feb-1996',
'DD/MM/YYYY') ,TO_DATE('28-feb-1996',
'DD/MM/YYYY'));
SOLUTION:
CREATE table Client_Master(CLIENTNO
varchar2(6),NAME varchar2(20),ADDRESS
varchar2(50),CITY varchar2(20),PINCODE
number(8),STATE varchar2(20),BAL_DUE
number(10,2));
SOLUTION:
1-> insert into
Client_Master(CLIENTNO,NAME,ADDRESS,CIT
Y,PINCODE,STATE,BAL_DUE) values
('C0001','Rohan Joshi','Khapaitya
Chakla','Surat',395003,'Gujarat',15000);

2-> insert into


Client_Master(CLIENTNO,NAME,ADDRESS,CIT
Y,PINCODE,STATE,BAL_DUE) values
('C0002','Mamta Mazumdar','Salt
Lake','Kolkata',460012,'West Bengal',5000);
3-> insert into
Client_Master(CLIENTNO,NAME,ADDRESS,CIT
Y,PINCODE,STATE,BAL_DUE) values
('C0003','Chhaya
Bankar','Worli','Mumbai',400054,'Maharashtra',20
00);
4-> insert into
Client_Master(CLIENTNO,NAME,ADDRESS,CIT
Y,PINCODE,STATE,BAL_DUE) values
('C0004','Ashwini Rathod','Ghangaur
Ghat','Udaipur',780011,'Rajasthan',7000);
5-> insert into
Client_Master(CLIENTNO,NAME,ADDRESS,CIT
Y,PINCODE,STATE,BAL_DUE) values
('C0005','Ivan
Bayross','Indiranagar','Bangalore',560050,'Karnata
ka',1500);
6-> insert into
Client_Master(CLIENTNO,NAME,ADDRESS,CIT
Y,PINCODE,STATE,BAL_DUE) values
('C0006','Deepak
Sharma','Bandra','Mumbai',400002,'Maharashtra',
4300);
7-> insert into
Client_Master(CLIENTNO,NAME,ADDRESS,CIT
Y,PINCODE,STATE,BAL_DUE) values
('C0007','Shymali
Bhide','Juhu','Mumbai',470912,'Maharashtra',2100)
;
Queries solution:
1-> SELECT * FROM CLIENT_MASTER ORDER BY
BAL_DUE DESC;
2-> select * from Client_Master where city='Mumbai';
3-> select state from Client_Master;
-> select distinct state from Client_Master;
4-> update Client_Master set city='Mangalore' where
CLIENTNO ='C0005';

5-> update Client_Master set BAL_DUE =1000 where


CLIENTNO ='C0001';

6-> delete from client_master where


STATE='Rajasthan';
7-> ALTER TABLE Client_Master ADD(Mobile
number(10));

8-> create table Balance_Details(ClientNo, Name,


Bal_Due) AS SELECT CLIENTNO,NAME,BAL_DUE from
Client_Master;
->describe Balance_Details;

9-> RENAME Client_Master TO Customer_new;


-> select * from Customer_new;

You might also like