0% found this document useful (0 votes)
14 views2 pages

Dbms Lab Assignment: Name: Shubham Kumar Reg. No.: 2020UGCS014

The document contains the SQL queries for creating tables like bus, passenger, ticket, reservation and cancellation in a database called DBMS. It also contains sample queries to retrieve data from these tables based on various conditions.
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)
14 views2 pages

Dbms Lab Assignment: Name: Shubham Kumar Reg. No.: 2020UGCS014

The document contains the SQL queries for creating tables like bus, passenger, ticket, reservation and cancellation in a database called DBMS. It also contains sample queries to retrieve data from these tables based on various conditions.
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

Remove Watermark Wondershare

PDFelement

DBMS LAB ASSIGNMENT


Name : Shubham Kumar Reg. No. : 2020UGCS014

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;
Remove Watermark Wondershare
PDFelement

-- 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