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

Cse 2004: Databse Manegment Systems Lab Digital Assignment 1

This document contains the code for creating multiple tables with constraints for a database management system assignment. It includes tables for tours, tour bookings, customer login details, customer details, cab details, driver details, cab bookings, flight bookings, and hotel bookings. It also includes queries to insert data, create duplicate tables, display constraints, enable/disable constraints, add/remove columns, permanently delete rows, rename tables, and list details from the tables with various filters.

Uploaded by

Akshat Swaminath
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)
38 views

Cse 2004: Databse Manegment Systems Lab Digital Assignment 1

This document contains the code for creating multiple tables with constraints for a database management system assignment. It includes tables for tours, tour bookings, customer login details, customer details, cab details, driver details, cab bookings, flight bookings, and hotel bookings. It also includes queries to insert data, create duplicate tables, display constraints, enable/disable constraints, add/remove columns, permanently delete rows, rename tables, and list details from the tables with various filters.

Uploaded by

Akshat Swaminath
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/ 17

CSE 2004 : DATABSE MANEGMENT

SYSTEMS
LAB DIGITAL ASSIGNMENT 1

Name: Akshat Swaminath

Regd. No: 20BCE2231

Slot: L3+L4

Submitted to: Dr. ANAND BIHARI SIR


1.1Create all the tables specified above with appropriate constraints (Primary
key, Foreign key, Not null, unique, check and default).
CODE:
• Tour
create table tour_inf(
tour_id number(5) NOT NULL,
tour_name varchar2(10) NOT NULL,
place_from varchar2(25) NOT NULL,
place_to varchar2(25) NOT NULL,
place_to_be varchar2(30),
duraion_min number(4) NOT NULL,
fare number(5) NOT NULL,
description varchar2(100),
primary key(tour_id));
• Tour booking
create table tour_booking(
booking_id number(3) NOT NULL,
tour_id number(5) NOT NULL,
customer_id number(4) NOT NULL,
from_date date NOT NULL,
to_date date NOT NULL,
no_of_person number(2) NOT NULL,
duration_m number(4) NOT NULL,
booking_amount number(5) NOT NULL,
foreign key (tour_id) references tour_inf(tour_id),
primary key(tour_id));
• Customer login
create table customer_login(
username varchar2(50) NOT NULL,
password varchar2(10) NOT NULL,
login_date date NOT NULL,
login_time timestamp NOT NULL,
primary key(username));
• Customer detail
create table customer_detail(
customer_id number(4) NOT NULL,
first_name varchar2(25) NOT NULL,
middle_name varchar2(25),
last_name varchar2(20),
mobile_no number(10) NOT NULL,
email_id varchar2(50) NOT NULL,
address varchar2(70) NOT NULL,
age number(2) CHECK(age>=18) NOT NULL,
id_proof1 varchar2(30) NOT NULL,
id_proof2 varchar2(30),
foreign key (customer_id) references flight_booking(customer_id),
primary key(customer_id));
• Cab details
create table cab_detail(
cab_id number(5) NOT NULL,
owner_name varchar2(10) NOT NULL,
license_detail varchar2(10) NOT NULL,
contact_no number(10) NOT NULL,
cab_type varchar2(20) NOT NULL,
primary key(cab_id));
• Driver detail
create table driver_detail(
driver_id number(5) NOT NULL,
name varchar2(20) NOT NULL,
address varchar(25)NOT NULL,
contact_no number(10) NOT NULL,
cab_id number(5) NOT NULL,
foreign key(cab_id) references cab_detail(cab_id),
primary key(cab_id));

• Cab Booking
create table cab_booking(
cab_book_id number(5) NOT NULL,
cab_id number(2) NOT NULL,
tour_bookingid number(3) NOT NULL,
cab_from varchar(25)NOT NULL,
cab_to varchar(25) NOT NULL,
amount number(4) NOT NULL,
foreign key(tour_bookingid) references tour_inf(tour_id),
primary key(cab_id));
• Flight booking
create table flight_bookings(
booking_id number(3) NOT NULL UNIQUE,
booking_date date NOT NULL,
customer_id number(4) NOT NULL,
flight_no number(4) NOT NULL,
flight_from varchar2(25) NOT NULL,
flight_to varchar2(25) NOT NULL,
airline_name varchar2(20) NOT NULL,
journey_date date NOT NULL,
arrival_time timestamp NOT NULL,
dep_time timestamp NOT NULL,
no_of_tickets number(2) NOT NULL,
fare number(5) NOT NULL,
tour_bookid number(3) NOT NULL,
primary key(customer_id));
• Hotel booking
create table hotel_booking(
tour_booking_id number(3) NOT NULL UNIQUE,
hotel_name varchar2(10) NOT NULL,
hotel_location varchar2(20) NOT NULL,
from_date varchar2(10) NOT NULL,
to_date varchar2(10) NOT NULL,
no_of_person number(2) NOT NULL,
amount number(4) NOT NULL,
book_date varchar2(10) NOT NULL,
hotel_bookid number(3) NOT NULL,
foreign key (tour_booking_id) references tour_inf(tour_id),
primary key(hotel_bookid));

1.2.&1.3 Insert data into the tables (interactive and non-interactice)


1.4. Create a duplicate copy of table without data.

1.5. Create a duplicate copy of table


2.1. Write a Query to display the constraint name of each table

2.2 Write a query to enable and disable the costraints

2.3 Write a query to drop all the constraints of Hotel booking table
3.1 and 3.2 Write a query to add column in total login count in the customer login table
Write a query to change the datatype of login_date (Customer login table) to
timestamp and remove the login_time column from the table.
4.1 Remove all the rows permanently from the driver table

4.2 Change the name of Driver table to Driver_info


4.3 List all the driver details
4.4 List all customer details.
4.5 List all the cab details.

4.6 Give a list of drivers details in ascending order of driver id.


4.7 List all the senior citizen customer details
4.8 List all the tour details where the tour starting place starts with letter ‘m’.

4.9 List all tour details within a range given by the user

4.10 List all the customers who have submitted only one ID proof.

You might also like