0% found this document useful (0 votes)
9 views5 pages

DBMA Assignment (1to8)

The document outlines a series of assignments for a Database Management Systems Lab at MCKV Institute of Engineering, covering topics such as table creation, data insertion, updates, and constraints. It includes specific tasks for creating tables, altering them, and performing various SQL operations. Additionally, it addresses PL/SQL blocks, cursors, procedures, functions, and triggers related to database management.

Uploaded by

mailme9051
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views5 pages

DBMA Assignment (1to8)

The document outlines a series of assignments for a Database Management Systems Lab at MCKV Institute of Engineering, covering topics such as table creation, data insertion, updates, and constraints. It includes specific tasks for creating tables, altering them, and performing various SQL operations. Additionally, it addresses PL/SQL blocks, cursors, procedures, functions, and triggers related to database management.

Uploaded by

mailme9051
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

25 MCKV INSTITUTE OF ENGINNERING

243 G. T. Road (N) Liluah Howrah - 711204 A


NAAC

Inspg lonovalion
DEPARTMENT OF INFORMATIONTECHNOLOGY
Year-2024-2025

Data Base Management Systems Lab(PC-IT491)


ASSIGNMENT:1
Topics: Table creation, Insertion, Describe, Alter Table and Distinct.
1. Create the following table.

i) Create Table CATEGORY HEADER with the following attribute :


Column Name Datatype
CAT CODE NUMBER(5)
CAT DESC VARCHAR2(20)

ii) Create Table PLACE_HEADER with the following attribute :


Column Name
Datatype
PLACE ID NUMBER(5)
PLACE NAME VARCHAR2(20)
PLACE ADDRESS VARCHAR2(20)
BUS STATION VARCHAR2(25)

ii) Create Table ROUTE HEADER with the following attribute :

Column Name
ROUTE ID
Datatype
NUMBER(5)
ROUTE NUMBER NUMBER(5)
CAT CODE NUMBER(S)
ORIGIN VARCHAR2(25)
DESTINATION VARCHAR2(20)
FARE NUMBER(7,2)
DISTANCE NUMBER(3)
CAPACITY NUMBER(3)
with the following attribute :
iv) Create Table TICKET DETAIL
Column Name Datatype
TICKET NO NUMBER(5)
NAME VARCHAR2(20)
SEX CHAR(1)
AGE NUMBER(3)
DESTINATION VARCHAR2(20)
FARE NUMBER(7,2)

V) Create Table TICKET HEADERwith the following attribute :


Column Name Datatype
FLEET ID NUMBER(5)
TICKET NO NUMBER(5)
DATE OF TRAVELLING DATE
TIME TRAVEL CHAR(8)
BOARD PLACE VARCHAR2(20)
ORIGIN VARCHAR2(20)
DESTINATION VARCHAR2(20)
ADULTS NUMBER(3)
CHILDREN NUMBER(3)
TOTAL FARE NUMBER(7,2)
ROUTE ID NUMBER(5)

vii) Create Table ROUTE DETAIL with the following attribute :


Column Name Datatype
ROUTE ID NUMBER(5)
NONSTOP CHAR(1)

2. Describe the above table.


3. Insert the data the following table.
4. Alter the table ticket header, modifies the column DOT data type date.
5. Alter the table route header to a column comments with a data type as a long.
6. Display allticket number from ticket detail.
7. Display only distinct ticket number from ticket detail.
8. Alter the table rout_header, modify the length of the column distance to(8);
ASSIGNMENT: 2
Topics: Update, Delete, String, Numerical and Miscellaneous functions.

1. a) Update the table route header to set the distance between madras and madurai to
be 300.
b) Delete only those rows that have the destination as Bangalore and the origin
as madras.
2. Convertthe 1st letter of the fielddestination in capitalfrom table Ticket Header.
3. Display the last three characters of the field origin and destination.
4. Display the first three characters of the place where the name is hyderabad.
5. Display origin as m' replace with v'.
6. Display only two character from 2nd character in the name of traveler.
1. Display the total fare such that which contain no decimal.
lowest fare?
8. Give the average and sum of product fare. What is the highest and
9. Display the details of places whose names begins with 'Ma'.
10. Whois paid the highest fare?
11. Which bus runs for the minimum distance?

12. Givethe total number who have traveled sofar group by the ticket no.

ASSIGNMENT:3

Topics: Primary key, Foreign key, Constraints

1. Alter the table route header include Primary key constraint to the column route id.

2. Alter the table route detail to include a Foreign key constraint to the column route id.

3. Alter the table route detail to set a constraint to the field non stop "not null";
4 Alter the table ticket header to add a unique key constraint to the column route id.
5. Alter the table ticket detail to add a check constraint on fare to
Rs. 1 to 20. accepts values between

6. Alter the table ticket detail to add a Composite Primary key using
age and name.
7. Drop the above constraint created on Question No. 6.
ASSIGNMENT:4
Synonym,
Topics: View, Index , Sequence and
1. Create a View v header' from the table route header.
2. Update the view to set fare=42.00 where route id=02.
and route_detail
3. Create a view 'vrr route header and route detail from route header
with the following column :route id,origin, destination,fare,place_id,non _stop.
4. Create a synonym for th;e table ticket header with the name"tick".
5. Create a sequence ticseq' with the following specification :
minimum value-1,
max value-20,
Increase=1,
Startwith=1
Withcycle and cache memory=10.
6. Alter the sequence such that the max value would be 25.

7. Create a normal index tickin' on adult column of the ticket header.

8 Create anormal index Find' on column of the ticket header.


9. Create an index organized table states with the following column :

State_ idnumber(2),state_name varch;ar2(10);

ASSIGNMENT:5
Topics: PL/SQL BLOCK
1. Write a PL/SQL block to satisfy the following conditions accepting the route id as the user
input. (Using route header)
a) if the distance is less than 500 then update the fare to be 190.80.
b)if the distance is between 501-1000 then update fare to be 876.98
c) if the distance is greater than 1000 then display a
message
2. Write a PL/SQL block to update the bus station to be 'n' when themplace id is 01' or 06
(using place header).
3. Write a PL/SQLblock to display the reverse of numbers between one and hundred.
4.
Write a PL/SQL block to satisfy the
input. (Using ticket header) following conditions accepting the ticket_no tne use
a) f the origin is madras' then raise an exception to display the origin
D) T the origin is bangalore' the raise an exception to display the originand ticket_no.
and ticket_no.

ASSIGNMENT: 6
Topics: Cursor

1.
Write a PL/SQL block to give the details of
passengers.
2.
Write a PLISQL block updating the nonstop to n' where the route ids are between 105
and 115.

ASSIGNMENT:7
Topics: Procedure and Function
1. Write a procedure toaccept the ticket no as input and display an
total fareis null otherwisedisplay the ticket header. [Use : error message if the
ticket headerl
2. Write a procedure to accept the route id as
cat code is 1 and 50 if the cat code is 2. [Use:input and update the capacity to be 25 if the
route header]
3. write a function, which will accept the ticket no as
the input and return total fare as the
output. [Use: ticket_header]

ASSIGNMENT: 8
Topics: Trigger
1.
Write a database trigger before
delete each row not allowing
appropriate message on the table routefordetail. deletion and give the
2. Write a database
these operations ontrigger before
insert/update/delete fro
the table route header on Mondays,each statement not allowing any of
Tuesdays and Wednesdays.
(HoD-IT) Sougete ay
(SougaBa Dey, Arindam Das)

You might also like