Professional Documents
Culture Documents
NAME
13R21A0
5B5
13R21A0
5B6
Ch.Ravi Kiran
13R21A0
5C1
G.Sai Prasad
13R21A0
5C6
G.S.S.Kireeti
DEPARTMENT/YEAR
II Year
COMPUTER
II Year
COMPUTER
II Year
COMPUTER
II Year
COMPUTER
Er-diagram
Ph.no
Address
MARRIOTT
040-27976816
HYDERABAD
HOTEL VICEROY
040-66595754
BANGLORE
TAJ MAHAL
0891-66432342
MUMBAI
9822882221
DELHI
040-66762361
GOA
SHAN BAGH
RIVERSIDE
NAME
122321
ANUDEEP SINGH
133221
SANDEEP
144331
VIKRAM
155442
RAHUL
166221
GAUTAM
BILL No.
AMOUNT
122321
Rs.550/-
133221
Rs.450/-
MANCHURIA
144331
Rs.250/-
CHOUPSEY
155442
Rs.300/-
166221
Rs.200/-
FINGER CHIPS
NAME
1231
VIJAY RATHOD
1332
ANUP RUBENS
1443
SURYA SETH
1554
AJAY YADAV
1665
SUKESH REDDY
NAME
SAI CHANDRA
P.SAMPATH
CHARAN
MAHESH REDDY
GIRISH GOUD
2234
3321
4321
4431
3211
PHONE No.
ADDRESS
CUSTOMER
ID
111
MAYANK
222
333
444
555
KRISHNA
VENKAT
HASINI
SUJANA
9989899121,9911111
111
7842784212
8989858512
994949122
998288282
CHEF ID No.
AA23
A123
BB22
B123
C112
PARADISE
BANNERGHUTTA
AZAD ROAD
AGRA
BAGA
001
020
050
093
123
QUANTITY
AMOUNT
Rs.550/Rs.450/Rs.250/Rs.300/Rs.200/-
DESCRIPTIO
N
HALF KG
2 & 100gms
250 gms
200 gms
150 gms
BIRYANI
ROTI & CURRY
MANCHURIA
CHOUPSEY
FINGER CHIPS
No.oF
ITEMS
2
3
4
1
2
ORDER No.
25
36
44
49
52
Ph.no
Address
MARRIOTT
040-27976816
HYDERABAD
HOTEL VICEROY
040-66595754
BANGLORE
TAJ MAHAL
0891-66432342
MUMBAI
9822882221
DELHI
040-66762361
GOA
SHAN BAGH
RIVERSIDE
NAME
122321
ANUDEEP SINGH
133221
SANDEEP
144331
VIKRAM
155442
RAHUL
166221
GAUTAM
NAME
1231
VIJAY RATHOD
1332
ANUP RUBENS
1443
SURYA SETH
1554
AJAY YADAV
1665
SUKESH REDDY
In the above table the Manager IdNo. gives Name of the manger that
means manger id acts as candidate key and the remaining non-key
attribute depends on key attribute.Hence the table is in BCNF already.
FUNCTIONAL DEPENDANCY:Manager ID No.-->NAME
BILL No.
122321
133221
144331
155442
166221
AMOUNT
Rs.550/Rs.450/Rs.250/Rs.300/Rs.200/-
In the above table the attribute BillNo. gives both OrderDetail and
Amount.Here BillNo. acts as candidate key,remaining non-key attributes
depends on key attributes.Therefore the tables is already in BCNF.
FUNCTIONAL DEPENDENCY:BillNo.-->Orderdetail,Amount.
PHONE No.
ADDRESS
CUSTOMER
ID
111
MAYANK
222
333
444
555
KRISHNA
VENKAT
HASINI
SUJANA
9989899121,9911111
111
7842784212
8989858512
994949122
998288282
PARADISE
BANNERGHUTTA
AZAD ROAD
AGRA
BAGA
NAME
MAYANK
MAYANK
KRISHNA
VENKAT
HASINI
SUJANA
PHONE No.
9989899121
9911111111
7842784212
8989858512
994949122
998288282
ADDRESS
PARADISE
PARADISE
BANNERGHUTTA
AZAD ROAD
AGRA
BAGA
CHEF ID No.
AA23
A123
BB22
B123
C112
In the above table the Chef IdNo. gives Name of the chef that means chef
idno acts as candidate key and the chef name which is a non-key attribute
depends on key attribute(chef idno.).Hence the table is in BCNF already.
FUNCTIONAL DEPENDANCY:ChefIdNo.-->Name
ID No.
2234
3321
4321
4431
3211
In the above table the Waiter IdNo. gives Name of the Waiter that means
Waiteridno acts as candidate key and the Waiter name which is a non-key
attribute depends on key attribute(Waiter IdNo.).Hence the table is in BCNF
already.
FUNCTIONAL DEPENDANCY:WaiterIdNo.-->Name
TABLE FOR ORDER:ITEM
No.
AMOUNT
001
020
Rs.550/Rs.450/-
050
093
123
Rs.250/Rs.300/Rs.200/-
QUANTITY
HALF KG
2&
100gms
250 gms
200 gms
150 gms
No.
DESCRIPTIO OF
N
ITEMS
BIRYANI
ROTI & CURRY
2
3
MANCHURIA
CHOUPSEY
FINGER CHIPS
4
1
2
ORDER No.
25
36
44
49
52
AMOUNT
QUANTITY
DESCRIPTION
001
Rs.550/-
HALF KG
020
Rs.450/-
2 & 100gms
050
Rs.250/-
250 gms
MANCHURIA
093
Rs.300/-
200 gms
CHOUPSEY
123
Rs.200/-
150 gms
BIRYANI
ROTI & CURRY
FINGER CHIPS
Now the table for item is in BCNF because the attribute ITEMNo. acts as candidate key
and all the remaing non-key attributes are dependent on key attribute.
FUNCTIONAL DEPENDENCY:ITEMNo.-->Amount,Quantity,Description
ORDER DETAIL
BIRYANI
ROTI & CURRY
MANCHURIA
CHOUPSEY
FINGER CHIPS
BILL No.
122321
133221
144331
155442
166221
AMOUNT
Rs.550/Rs.450/Rs.250/Rs.300/Rs.200/-
Objective:
1) Creation of Triggers
2) Implementing Triggers: Create a transparent audit system for a table
restaurant.The system must keep track of the records that are being deleted.The
functionality being when a record is deleted the original record details and the
date of operation are stored in the audit table then delete is allowed to go
through.
Explanation: Here we have created a trigger on restaurant table . our aim is to
keep track of records on restaurant table so that if any delete operation is fired
on restaurant then our restaurant_audit table will be updated with the
information that which record is deleted, who deleted it and on what date it
was deleted.
We have restaurant table:
2)Creation of audit_restaurant:
create table restaurant_audit( R_name varchar2(15),R_phoneno
varchar2(15),R_address varchar2(15),deletedate varchar2(10),
deletedby varchar2(10));
select * from restaurant _audit table;
3)Creation of triggers:
CREATE OR REPLACE TRIGGER
restaurant_before_delete
BEFORE DELETE
ON restaurant
FOR EACH ROW
DECLARE
v_username varchar2(10);
BEGIN
-- Find username of person performing the DELETE on
the table
SELECT user INTO v_username
FROM dual;
-- Insert record into audit table
INSERT INTO restaurant_audit
( R_name,
R_phoneno,
R_address,
deletedate,
deletedby )
VALUES
( :old.R_name,
:old.R_phoneno,
:old.R_address,
sysdate,
v_username );
END;
Output :
4) Execution :
A)SELECT * FROM restaurant;
Specification:
We work on Oracle 10g
HardDisk
Applications:1) This restaurant database management system is useful in retrieving ,
storing and deleting data easily without any problem of redundancy and
inconsistency.
2) The data can be accessed easily.It can store large amount of data
without any confusion and repetition.
3) The concept of database management is not only used in restaurant
management sytem but also in various systems like Hospital
management system,University management system, Library
management system etc.