SlideShare a Scribd company logo
BUS RESERVATION SYSTEM
MSPM’S
Deogiri Institute of Engineering and Management Studies Aurangabad
A CA2 Presentation for Advanced Database System On
Presented by –
3762 Urja Dhabarde
3771 Mansi Gaikwad
3773 Nikita Dabhade
Under the guidance of
– prof. Sugandha Nandedkar
o ER Diagram
o Normalization
o SQL queries
o Question
Table
of
Contents
I
3
Normalization is a database design technique which is used to organize the tables in such a manner
that it should reduce redundancy and dependency of data. Normalization is a multi step process. It
creates smaller tables from larger tables.
4 commonly used normal forms are first normal form (1NF), second normal form (2NF), third normal
form (3NF), and Boyce-Codd normal form (BCNF).
OBJECTIVES
To make it feasible to represent any relation in the database.
To free relations from undesirable insertion, update, and deletion anomalies.
Anomalies – Unconventional situation
NORMALIZATION
Unnormalized Data
1st Normal Form (1NF)
• Each table cell should contain a single value.
• Each record needs to be unique.
In our data, we will apply 1NF on the passenger table and Bus&Route_details table as they have multi-
valued attributes.
Important Terminologies
• Super Key : Attribute or set of attributes that uniquely identify each record in the relation.
• Candidate Key : A candidate key is super key whose proper subset is not a super key (minimal super key).
• Prime attribute − Part of the candidate-key.
• Non-prime attribute − Not a part of the prime-key
• Functional dependency (A B) means, for all instances of a particular value of A, there is same value for B.
Here, A is determiner and B is dependent factor.
• TYPES OF FUNCTIONAL DEPENDANCIES
Partial dependency
• If there is some attribute that can be removed from A and the dependency still holds.
• Ex. P_id, p_name -> userid
Transitive dependency
• In a relation, if attribute(s) A->B and B->C, the C is transitively dependent on A via B (provided that A is not
functionally dependent on B or C). Ex., Bus_no -> Route_no
• And Route_no -> Route_name
2nd Normal Form (2NF) remove partial dependencies
• A table is in 2 NF if it is 1 NF and if all non prime attributes are dependent upon prime attributes i.e., no patrial
dependency.
• User (user_id  username, email)
• Passenger (P_id  P_name, P_address, DOB, Gender, User_id)
Contacts (Ph_id, P_id  PhNo)
BusRoute (Route_no, Bus_no  B_name, Capacity, Type, Source, Destination, Distance, Fare, Dept_date, Dept_time)
Reservation (SeatNo, Bus_no  Status, BookingDate, TicketNo, ModeOfPayment)
3rd Normal From (3NF) no transitive dependencies
1) User (user_id  username, email)
2) Passenger (P_id  P_name, P_address, DOB, Gender, User_id)
3) Contacts (Ph_id, P_id  PhNo)
• As Bus_no  Route_no & Route_no  Distance, Break BusRoute relation into two tables as:
4) Bus (Bus_no  B_name, Capacity, Type, Route_no)
5) Route (Route_no  R_name, Source, Destination, Distance, Dept_date, Dept_time, Fare)
Now, we apply 3NF on the Reservation table
As SeatNo  TicketNo & TicketNo  ModeOfPayment,
Break the relation into 2 tables as:
6) Booking (SeatNo  P_id, Bus_no, Status, TicketNo)
7) Ticket (TicketNo  BookingDate, ModeOfPayment)
Boyce-Codd Normal Form (BDNF)
• Boyce-Codd Normal Form (BCNF) is an extension of Third Normal Form on strict terms. It has
additional constraints compared with the general definition of 3NF.
• A relation is in BCNF, if and only if, in every non-trivial FD (X Y) X is a super key.
• X  Y is a FD and X intersection Y = 0, then this is non-trivial FD.
• In case of our data, BCNF normalization cannot be applied.
SQL Queries
MOTO – To list the drivers names with salaries>=12000 and <=15000.
-----------------------------------------------------------------------------------------------------------------------------------------------
SQL>
SELECT d_name, salary
FROM driver
WHERE d_id in (SELECT d_id FROM driver WHERE salary BETWEEN 12000 AND 15000);
MOTO - To check the status of seats in shivneri bus. It display the details of shivneri bus.
----------------------------------------------------------------------------------------------------------------------------------------
SQL>
SELECT booking.seat_no, b_name, status
FROM bus1, booking
WHERE bus1.bus_no = booking.Bus_no AND b_name = 'shivneri’;
---------------------------------------------------------------------------------------------------------------------------------------
MOTO – Display 3 max salaries from the drivers table.
-----------------------------------------------------------------------------------------------------------------------------------------
SQL>
SELECT distinct salary
FROM driver a
WHERE 3>= (SELECT COUNT(distinct salary) FROM driver b WHERE a.salary <= b.salary) ORDER BY a.salary
desc;
---------------------------------------------------------------------------------------------------------------------------------------
MOTO – To find the list of passengers who booked ticket using UPI mode and on which date.
passengers booked ticket using UPI.
------------------------------------------------------------------------------------------------------------------------------------------
SQL>
SELECT passenger.p_name, ticket.booking_date
FROM passenger, ticket
WHERE passenger.p_id = ticket.p_id and ticket.modeOfPay = 'UPI’;
-----------------------------------------------------------------------------------------------------------------------------------------
MOTO – To connect the user table with user_id and p_address in passenger table and find which user
belongs to which city.
------------------------------------------------------------------------------------------------------------------------------------------
SQL>
SELECT u.user_id, username, email, p_id, p_address
FROM UserTable u, passenger p
WHERE u.username=p.p_name AND p_address in (SELECT p_address FROM passenger WHERE user_id in
(1,2,3,4,5,6,7));
----------------------------------------------------------------------------------------------------------------------------------------------
MOTO - Display the count of seat_no having status is not booked.
------------------------------------------------------------------------------------------------------------------------------------
SQL>
SELECT COUNT(seat_no)
FROM booking, bus1
WHERE status!='booked’;
------------------------------------------------------------------------------------------------------------------------------------
MOTO - The goal is display the bus name having same bus number where ticket no is T3.
The bus no is connect with the ticket number which show the bus name based on ticket no.
------------------------------------------------------------------------------------------------------------------------------------
SQL>
SELECT b_name
FROM bus1
WHERE bus_no=(SELECT bus_no FROM booking WHERE ticket_no in('T3’));
-------------------------------------------------------------------------------------------------------------------------------------
MOTO – to find the name of passenger name for P1 and with ticket T1 using union operation
------------------------------------------------------------------------------------------------------------------------------------------
SQL>
SELECT p_name FROM passenger WHERE p_id='P1’
UNION
SELECT ticket_no FROM booking WHERE ticket_no='T1’;
------------------------------------------------------------------------------------------------------------------------------------------
MOTO - display the details of passengers who is having uesrid is greater than 3 and paseenger id is
not equal to P1 and P4
----------------------------------------------------------------------------------------------------------------------------------------
SQL>
SELECT * FROM passenger WHERE user_id>3
INTERSECT
SELECT * FROM passenger WHERE p_id!='P1' AND p_id!='P4';
-----------------------------------------------------------------------------------------------------------------------------------------
MOTO - Return the those passengers who has id>3 and address is delhi.
----------------------------------------------------------------------------------------------------------------------------------------------
SQL>
SELECT * FROM passenger WHERE user_id>3
INTERSECT
SELECT * FROM passenger WHERE p_address='delhi’;
----------------------------------------------------------------------------------------------------------------------------------------------
MOTO - Find out the passengers who is having user id >3 and address is not delhi.
--------------------------------------------------------------------------------------------------------------------------------------------
SQL>
SELECT * FROM passenger WHERE user_id>3
MINUS
SELECT * FROM passenger WHERE p_address='delhi’;
---------------------------------------------------------------------------------------------------------------------------------------------------------
Triggers
Moto –
Trigger 1 – To calculate the total salary of a driver by adding the regular salary with bonus using a ‘after insert’ trigger.
Trigger 2 – To set bonus of every driver to Rs200 using ‘after update’ trigger and update the age of driver by one year.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Trigger 1 –
CREATE TRIGGER trigg1
AFTER INSERT
ON driver
FOR EACH ROW
BEGIN
UPDATE driver SET total = salary + bonus;
END;
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Trigger 2 –
CREATE TRIGGER trigg2
AFTER UPDATE
ON driver
FOR EACH ROW
BEGIN
UPDATE driver SET bonus=200;
END;
Views
Q) With suitable example define view. Discuss the advantages and disadvantages of view in DBMS.
Thank you!

More Related Content

Similar to BUS RESERVATION SYSTEM.pptx

An Enhanced Performance Pipelined Bus Invert Coding For Power Optimization Of...
An Enhanced Performance Pipelined Bus Invert Coding For Power Optimization Of...An Enhanced Performance Pipelined Bus Invert Coding For Power Optimization Of...
An Enhanced Performance Pipelined Bus Invert Coding For Power Optimization Of...
IRJET Journal
 
Chapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptxChapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptx
ranjithagharsamy
 
Design and implementation of address generator for wi max deinterleaver on fpga
Design and implementation of address generator for wi max deinterleaver on fpgaDesign and implementation of address generator for wi max deinterleaver on fpga
Design and implementation of address generator for wi max deinterleaver on fpga
eSAT Publishing House
 
Reliability improvement and loss reduction in radial distribution system wit...
Reliability improvement and loss reduction in radial  distribution system wit...Reliability improvement and loss reduction in radial  distribution system wit...
Reliability improvement and loss reduction in radial distribution system wit...
IJECEIAES
 
A few things about the Oracle optimizer - 2013
A few things about the Oracle optimizer - 2013A few things about the Oracle optimizer - 2013
A few things about the Oracle optimizer - 2013
Connor McDonald
 
Chapter 9
Chapter 9Chapter 9
Materialized views in PostgreSQL
Materialized views in PostgreSQLMaterialized views in PostgreSQL
Materialized views in PostgreSQL
Ashutosh Bapat
 
Implementation of dynamic source routing (dsr) in mobile ad hoc network (manet)
Implementation of dynamic source routing (dsr) in mobile ad hoc network (manet)Implementation of dynamic source routing (dsr) in mobile ad hoc network (manet)
Implementation of dynamic source routing (dsr) in mobile ad hoc network (manet)
eSAT Journals
 
Implementation of dynamic source routing (dsr) in
Implementation of dynamic source routing (dsr) inImplementation of dynamic source routing (dsr) in
Implementation of dynamic source routing (dsr) in
eSAT Publishing House
 
Gams code for dc opf (1)
Gams code for dc  opf (1)Gams code for dc  opf (1)
Gams code for dc opf (1)
Alireza soroudi
 
MODELLING AND SIMULATION OF 128-BIT CROSSBAR SWITCH FOR NETWORK -ONCHIP
MODELLING AND SIMULATION OF 128-BIT CROSSBAR SWITCH FOR NETWORK -ONCHIPMODELLING AND SIMULATION OF 128-BIT CROSSBAR SWITCH FOR NETWORK -ONCHIP
MODELLING AND SIMULATION OF 128-BIT CROSSBAR SWITCH FOR NETWORK -ONCHIP
VLSICS Design
 
Sql interview questions
Sql interview questionsSql interview questions
Sql interview questions
nagesh Rao
 
Oracle Join Methods and 12c Adaptive Plans
Oracle Join Methods and 12c Adaptive PlansOracle Join Methods and 12c Adaptive Plans
Oracle Join Methods and 12c Adaptive Plans
Franck Pachot
 
Synchronous sequential Circuits
Synchronous sequential CircuitsSynchronous sequential Circuits
Synchronous sequential Circuits
Indira Priyadarshini
 
Riyaj: why optimizer_hates_my_sql_2010
Riyaj: why optimizer_hates_my_sql_2010Riyaj: why optimizer_hates_my_sql_2010
Riyaj: why optimizer_hates_my_sql_2010
Riyaj Shamsudeen
 
Adaptive Query Optimization
Adaptive Query OptimizationAdaptive Query Optimization
Adaptive Query Optimization
Anju Garg
 
Model Complex Routing with Cisco MATE Design External Endpoints (White Paper)
Model Complex Routing with Cisco MATE Design External Endpoints (White Paper)Model Complex Routing with Cisco MATE Design External Endpoints (White Paper)
Model Complex Routing with Cisco MATE Design External Endpoints (White Paper)
Cisco Service Provider Mobility
 
SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所
Hiroshi Sekiguchi
 
Hspice tut
Hspice tutHspice tut
Hspice tut
Peter Pro
 
12c SQL Plan Directives
12c SQL Plan Directives12c SQL Plan Directives
12c SQL Plan Directives
Franck Pachot
 

Similar to BUS RESERVATION SYSTEM.pptx (20)

An Enhanced Performance Pipelined Bus Invert Coding For Power Optimization Of...
An Enhanced Performance Pipelined Bus Invert Coding For Power Optimization Of...An Enhanced Performance Pipelined Bus Invert Coding For Power Optimization Of...
An Enhanced Performance Pipelined Bus Invert Coding For Power Optimization Of...
 
Chapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptxChapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptx
 
Design and implementation of address generator for wi max deinterleaver on fpga
Design and implementation of address generator for wi max deinterleaver on fpgaDesign and implementation of address generator for wi max deinterleaver on fpga
Design and implementation of address generator for wi max deinterleaver on fpga
 
Reliability improvement and loss reduction in radial distribution system wit...
Reliability improvement and loss reduction in radial  distribution system wit...Reliability improvement and loss reduction in radial  distribution system wit...
Reliability improvement and loss reduction in radial distribution system wit...
 
A few things about the Oracle optimizer - 2013
A few things about the Oracle optimizer - 2013A few things about the Oracle optimizer - 2013
A few things about the Oracle optimizer - 2013
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
 
Materialized views in PostgreSQL
Materialized views in PostgreSQLMaterialized views in PostgreSQL
Materialized views in PostgreSQL
 
Implementation of dynamic source routing (dsr) in mobile ad hoc network (manet)
Implementation of dynamic source routing (dsr) in mobile ad hoc network (manet)Implementation of dynamic source routing (dsr) in mobile ad hoc network (manet)
Implementation of dynamic source routing (dsr) in mobile ad hoc network (manet)
 
Implementation of dynamic source routing (dsr) in
Implementation of dynamic source routing (dsr) inImplementation of dynamic source routing (dsr) in
Implementation of dynamic source routing (dsr) in
 
Gams code for dc opf (1)
Gams code for dc  opf (1)Gams code for dc  opf (1)
Gams code for dc opf (1)
 
MODELLING AND SIMULATION OF 128-BIT CROSSBAR SWITCH FOR NETWORK -ONCHIP
MODELLING AND SIMULATION OF 128-BIT CROSSBAR SWITCH FOR NETWORK -ONCHIPMODELLING AND SIMULATION OF 128-BIT CROSSBAR SWITCH FOR NETWORK -ONCHIP
MODELLING AND SIMULATION OF 128-BIT CROSSBAR SWITCH FOR NETWORK -ONCHIP
 
Sql interview questions
Sql interview questionsSql interview questions
Sql interview questions
 
Oracle Join Methods and 12c Adaptive Plans
Oracle Join Methods and 12c Adaptive PlansOracle Join Methods and 12c Adaptive Plans
Oracle Join Methods and 12c Adaptive Plans
 
Synchronous sequential Circuits
Synchronous sequential CircuitsSynchronous sequential Circuits
Synchronous sequential Circuits
 
Riyaj: why optimizer_hates_my_sql_2010
Riyaj: why optimizer_hates_my_sql_2010Riyaj: why optimizer_hates_my_sql_2010
Riyaj: why optimizer_hates_my_sql_2010
 
Adaptive Query Optimization
Adaptive Query OptimizationAdaptive Query Optimization
Adaptive Query Optimization
 
Model Complex Routing with Cisco MATE Design External Endpoints (White Paper)
Model Complex Routing with Cisco MATE Design External Endpoints (White Paper)Model Complex Routing with Cisco MATE Design External Endpoints (White Paper)
Model Complex Routing with Cisco MATE Design External Endpoints (White Paper)
 
SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所
 
Hspice tut
Hspice tutHspice tut
Hspice tut
 
12c SQL Plan Directives
12c SQL Plan Directives12c SQL Plan Directives
12c SQL Plan Directives
 

Recently uploaded

Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
john krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptxjohn krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptx
Madan Karki
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
Nada Hikmah
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
LAXMAREDDY22
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
zubairahmad848137
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
IJECEIAES
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 

Recently uploaded (20)

Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
john krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptxjohn krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptx
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 

BUS RESERVATION SYSTEM.pptx

  • 1. BUS RESERVATION SYSTEM MSPM’S Deogiri Institute of Engineering and Management Studies Aurangabad A CA2 Presentation for Advanced Database System On Presented by – 3762 Urja Dhabarde 3771 Mansi Gaikwad 3773 Nikita Dabhade Under the guidance of – prof. Sugandha Nandedkar
  • 2. o ER Diagram o Normalization o SQL queries o Question Table of Contents
  • 3. I 3
  • 4. Normalization is a database design technique which is used to organize the tables in such a manner that it should reduce redundancy and dependency of data. Normalization is a multi step process. It creates smaller tables from larger tables. 4 commonly used normal forms are first normal form (1NF), second normal form (2NF), third normal form (3NF), and Boyce-Codd normal form (BCNF). OBJECTIVES To make it feasible to represent any relation in the database. To free relations from undesirable insertion, update, and deletion anomalies. Anomalies – Unconventional situation NORMALIZATION
  • 6. 1st Normal Form (1NF) • Each table cell should contain a single value. • Each record needs to be unique. In our data, we will apply 1NF on the passenger table and Bus&Route_details table as they have multi- valued attributes.
  • 7. Important Terminologies • Super Key : Attribute or set of attributes that uniquely identify each record in the relation. • Candidate Key : A candidate key is super key whose proper subset is not a super key (minimal super key). • Prime attribute − Part of the candidate-key. • Non-prime attribute − Not a part of the prime-key • Functional dependency (A B) means, for all instances of a particular value of A, there is same value for B. Here, A is determiner and B is dependent factor. • TYPES OF FUNCTIONAL DEPENDANCIES Partial dependency • If there is some attribute that can be removed from A and the dependency still holds. • Ex. P_id, p_name -> userid Transitive dependency • In a relation, if attribute(s) A->B and B->C, the C is transitively dependent on A via B (provided that A is not functionally dependent on B or C). Ex., Bus_no -> Route_no • And Route_no -> Route_name
  • 8. 2nd Normal Form (2NF) remove partial dependencies • A table is in 2 NF if it is 1 NF and if all non prime attributes are dependent upon prime attributes i.e., no patrial dependency. • User (user_id  username, email) • Passenger (P_id  P_name, P_address, DOB, Gender, User_id)
  • 9. Contacts (Ph_id, P_id  PhNo) BusRoute (Route_no, Bus_no  B_name, Capacity, Type, Source, Destination, Distance, Fare, Dept_date, Dept_time)
  • 10. Reservation (SeatNo, Bus_no  Status, BookingDate, TicketNo, ModeOfPayment)
  • 11. 3rd Normal From (3NF) no transitive dependencies 1) User (user_id  username, email) 2) Passenger (P_id  P_name, P_address, DOB, Gender, User_id) 3) Contacts (Ph_id, P_id  PhNo) • As Bus_no  Route_no & Route_no  Distance, Break BusRoute relation into two tables as: 4) Bus (Bus_no  B_name, Capacity, Type, Route_no) 5) Route (Route_no  R_name, Source, Destination, Distance, Dept_date, Dept_time, Fare) Now, we apply 3NF on the Reservation table As SeatNo  TicketNo & TicketNo  ModeOfPayment, Break the relation into 2 tables as: 6) Booking (SeatNo  P_id, Bus_no, Status, TicketNo) 7) Ticket (TicketNo  BookingDate, ModeOfPayment)
  • 12. Boyce-Codd Normal Form (BDNF) • Boyce-Codd Normal Form (BCNF) is an extension of Third Normal Form on strict terms. It has additional constraints compared with the general definition of 3NF. • A relation is in BCNF, if and only if, in every non-trivial FD (X Y) X is a super key. • X  Y is a FD and X intersection Y = 0, then this is non-trivial FD. • In case of our data, BCNF normalization cannot be applied.
  • 13. SQL Queries MOTO – To list the drivers names with salaries>=12000 and <=15000. ----------------------------------------------------------------------------------------------------------------------------------------------- SQL> SELECT d_name, salary FROM driver WHERE d_id in (SELECT d_id FROM driver WHERE salary BETWEEN 12000 AND 15000);
  • 14. MOTO - To check the status of seats in shivneri bus. It display the details of shivneri bus. ---------------------------------------------------------------------------------------------------------------------------------------- SQL> SELECT booking.seat_no, b_name, status FROM bus1, booking WHERE bus1.bus_no = booking.Bus_no AND b_name = 'shivneri’; ---------------------------------------------------------------------------------------------------------------------------------------
  • 15. MOTO – Display 3 max salaries from the drivers table. ----------------------------------------------------------------------------------------------------------------------------------------- SQL> SELECT distinct salary FROM driver a WHERE 3>= (SELECT COUNT(distinct salary) FROM driver b WHERE a.salary <= b.salary) ORDER BY a.salary desc; ---------------------------------------------------------------------------------------------------------------------------------------
  • 16. MOTO – To find the list of passengers who booked ticket using UPI mode and on which date. passengers booked ticket using UPI. ------------------------------------------------------------------------------------------------------------------------------------------ SQL> SELECT passenger.p_name, ticket.booking_date FROM passenger, ticket WHERE passenger.p_id = ticket.p_id and ticket.modeOfPay = 'UPI’; -----------------------------------------------------------------------------------------------------------------------------------------
  • 17. MOTO – To connect the user table with user_id and p_address in passenger table and find which user belongs to which city. ------------------------------------------------------------------------------------------------------------------------------------------ SQL> SELECT u.user_id, username, email, p_id, p_address FROM UserTable u, passenger p WHERE u.username=p.p_name AND p_address in (SELECT p_address FROM passenger WHERE user_id in (1,2,3,4,5,6,7)); ----------------------------------------------------------------------------------------------------------------------------------------------
  • 18. MOTO - Display the count of seat_no having status is not booked. ------------------------------------------------------------------------------------------------------------------------------------ SQL> SELECT COUNT(seat_no) FROM booking, bus1 WHERE status!='booked’; ------------------------------------------------------------------------------------------------------------------------------------
  • 19. MOTO - The goal is display the bus name having same bus number where ticket no is T3. The bus no is connect with the ticket number which show the bus name based on ticket no. ------------------------------------------------------------------------------------------------------------------------------------ SQL> SELECT b_name FROM bus1 WHERE bus_no=(SELECT bus_no FROM booking WHERE ticket_no in('T3’)); -------------------------------------------------------------------------------------------------------------------------------------
  • 20. MOTO – to find the name of passenger name for P1 and with ticket T1 using union operation ------------------------------------------------------------------------------------------------------------------------------------------ SQL> SELECT p_name FROM passenger WHERE p_id='P1’ UNION SELECT ticket_no FROM booking WHERE ticket_no='T1’; ------------------------------------------------------------------------------------------------------------------------------------------
  • 21. MOTO - display the details of passengers who is having uesrid is greater than 3 and paseenger id is not equal to P1 and P4 ---------------------------------------------------------------------------------------------------------------------------------------- SQL> SELECT * FROM passenger WHERE user_id>3 INTERSECT SELECT * FROM passenger WHERE p_id!='P1' AND p_id!='P4'; -----------------------------------------------------------------------------------------------------------------------------------------
  • 22. MOTO - Return the those passengers who has id>3 and address is delhi. ---------------------------------------------------------------------------------------------------------------------------------------------- SQL> SELECT * FROM passenger WHERE user_id>3 INTERSECT SELECT * FROM passenger WHERE p_address='delhi’; ----------------------------------------------------------------------------------------------------------------------------------------------
  • 23. MOTO - Find out the passengers who is having user id >3 and address is not delhi. -------------------------------------------------------------------------------------------------------------------------------------------- SQL> SELECT * FROM passenger WHERE user_id>3 MINUS SELECT * FROM passenger WHERE p_address='delhi’; ---------------------------------------------------------------------------------------------------------------------------------------------------------
  • 24. Triggers Moto – Trigger 1 – To calculate the total salary of a driver by adding the regular salary with bonus using a ‘after insert’ trigger. Trigger 2 – To set bonus of every driver to Rs200 using ‘after update’ trigger and update the age of driver by one year. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Trigger 1 – CREATE TRIGGER trigg1 AFTER INSERT ON driver FOR EACH ROW BEGIN UPDATE driver SET total = salary + bonus; END; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Trigger 2 – CREATE TRIGGER trigg2 AFTER UPDATE ON driver FOR EACH ROW BEGIN UPDATE driver SET bonus=200; END;
  • 25.
  • 26. Views Q) With suitable example define view. Discuss the advantages and disadvantages of view in DBMS.