KEMBAR78
Dbms Lab Assignment: Name: Adarsh Kashyap Reg. No.: 2020UGCS064 | PDF | Computers
0% found this document useful (0 votes)
10 views2 pages

Dbms Lab Assignment: Name: Adarsh Kashyap Reg. No.: 2020UGCS064

The document describes creating database tables for a bus reservation system including tables for buses, passengers, tickets, reservations and cancellations. It also includes example queries on the different tables.
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)
10 views2 pages

Dbms Lab Assignment: Name: Adarsh Kashyap Reg. No.: 2020UGCS064

The document describes creating database tables for a bus reservation system including tables for buses, passengers, tickets, reservations and cancellations. It also includes example queries on the different tables.
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/ 2

DBMS LAB ASSIGNMENT

Name : Adarsh Kashyap Reg. No. : 2020UGCS064

create database DBMS; use


DBMS;
-- create the table bus
create table bus(bus_no varchar(10),source varchar(20),destination varchar(20),primary
key(bus_no));

-- create the table passenger


create table passenger(passenger_id varchar(15),name varchar(20),age integer,gender
char(2),address varchar(20),primary key(passenger_id));

-- create the table ticket


create table ticket(ticket_id varchar(20),journey_date datetime,pnr_no varchar(20),source
varchar(20),destination varchar(20),bus_no varchar(10),primary key(ticket_id), foreign
key(bus_no) references bus(bus_no));

-- create the table reservation


create table reservation(pnr_no varchar(20),journey_date datetime,no_of_seats
integer,primary key(pnr_no));

-- create the table cancellation


create table cancellation(pnr_no varchar(20),journey_date datetime,no_of_seats
integer,primary key(pnr_no),foreign key(pnr_no) references reservation(pnr_no)); -- 1
select distinct pnr_no from reservation;
-- 2
select name from passenger where gender='m';

-- 3
select ticket_id from ticket; select
name from passenger;

-- 4
select source,destination from bus;

-- 5
select name from passenger where name like 'a%h';

-- 6
select name from passenger where age between 30 and 45;

-- 7
select name from passenger where name like'a%';

-- 8
select name from passenger order by name;

You might also like