0% found this document useful (0 votes)
7 views

DBMS Ext Lab Sets

Uploaded by

22p61a6792
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

DBMS Ext Lab Sets

Uploaded by

22p61a6792
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Set 1:

a) Bus: Bus(BusNo: String, Source: String, Destination: String, CoachType: String)

Ticket(TicketNo: string, DOJ: date, Address:string,ContactNo: string,


BusNo:String,SeatNo:Integer,Source: String, Destination: String)
Passenger(PassportID: String, TicketNo:string,Name: String, ContactNo:string,Age:
integer, Sex: character, Address: String)
Reservation(PNRNo: String, DOJ: Date, NoofSeats: integer , Address:
String ,ContactNo: String, , BusNo: String,SeatNo:Integer)
Cancellation(PNRNo: String,DOJ: Date, SeatNo: integer,ContactNo: String,Status:
String)
Write the queries of the following
1.Display unique PNR_no of all passengers.
2. Display all the names of male passengers.
3. Display ticket numbers and names of all the passengers.
4. Find the ticket numbers of passengers whose name starts with ‘A’ and ends with
‘H’.
5. Display the sorted list of passengers names.
Sailors (sid: integer, sname: string, rating: integer, age: real)
Boats (bid: integer, bname: string, color: string)
Reserves (sid: integer, bid: integer, day: date)
b) Querying (using ANY, ALL, IN, Exists, NOT EXISTS, UNION, INTERSECT,
EXCEPT, Constraints etc.)
Find sailors whose rating is better than some sailor called Horatio. (ANY)
Find sailors whose rating is better than some sailor called Horatio. (ALL)
Find the sid’s and names of sailors who have reserved a red or a green boat.
Find the sid’s and names of sailors who have reserved a red and a green boat.
Find the sids of all sailors who have reserved red boats but not green boats.
c) Write PL/SQL programs using procedures.

Set 2:
a) Write SQL statements for:
i. Creating a table student with following information:Name of table: student,
columns and data types: rollno number(6), name varchar(20), branch varchar(20);
ii. Inserting data into the student table
iii. Altering table by adding new column class varchar(20)
iv. Deleting a row from the table
v. Drop column branch
vi. Alter table by changing the data type of rollno to number(8).
vii. Delete all the data from student table.
viii. Delete the table.
Employee(id,name,dob ,gender,sal int,dept ,collegename ,age)
b)Queries using Aggregate functions (COUNT , AVG,MAX,MIN) , GROUP BY,
HAVING and Creation and dropping of Views
Display the Number of employees in each department.
What is the highest salary in each department?
What is the total salary each department is paying?
What is the highest and lowest salary where each dept is paying?
Display the no.of employees in the department having more than 2 employees.
Display the employee details in ascending order based on their salaries.
Display the employee details in descending order based on their salaries.
c) Write PL/SQL programs on Cursor

Set 3: a) Create a table (of your choice) with primary key, write SQL statements
for:
1.Insert rows into the table.
2.Alter table by adding a new column to existing table.
3.Update some values in the table.
4.Delete a row.
5.Change the size of existing column.
b) Create an insert Trigger and update Trigger.
c) Formulate sub queries (Nested,Non-correlated, Correlated) and Joins (Inner, Outer
and Equi)
Find the names of sailors who have reserved a red boat.
Find the names of sailors who have not reserved a red boat.
Non-correlated:
Find the names of sailors who have reserved boat 103.
Correlated: Find the names of sailors who have reserved boat number 103.

Set 1:
a) Bus: Bus(BusNo: String, Source: String, Destination: String, CoachType: String)
Ticket(TicketNo: string, DOJ: date, Address:string,ContactNo: string,
BusNo:String,SeatNo:Integer,Source: String, Destination: String)
Passenger(PassportID: String, TicketNo:string,Name: String, ContactNo:string,Age:
integer, Sex: character, Address: String)
Reservation(PNRNo: String, DOJ: Date, NoofSeats: integer , Address:
String ,ContactNo: String, , BusNo: String,SeatNo:Integer)
Cancellation(PNRNo: String,DOJ: Date, SeatNo: integer,ContactNo: String,Status:
String)
Write the queries of the following
1.Display unique PNR_no of all passengers.
2. Display all the names of male passengers.
3. Display ticket numbers and names of all the passengers.
4. Find the ticket numbers of passengers whose name starts with ‘A’ and ends with
‘H’.
5. Display the sorted list of passengers names.
Sailors (sid: integer, sname: string, rating: integer, age: real)
Boats (bid: integer, bname: string, color: string)
Reserves (sid: integer, bid: integer, day: date)
b) Querying (using ANY, ALL, IN, Exists, NOT EXISTS, UNION, INTERSECT,
EXCEPT, Constraints etc.)
Find sailors whose rating is better than some sailor called Horatio. (ANY)
Find sailors whose rating is better than some sailor called Horatio. (ALL)
Find the sid’s and names of sailors who have reserved a red or a green boat.
Find the sid’s and names of sailors who have reserved a red and a green boat.
Find the sids of all sailors who have reserved red boats but not green boats.
c) Write PL/SQL programs using procedures.

You might also like