DBMA Assignment (1to8)
DBMA Assignment (1to8)
Inspg lonovalion
DEPARTMENT OF INFORMATIONTECHNOLOGY
Year-2024-2025
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)
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
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.
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)