DBMS File
DBMS File
for Women
Lab File
Database Management System (BIT 201)
B.Tech, Electronics and Communication Engineering with
Artificial Intelligence (2021-2025)
ENTITIES:
1. Bus
2. Passenger
3. Ticket
4. Reservation
5. Cancellation
ATTRIBUTES:
1. Bus
a. Bus number
b. Coach
c. Number of seats
d. Source
e. Destination
2. Passenger
a. Name
b. Age
c. DOB
d. Passenger code
e. Gender
3. Ticket
a. Ticket number
b. Source
c. Destination
d. Date
e. Departure time
4. Reservation
a. Date
b. Passenger code
c. Number of seats
d. Status
e. Contact number
f. Address
5. Cancellation
a. Passenger code
b. Date
c. Status
d. Number of seats
e. Contact number
f. Address
SCHEMA:
1. BUS: {Bus Number: integer, Coach : string, Number of seats: integer, Source: string, Destination:
string}
2. Passenger : {Name: string, Age: integer, DOB: string, Passenger code: string, Gender: string}
3. Ticket: {Ticket number: integer, Source: string, Destination: string, Date: string, Departure time:
string}
4. Reservation: {Date: integer, Passenger code: string, Number of seats: integer, Status: string,
Contact number: integer, Address: string}
5. Cancellation: {Passenger code: string, Date: string, Status: string, Number of seats: integers,
Contact number: integer, Address: string}
E-R MODEL:
EXPERIMENT – 1 (continued)
B. CONCEPT DESIGN WITH E-R MODEL USING LIBRARY MANAGEMENT SYSTEM
AIM: To relate the entities appropriately. Apply cardinalities for each relationship. Identify
strong and weak entities. Indicate the type of relationship (total/partial). Incorporate
generalization, aggregation, and specialization etc. wherever required.
ENTITIES:
1. Membership
2. Books
3. Staff
4. Borrower
5. Visitor
ATTRIBUTES:
1. Membership
a. Member_ID
b. Name
c. Contact number
d. Address
e. Start_date
f. End_date
g. Staff_discount
h. Student_discount
2. Books
a. Book_ID
b. Name
c. Author
d. Domain
e. Genre
f. Number of copies
3. Staff
a. Employee_ID
b. Name
c. Contact number
d. Address
e. DOB
f. Age
g. Gender
4. Borrower
a. Member_ID
b. Book_ID
c. Borrow_date
d. Return_date
5. Visitor
a. Name
b. Contact number
c. Age
d. Visit_date
e. Visit_duration
SCHEMA:
1. Membership: {Member_ID : string, Name: string, Contact number: integer, Address: string,
Start_date: string, End_date: string, Staff_discount: boolan, Student_discount: boolean}
2. Books: {Book_ID : string, Name: sting, Author: string, Domain: string, Genre: string, Number of
copies: integer}
3. Staff: {Employee_ID: string, Name: string, Contact number: integer, Address: string, DOB: string,
Age: integer, Gender: string}
5. Visitor: {Name: string, Contact number: integer, Age: integer, Visit_date: string, Visit_duration:
string}
E-R MODEL:
e
EXPERIMENT-2
AIM: CREATION OF TABLES
A. Create a table called Employee with the following structure.
(101,'Aman','Manager',2001,60000, 5000);
(102,'Arun','Analyst',2002,450000, 4000);
(103,'Neha','Salesman',2003,30000, 3000);
(104,'Rohit','Salesman',2004,30000, 3000)
(105,'Neha','Clerk',2005,20000, 1000);
values("Dhruv","KashmereGate","Banglore");
ii. Insert values into the sailor table. INSERT INTO sailors ( sid, sname, rating, age ) VALUES (
1, 'Drake', 7, 45.0 );
INSERT INTO sailors ( sid, sname, rating, age ) VALUES ( 2, 'Beyonce', 9, 60.0 );
INSERT INTO sailors ( sid, sname, rating, age ) VALUES ( 3, 'Luv', 8, 58.0 );
INSERT INTO sailors ( sid, sname, rating, age ) VALUES ( 6, 'Dua', 6, 25.0 );
INSERT INTO sailors ( sid, sname, rating, age ) VALUES ( 7, 'Britanny', 5, 56.0 );
INSERT INTO sailors ( sid, sname, rating, age ) VALUES ( 8, 'Lany', 8, 34.0 );
INSERT INTO sailors ( sid, sailorname, rating, age ) VALUES ( 9, ' ', 7, 45.0 );
EXPERIMENT-3
A.
B.
C.
SOLUTION:
A
--Provide roles
--Assigning privileges
Enter value for sal: 5000 Enter value for commission: 50 old 1: insert into employee
values(5,'E','salesman',5678,5000,50)
1 row created.
SQL> rollback;
Rollback complete.
3. Add primary key constraint and not null constraint to the employee table.
SQL> alter table employee modify(empno number primary key, ename varchar2(10) not null);
Table altered.
MANAGER_NO NUMBER
COMMISSION NUMBER
4. Insert null values to the employee table and verify the result.
MANAGER_NO NUMBER
COMMISSION NUMBER
Enter value for sal: null Enter value for commission: 50 old 1: insert into employee
values(105,'mohith','salesman',5678,null,50)
B
--Provide roles
--Assigning privileges
Enter value for deptname: sales Enter value for location: delhi old 1: insert into
values(6,'sales','delhi')
1 row created.
SQL> commit;
Commit complete.
1 accounting hyderabad
2 research chennai
3 sales bangalore
4 operations mumbai
5 accounting chennai
6 sales delhi
6 rows selected.
3. Add constraints like unique and not null to the department table. SQL> alter table
Table altered.
Table altered.
DEPTNO NUMBER
DEPTNAME VARCHAR2(10)
Enter value for deptname: research Enter value for location: hyderabad old 1: insert
values(2,'research','hyderabad')
--Provide roles
--Assigning privileges
Enter value for deptname: sales Enter value for location: delhi old 1: insert into
values(6,'sales','delhi')
1 row created.
SQL> commit;
Commit complete.
1 accounting hyderabad
2 research chennai
3 sales bangalore
4 operations mumbai
5 accounting chennai
6 sales delhi
6 rows selected.
3. Delete any three records in the department table and use rollback.
1 accounting hyderabad
2 research chennai
3 sales bangalore
SQL>ROLLBACK;
SELECT * FROM Department;
GO
1 accounting hyderabad
2 research chennai
3 sales bangalore
4 operations mumbai
5 accounting chennai
6 sales delhi
SQL> /
Enter value for E_id: 102
Enter value for E_name: Shane
Enter value for Age: 29
Enter value for Salary: 8000
old 1: insert into employee values(&E_id,'&E_name', &Age, &Salary)
new 1: insert into employee values(102,'Shane', 29, 8000)
1 row created.
(x) SELECT * FROM employee
ORDER BY Salary ASC;
(xi) SELECT * FROM employee
ORDER BY Salary DESC;