You are on page 1of 14

RDBMS LAB.

–MODULE-1
EXPERIMENT – 1&2&3

DATE OF ISSUE:

DATE OF SUBMISSION: 2 SESSIONS

1. Create a table in the name of TICKET followed by last 3 digits of your roll no. having the
following attributes.

Ticket No Number(5) Fare Number(10,2)


Name Varchar2(25) Category Code Varchar2(5)
Gender Varchar2(6) Category Description Varchar2(25)
Age Number(3) Date of Issue Date
Source Varchar2(25) Date of Travel Date
Destination Varchar2(25) Departure Time Date
Distance Number(5)

2. Insert at least 10 records into it.


3. Solve the followings.
a) Display all the records
b) Display Name, Ticket No, Source and Destination of all passengers.
c) Display only those records that originate in “Madras”.
d) Display all the records whose name starts with “A” and Destination is “Bang lore”.
e) Display Fare, Source, Destination for those Distance greater than 200.
f) Display those records whose Fare range between Rs. 500 to 1000.
g) Display the Names of those passengers whose Date of Journey is “15-Sep-04”.
h) Display the average of total Fare.
i) Display the Name & Ticket No who has paid the highest Fare.
j) Display the total collection of Fare.
k) Display the Date of journey of the person named as “Ashok”.
l) Display the months between date of Travel and Date of Issue.
m) Convert the first letter of Name into capital.
n) Convert the Name to upper case.
o) Update the Fare whose Source=”Madras” and Destination=”Banglore”.
4. Solve the followings.
a) Give the total number of people who have traveled so far group by Category Code.
b) Display only Distinct Category Code from the table order in the descending number.
c) Alter the table to modify the length of the column Distance to 10.
d) Create another table in the name of Ticket2 with the same structure as the previous table and insert the
rows using SELECT clause.
e) Using SELECT clause create a table RouteDetail_1 with columns Source, Destination, Distance and
Fare.
f) Create a table Category Sleeper that will store only the records of the passenger who are traveled in
Sleeper Class.
g) Create another table named RouteDetail_2 whose structure is same as RouteDetail_1.
h) Using INSERT and SELECT clause copy all the data of RouteDetail_1 to RouteDetail_2.
i) Display the Name, Distance, Source and Destination who have fare 2000, 3000, 1500, and 5000.
j) Count the numbers of records present in RouteDetail_2.
RDBMS LAB. MODULE-2
EXPERIMENT – 4&5

DATE OF ISSUE:

DATE OF SUBMISSION:2 LAB SESSIONS

1. Create following tables followed by last 3 digits of your roll no. having the following attributes.

Client_Master: Salesman:
Client No Varchar2(6) Salesman No Varchar2(6)
Name Varchar2(25) Name Varchar2(25)
Address Varchar2(50) Address Varchar2(50)
City Varchar2(30) City Varchar2(30)
Pin Number(8) Pin Number(8)
State Varchar2(15) Salary Number(10,2)
Balance Due Number(10,2) Dept No Number(4)

Emp_Temp:
Emp No Varchar2(6)
Name Varchar2(25)
Job Varchar2(25)
Salary Number(10,2)
Dept Varchar2(20)
Dept No Number(10,2)

2. Insert at least 10 records into it.


3. Write a SQL Statement to extract some of specific fields from the Emp_Temp table i.e., EmpNo, Name,
Job, Salary & Dept.
4. Write a SQL Query to calculate DA with 20% & HRA with 10% from the current Salary & display.
5. Write a SQL Statement by using a order by clause and make different manipulations of Order By clause.
6. Write a SQL Query to extract EmpNo, Name, Job, Dept from Emp_temp table. Those are working as
“CLERK”.
7. Write a SQL Statement which will extract those employees Name who are getting Salary between 10000
to 20000. Other fields are to be extracted like EmpNo, Name, Job, Salary, Dept, DeptNo.
8. Write a SQL Statement to extract all the fields whose Job starts from the letter “ch”.
9. Write a SQL Statement to extract all the fields from emp_Temp table and the employee must be a
“Lecturer” or “Analyst”.
10. Write a SQL Statement to extract a particular employee from emp_temp table. Here the name should be
entered by the user during the time of execution.
11. Write a SQL Statement to display the Name where 1st letter of each record should be in uppercase.
12. List the department name as the four letter codes.
13. Write a SQL Statement to find the length of the Deptt. Name.
14. Which employee earn less than 30% of President Salary.
15. Change the city of the salesman having number=”S001” to “BBSR”.
16. List the clients located in “BBSR”.
17. Change the Balance Due of client no “C005” to 5000.
18. Extract the Name, Salary in the descending order of Salary & Deptno wise.
19. What is the total Annual Salary of a salesman.
20. Add a new column called commission in the client_master
21. Assign a bonous of 10% of salary as commission of all salesmen
22. Delete all the records where state=”ORISSA”
Create the tables described below

Table Name : Product_master (PK – Primary Key ,FK- Foreign Key)


Column Name Data type Size Constraints

Product_no Varchar2 6 PK, 1st letter must start with ‘P’


description Varchar2 15 Not Null
Profit_percent number 4,2 Not Null
Unit_measure Varchar2 10 Not Null
Qty_on_hand number 8 Not Null
Reorder_lvl number 8 Not Null
Sell_price number 8,2 Not null , cannot be 0
Cost_price Number 8,2 Not null , cannot be 0

Table Name : Client_master

Column Name Data type Size Constraints

Client_no Varchar2 6 PK, 1st letter must start with ‘C’


Name Varchar2 20 Not null
City Varchar2 15
State Varchar2 15
Bal_due number 10,2
Table Name : Salesman_master

Column Name Data type Size Constraints

Salesman_no Varchar2 6 PK, 1st letter must start with ‘S’


Salesman_name Varchar2 20 Not null
City Varchar2 15
State Varchar2 15
Sal_amt Number 8,2 Not null , cannot be 0
Tgt_to_get Number 6,2 Not null , cannot be 0
Ytd_sales Number 6,2 Not null

Table Name : sales_order_details


Column Name Data type Size Constraints

Order_no Varchar2 6 PK, FK –REF sales_order(order_no)


Product_no Varchar2 6 PK, FK –REF product_master(product_no)
Qty_ordered Number 8
Qty_disp Number 8
Product_rate Number 10,2
Table Name : Sales_order
Column Name Data type Size Constraints

Order_no Varchar2 6 PK, 1st letter must start with ‘O’


Order_date date
Client_no Varchar2 6 FK, REF client_master(client_no)
Dely_Addr Varchar2 25
Salesman_no Varchar2 6 FK, REF salesman_master(salesman_no)
Dely_type char 1 Default F ,P-part , F - Full
Billed_yn char 1
Dely_date date Cannot be less than order date
Order_status Varchar2 10 ‘In Process’,’Fulfilled’,’Back Order’,’Cancelled’

Table Name : Client_master

CLIENT NO NAME CITY STATE BAL_DUE


C00001 Ivan Bayross Bombay Maharashtra 15000
C00002 Vandana Saitwal Madras Tamil Nadu 0
C00003 Pramada Jaguste Bombay Maharashtra 5000
C00004 Basu Navindgi Bombay Maharashtra 0
C00005 Ravi Sreedharan Delhi Delhi 2000
C00006 rukmini Bombay Maharashtra 0

Product Master :
Product no Description Profit % Uom Qty on Reorder lvl Sell Cost
hand price price
P00001 1.44 Floppies 5 Piece 100 20 535 500
P03453 Monitors 6 Piece 10 3 12000 11280
P06734 Mouse 5 Piece 20 5 1050 1000
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

Salesman_master
Salesman no Name City State Salamt Tgt_toget Ytd sales
S00001 Kiran Bombay Maharastra 3000 100 50
S00002 Manish Bombay Maharastra 3000 200 100
S00003 Ravi Bombay Maharastra 3000 200 100
S00004 Ashish Bombay Maharastra 3500 200 150
Sales_order
Orderno Odate Clientno Dely Bill yn Salesma Dely date Order stat
type n no
O19001 12-jan-05 C00001 F N S00001 20-jan-05 In Process
O19002 25-jan-05 C00002 P N S00002 27-jan-05 Cancelled
O46865 18-feb-05 C00003 F Y S00003 20-feb-05 Fulfilled
O19003 03-dec-04 C00001 F Y S00001 07-dec-04 Fulfilled
O46866 20-dec-04 C00004 P N S00002 22-dec-04 Cancelled
O19008 24-dec-05 C00005 F N S00004 26-dec-04 In Process

Sales order details


Order no Product no Qty ordered Qty disp Product rate
O19001 P00001 4 4 525
O19001 P07965 2 1 8400
O19001 P07885 2 1 5250
O19002 P00001 10 0 525
O46865 P07868 3 3 3150
O46865 P07885 3 1 5250
O46865 P00001 10 10 525
O46865 P03453 4 4 1050
O19003 P03453 2 2 1050
O19003 P06734 1 1 12000
O46866 P07965 0 0 8400
O46866 P07975 0 0 1050
O19008 P00001 5 5 525
O19008 P07975 3 3 1050

Exercises on computations on table data :


i. Find the names of all the clients having ‘a’ as the second letter in their names.
ii. Find out the clients who stay in a city whose second letter is ‘a’
iii. Find the list of all clients who stay in ‘Bombay’ or ‘Delhi’
iv. Print the list of clients whose bal_due is greater than value 10000
v. Print the information from sales_order table for orders placed in the month of January
vi. Display the order information for clinet_no ‘C00001’ and ‘C00002’
vii. Find products whose selling price is greater thatn 2000 and less than or equal to 5000
viii. Find products whose selling price is more than 1500. Calculate a new selling price as, original * .15.
Rename the new column in the above query as new_price
ix. List the names , city and state of clients who are not in the state of ‘Maharashtra’
x. Count the total number of orders.
xi. Calculate the average price of all the products
xii. Determine the maximum and minimum product prices. Rename the output as max_price, min_price
xiii. Count the number of products having price greater than or equal to 1500
xiv. Find all the products whose qty_on_hand is less than reorder level

Exercise on Date Manipulation


i. Display the order number and day on which clients placed their order
ii. Display the month and date when the order must be delivered
iii. Display the order_date in the format ‘DD-MONTH-YY’
iv. Find the date, 15 days after today’s date
v. Find the number of days elapsed between today’s date and the delivery date of the orders placed by
the clients
Exercise on using Having and Group by Clauses :

i. Print the description and total qty sold for each product
ii. Find the value of each product sold
iii. Calculate the average qty sold for each client that has a maximum order valu of 15000
iv. Find the sum total of all the billed orders for the month of January

Exercise on Joins and Correlation :

i. Find the products, which have been sold to ‘Ivan Bayross’


ii. Find out the products and their quantities that will have to be delivered in the current month
iii. Find the names of clients who have purchased ‘CD Drive’
iv. List the product_no and order_no of customer having qty_ordered less than 5 from the
sales_order_details table for the product 1.44 Floppies’
v. Find the products and their quantities for the orders placed by ‘Ivan Bayross’ and ‘Vandana Saitwal’
vi. Find the products and their quantities for the orders placed by client_no ‘C00001’ and ‘C00002;

Exercise on Sub-Queries :

i. Find the product_no and description of products not being sold


ii. Find the customer no, name for the client who has placed order no ‘O19001’
iii. Find the client names who have placed orders before the month of Dec 04
iv. Find out if the product ‘1.44 Drive’ has been ordered byu any client and print the clinet_no ,name to
whom it was sold
v. Find the names of clients who have placed orders worth Rs. 10000 or more

Exercise on construction sentences with data :


i. Print information from product_master, sales_order_detail tables in the following format for all the
records :
{description} worth RS .{total sales for the product } was sold

ii. print information from client_master, product_master,sales_ordrer tables in the following format for all
the records : -
{cust_name} has placed order {order_no} on {order_Date}
RDBMS LAB. MODULE-3
EXPERIMENT – 6&7

DATE OF ISSUE:
DATE OF SUBMISSION: 2 SESSIONS
Create The Following Table , insert the given Data into the corresponding table and solve
the Queries.

TABLE Airport
airport varchar2(4) PRIMARY KEY,
aname varchar2(20),
checkin varchar2(50)

TABLE Route
routeno number(2) PRIMARY KEY ,
rdescription varchar2(40)

TABLE Fares
faretype varchar2(3) PRIMARY KEY ,
fdescription varchar2(25),
conditions varchar2(40)

TABLE Tariff
routeno number(2) not null FOREIGN KEY Route(routeno),
faretype varchar2(3) not null FOREIGN KEY Fares(faretype),
price number(10,2)

TABLE Aircraft
aircrafttype varchar2(3) PRIMARY KEY,
adescription varchar2(40),
noseats number(3)

TABLE Passenger
pid number(2) PRIMARY KEY,
Fname varchar2(20) not null,
Lname varchar2(20) not null,
address varchar2(40),
city varchar2(30),
state varchar2(2),
zipcode number(5),
telno number(10) UNIQUE,

TABLE Flight
flightno varchar2(5) PRIMARY KEY,
fromairport varchar2(4),
toairport varchar2(4),
deptime varchar2(5),
arrtime varchar2(5),
service varchar2(20),
aircrafttype varchar2(3),
routeno number(02) FOREIGN KEY Route(routeno)

TABLE Ticket
ticketno number(6) PRIMARY KEY,
ticketdate date,
pid number(2) FOREIGN KEY Passenger(pid)
TABLE Cancel
routeno number(2) not null FOREIGN KEY Route(routeno),
aircrafttype varchar2(3) not null FOREIGN KEY Aircraft(aircrafttype),
flightno varchar2(5) not null FOREIGN KEY Flight(flightno),
airport varchar2(4) not null FOREIGN KEY Airport(airport)),
fromairport varchar2(4),
toairport varchar2(4),
flightdate date,
deptime varchar2(5),
arrtime varchar2(5),

select * from aircraft;

AIR ADESCRIPTION NOSEATS


--- ---------------------------------------- ----------
ATP Advanced Turbo Prop 48
DC9 McDonnel Douglas Jet 120
737 Boeing 737-300 Jet 300

SQL> select * from airport;

AIRP-ANAME CHECKIN
---- -------------------- --------------------------------------------
AMST-Amsterdam SHall Departures 20 mins before flight
BELF-Belfast Desks 18 and 19, 15 mins before flight
BIRM-Birmingham Check-in desks 20 mins before flight
BRUS-Brussels Sabena check-in desks 30 mins before
EMID-East Midlands Check-in 15 mins before flight
DUBL-Dublin Check-in 20 mins prior to departure
EDIN-Edinburgh Gate 1 at least 10 mins before depart
GLAS-Glasgow Desks 60-64/Gate 8 20 mins before depart
HROW-Heathrow Island A/B Terminal-1 20 mins before fl
LBDR-Leeds/Bradford Check-in 15 mins before flight for
LVPL-Liverpool 15 mins heavy baggages,10 mins hand

SQL> select * from cancel;

ROUTENO AIR FLIGH AIRP FROM TOAI FLIGHTDAT DEPTI ARRTI


---------- --- ----- ---- ---- ---- --------- ----- -----
3 DC9 BD80 AMST HROW BELF 02-OCT-01 0725 0840

SQL> select * from FARES;

FAR FDESCRIPTION CONDITIONS


--- ------------------------- -------------------------------------
BUR Business Return Business use only
SDS Standard Single
SDR Standard Return
EUR Eurobudget Return Available Paris Brussels Amsterdam
KFS Key Fare Single
SBS Standby Single
EXR Excursion Return Same day return
PXR Super Key Return
APR Advanced Purchase Return 60 days advanced booking
SXR Superpex Return 90 days advanced booking

SQL> select * from flight;

FLIGH FROM TOAI DEPTI ARRTI SERVICE AIR ROUTENO


----- ---- ---- ----- ----- -------------------- --- ----------
BD80 HROW BELF 0725 0840 Breakfast 737 3
BD82 HROW BELF 0930 1045 Breakfast 737 3
BD91 BELF HROW 1730 1840 Dinner 737 3
BD95 BELF HROW 2120 2230 Dinner 737 3
BD54 HROW EDIN 1040 1155 Breakfast 737 4
BD51 EDIN HROW 0710 0825 Breakfast 737 4
BD412 HROW LBDR 0850 0945 Breakfast DC9 6
BD414 HROW LBDR 1145 1235 Light Meal DC9 6
BD413 LBDR HROW 1020 1115 Light Meal DC9 6
BD419 LBDR HROW 1845 1940 Dinner DC9 6
BD582 HROW LVPL 0810 0900 Breakfast DC9 7
BD255 EMID PARI 1250 1455 Lunch DC9 13
BD257 EMID PARI 1530 1735 Afternoon Tea DC9 13
BD256 PARI EMID 1530 1540 Afternoon Tea DC9 13
BD258 PARI EMID 1810 1820 Dinner DC9 13
BD772 HROW BIRM 0810 0900 Coffee ATP 14
BD774 HROW BIRM 1045 1130 Coffee ATP 14
BD776 HROW BIRM 1230 1320 Coffee ATP 14
BD778 HROW BIRM 1310 1355 Coffee ATP 14
BD780 HROW BIRM 1530 1625 Coffee ATP 14

SQL> select pid,fname,lname,address from passenger;

PID FNAME LNAME ADDRESS


---------- -------------------- -------------------- --------------------
26 Jane Millar 1 Englewood Cliffs
28 James Ullman 1 Microsoft Way
29 Anne Smithson 16 Bedford St
30 Dave Etheridge 4 Maylands Avenue
34 Eric Simon 8 Cherry Street
10 Dan Hamer 1 St Paul's Churchyard
20 Davide Avison 5 Chancery Lane
21 George Davis 25 Allenby Road
24 Chris Evans 63 Kew Green
91 Tim Pittman The Little House

SQL> select city,state,zipcode,telno from passenger;

CITY ST ZIPCODE TELNO


------------------------------ -- ---------- ----------
NewYork NY 14278 613438881
Buffalo NY 18034 7165428956
Buffalo NY 18034 715778900
Horseheads NY 14845 6077394202
Elmira NY 14845 6077960770
Athens PA 11235 5078820469
Clark Summitt CA 14845 8077398877

SQL> select * from route;

ROUTENO RDESCRIPTION
---------- -------------------------
3 Heathrow-Belfast
4 Heathrow-Edinburgh
6 Heathrow-Leeds/Bradford
7 Heathrow-Liverpool
8 Heathrow-Teeside
9 Birmingham-Brussels
11 East Midlands-Belfast
13 East Midlands-Paris
14 Heathrow-Birmingham
15 Heathrow-East Midlands
SQL> select * from tariff; SQL> select * from ticket;

ROUTENO FAR PRICE TICKETNO TICKETDAT PID


---------- --- ---------- ---------- --------- ----------
3 BUR 117 100001 01-AUG-01 26
3 SDR 158 100002 25-SEP-01 28
3 SDS 79 100010 09-AUG-01 29
4 SDR 162 100011 11-AUG-01 24
4 SBS 49 100012 01-JUN-01 21
6 BUR 117 100020 15-AUG-01 30
6 SBS 42 100021 28-SEP-01 34
6 KFS 53 100022 05-SEP-01 20
7 SDR 128 100030 30-AUG-01 94
8 SDS 74 100041 01-AUG-01 91
9 PXR 153 100051 01-JUL-01 92
9 EUR 181 100052 01-JUL-01 93
9 APR 95 100100 15-JUL-01 94
11 KFS 59
13 EXR 121
14 SDR 110
15 SBS 33

SOLVE THE FOLLOWING QUERIES BASED ON THE ABOVE TABLES


1. Display all data from airport,passenger,flight,ticket.
2. Display all data from cancel,route,fares,tariff,aircraft.
3. Display fname, lname, address, city, zipcode, telno from passenger
table.
4. Display flightno from itinerary table.
5. Display distinct flightno from itinerary.
6. Display routeno, faretype, price, 1.175% of price from tariff table.
7. Display routeno, faretype, price, price*1.175 as vat_price from tariff
table.
8. Display average of noseats from aircraft table.
9. Display total available routes from route table.
10. Display unique aircrafttype, noseats from aircraft table.
11. Display noseats from aircraft table where aircrafttype equals to
"dc9".
12. Display adescription, noseats from aircraft table where noseats
greater than 50.
13. Display pid, fname, lname, address, city, zipcode from passenger table
Where pid greater than 25 & less than 35.
14. Display all the records from route table where rdescription is
"%birmingham%".
15. Display fname, lname, telno from passenger table where lname is
"%miller".

16. Display pid, fname, lname, address, city, zipcode from passenger table
Where pid greater than equals to 25 & less than equal to 35 or lname is
like "%smith".
17. Display faretype, price, price*1.175 from tariff table where routeno
is 9 & (price*1.175) greater than 170.
18. Display faretype, price*1.175 as vatprice from tariff table Where
routeno is 9 & (price*1.175) greater than 170 order by vatprice in
descending.
19. Display noseats from aircraft & flight table where flightno is "bd80"
&aircraft's aircrafttype equals to flight's aircrafttype.
20. Display fromairport, flightno, deptime from flight table where
flightno is "bd659" & fromairport equals to fromairport & routeno
equals to routeno & deptime greater than deptime using self join.
21. Display unique flightno, fromairport, deptime, arrtime from flight
table where fromairport equals to "hrow" & toairport equals to
fromairport & toairport equals to "brus" using self join.
22. in the tariff table set the price as price + 25 where routeno=13 and
faretype=’sts’;
23. change the price in tariff as price * 1.1;
24. Delete from passenger where pid is any one of these (91, 92, 93, 94);
25. Delete from aircraft where aircrafttype is 'dc9';
26. Create or replace view brussels_link As select distinct
b.flightno,b.fromairport, B.deptime, b.arrtime From flight a, flight b
Where a.fromairport = 'hrow' And a.toairport = b.fromairport And
b.toairport = 'brus';
27. display fromairport, flightno, deptime, arrtime From brussels_link
Where deptime >= '15:00';
28. Create table ticket2 (ticketno, ticketdate, pid) by selecting rows
from ticket table.
29. Display Total no of seats from aircraft;
30. list aircrafttype From aircraft Where noseats is maximum .
31. Display unique aircrafttype records from flight table.
32. Display the passenger names in the following format where lname ends
with n;
Passenger’s name: is Anne Smithson ;
33. Delete from brussels_link;
RDBMS LAB MODULE-4 (PL/SQL 1)
EXPERIMENT-8
Duration :1 SESSION

1.Write a PL/SQL block to accept 2 nos and find the


addition,substration,multiplication and division of the numbers .
2. Write a PL/SQL block to accept 4 nos and find out the greatest and smallest number.
3. Write a PL/SQL block to accept a number and find whether its even or odd
4. Write a PL/SQL block to generate even numbers upto Nth number
5. Write a PL/SQL block to generate Fibonacci numbers upto N steps.
6. Write a PL/SQL block to generate Prime numbers upto nth Numbers.
7. Using PL/SQL update the commission field of employee table with 500 and display a
message.
8. Write a PL/SQL block to reverse a number.
9. Write a PL/SQL block to raise salary of employee by 5% after updating the sal of
employees and display all the records.
10.Write a PL/SQL program accept the employee no from emp table and check if empno
exists or not . Display the data for the employee or print a suitable message
11.Write a PL/SQL Block to print 1 to 10 Horizontally using a for loop .
RDBMS LAB MODULE-4 (PL/SQL 2)
EXPERIMENT-9

(SUBPROGRAMS)

Write PL/SQL code to implement the following procedures & Functions

PROCEDURES :

SUMM(no1,no2) :- will display the addition of 2 numbers.


Del_client(clientno) :- will delete the client from the client_master table
Reversestr(varchar2) :- will reverse the specified string and display it.

FUNCTIONS :

Fact(no) : will return the factorial of the number.


SQR(no) :- will return the square of that number.
Powr(Base,power) :- return the base to the power power
Substr(str,L/R,N) :- return n number of characters from left or right
from str.
Concat3(str1,str2,str3) :- will concatenate 3 strings and return the result.
Change_case(str,u/l) :- will change the case of str to upper or lower
depending on the choice.

RDBMS LAB MODULE-5 (PL/SQL 3)


EXPERIMENT-10&11

Duration :2 SESSIONS
Q1. Create the following tables.
Table: Bank_master
Accno Number(5) primary key
Name Varchar2(15) Not Null
Open_Bal Number(5) >=500
Close_bal Number(5) >=500
Dt_opened Date default sysdate + not null
Table : Bank_Withdrawal
Accno Number(5) foreign key
With_amt number(5) not null
With_date default sysdate + not null
Table : Bank_deposit
Accno Number(5) foreign key
Depo_amt number(5) not null
Depo_date default sysdate + not null

Solve the following Questions using PL/SQL

Q2. a) Write a PL/SQL block to add an A/C holder to the Bank_master table

b) Write a PL/SQL block to accept a deposit amount from user and update the
bank_master table and the transaction should be added to the bank_deposit table.

c) Write a PL/SQL block to accept a withdraw amount from user and update the
bank_master table and the transaction should be added to the
bank_withdrawal table.

Q3 . Write PL/SQL block to accept an account number and print a ministatement of last 6
records (transactions) 3 from deposit and 3 from withdrawal table. (Use Cursors )

Q4 . Write appropriate procedures to implement Question no -4.

Q5. Create a package called Bank and incorporate all the operations as procedures/functions
in it .

Q6 . Write triggers to update the Bank_master table when ever any deposit/withdraw
transaction will held.

Q7 .Repeat Question No :4 and take care to handle all types of exceptions that can occur .
(Error Handling) .

You might also like