Anda di halaman 1dari 20

Airline Reservation System - RDBMS - Free Computer Science Tutorials - Provided by Laynetworks.

com

Relational Database Management Systems

Airline Reservation System

1. A distribution Airline Reservation System stores the following information

(The following description may lead to un-normalized relations normalize them whenever required).

The flight details

It includes the originating flight terminal and destination terminal, along with stops in between, number of seats booked/available seats between two destination etc.

Customer Description

It includes customer code, name, address and phone number. This information may be used for keeping the records of customer for any emergency or for any other

kind of information

Reservation Description

It includes customer code number, flight number, date of booking, date of traveling, (You may assume any other fild/relation, if needed).

Let us assume that this distributed system is to be used following application:

a. A request for booking/cancellation of flight from any source to any destination

, giving connected flights in case no direct flight between the specified Source-Destination pair exist.

b. Calculation of high fliers (most frequent fliers) and calculating appropriate

reward points for these fliers.

Assuming both the transactions are single transactions. Design a distributed

database that is geographically dispersed at four cites Delhi, Mumbai, Chennai,

Kolkatta) Make suitable assumptions. Give justifications to your design.

Your design include:


http://www.laynetworks.com/Relational%20Database%20Management%20Systems.htm (1 of 6)1/27/2011 1:26:32 PM
Airline Reservation System - RDBMS - Free Computer Science Tutorials - Provided by Laynetworks.com

i) The global schema, fragmentation schema, allocation schema.

ii) SQL commands for above queries/applications

iii) How the response for application 1 and 2 will be generated. Assuming these

are global queries. Explain how various fragments will be combined to do so.

iv) Implement the database at least using a centralized database management

system (make suitable adjustment in your design)

Answer:

DISTRIBUTED DATABASE :

Distributed database implies that a single application should be able to operate

transparently on data that is spread across a variety of different databases and

connected by a communication network.

“A distributed database system consists of a collection of ‘sites’, connected together

via some kind of communications network, in which


http://www.laynetworks.com/Relational%20Database%20Management%20Systems.htm (2 of 6)1/27/2011 1:26:32 PM
Airline Reservation System - RDBMS - Free Computer Science Tutorials - Provided by Laynetworks.com

1. Each site is a database system site in its own right, but

2. The sites have agreed to work together so that a user at any site can access data anywhere in the network exactly as if the data were all stored at the user’s own

site.

It follows that the so-called “distributed database” is really a kind of virtual objects, whose component parts are physically stored in a number of distinct “real”

database at a number distinct sites.

A distributed database system consists of a collection of sites, each of which may participate in the execution of transactions which access data at one site, or several

sites. The main difference between centralized and distributed database systems is that, in the former, the data resided in one single location, while in the latter, the

data resided in several locations.

Each site is able to process local transactions, those transactions that access data only that single site. A site may participate in the executions of global transactions,

those transactions that access data in several sites. The execution of global transactions require communication among the sites.

Each site is a database system site in its own right. In other words, each site has its own local “real” databases, its own local users, its own local DBMS and transaction

management software and its own local data communications manager. The distributed database system can thus be regarded as a kind of partnership among individual

local DBMS at the individual sites.

In the given context there are four sites,i.e., Delhi, Mumbai, Chennai and Kolkata and these sites are geographically dispersed. Each site has its own computer with a

database consisting of all the customers and flight details maintained at that site. The database system at the various sites are based on the relational model. Each

branch maintains the relation reservation where

Reservation_scheme=(site_code,fl_no,cust_code,travel_date)

Site containing information about the four sites maintains the relation (Cite_scheme), where

Cite_scheme=(Cite_code,Cite_name)

http://www.laynetworks.com/Relational%20Database%20Management%20Systems.htm (3 of 6)1/27/2011 1:26:32 PM


Airline Reservation System - RDBMS - Free Computer Science Tutorials - Provided by Laynetworks.com

A local transaction is a transaction that accesses information in the one single site, at which the transaction was initiated. A global transaction, on the other hand is

one which either access accounts in a site different from the one at which the transaction was initiated, or access several different sites.

Then the advantages are surely obvious: The distributed arrangement combines efficiency of processing (the data is stored close to the point where it is most

frequently used) with increased accessibility (it is possible to access a Delhi information from Kolkata and vice versa, via the communication network), reliability and

availability and speedup of query processing.

Allowing the structure of the database to mirror the structure of the enterprise is probably the number one advantage of distributed systems. There are some

disadvantages too, of which the biggest is the fact that distributed systems are complex, software development cost, greater potential for bugs and increase processing

overhead.

As per commercial implementations, most of today’s relational products offer some kind of distributed database support. Some of the best known include,

(a) INRESS/STAR , from The ASK Group Inc.’s Ingress Division;

(b) the distributed database option of ORCALE8 or later from Oracle Corporation and

(c) the distributed data facility of DB2 from IBM.

It is worth pointing out that all of the systems listed above, both prototypes and products, are relational.

OBJECTIVES :

1. Local autonomy

2. No reliance on a central site

3. Continuous operation

4. Location independence

http://www.laynetworks.com/Relational%20Database%20Management%20Systems.htm (4 of 6)1/27/2011 1:26:32 PM


Airline Reservation System - RDBMS - Free Computer Science Tutorials - Provided by Laynetworks.com

5. Fragmentation independence

6. Replication independence

7. Distributed query processing

8. Distributed transactions management

9. Hardware independence

10. Operating system independence

11. Network independence

12. DBMS independence

These above twelve objectives are not all independent of one another, nor are they necessarily exhaustive, nor are they all equally significant. However, they are

useful as a basis for understanding distributed technology and as a framework for characterizing the functionality of specific distributed systems.

http://www.laynetworks.com/Relational%20Database%20Management%20Systems.htm (5 of 6)1/27/2011 1:26:32 PM


Airline Reservation System - RDBMS - Free Computer Science Tutorials - Provided by Laynetworks.com

http://www.laynetworks.com/Relational%20Database%20Management%20Systems.htm (6 of 6)1/27/2011 1:26:32 PM


Free Computer Science Tutorials - Provided by Laynetworks.com

Relational Database Management Systems

Airline Reservation System

CLIENT/SERVER SYSTEM :

A client/server system is a distributed systems in which,

(a) some sites are client sites and others are serer sites

(b) all data resides at the server sites

(c) all applications execute at the client sites

The term ‘client/server’ refers primarily to an architecture, or logical division of responsibilities , the client is the application (also known as the frontend), and the

server is the DBMS (also known as the backend).

A client/server system can be thought of as a distributed system in which all requests originate at one site and all processing is performed at another. In practice the

client site might well have its own local databases, but those databases will not play a direct part in the client/server arrangement as such.

Client/Server provides a low-priced robust solution to user requirements. This approach permits downsizing production subsystem while allowing the clients and servers

the necessary tools and facilitate to control, manage and tune the environment in which they operate.

Most client/server solution are also very attentive in matters of security. Access to any resources can be defines to the file level, with such access being controlled

through identification and authorization. Logically defined closed use groups can be setup to enable the enhancing of security measures by network administrations.

It allows the database management including security, performance, backup, server enforced integrity to be part of the database machine avoiding the requirement to

write large number of redundant piece of code dealing with database field validation and referential integrity.

The successful organizations have to be marked drives and competitive in the times to come, and they will use Client/Server computing as the enabling technology to

http://www.laynetworks.com/Airline%20Reservation%20System_RDBMS.htm (1 of 4)1/27/2011 1:27:33 PM


Free Computer Science Tutorials - Provided by Laynetworks.com

add values to their business. Powerful workstations will be available to all end users to be used as clients to access the information on the servers which are distributed

globally. The networks of the future will support much higher bandwidth by using technologies like corporate networks will cut across the boundaries of cities or even

countries and they will be connected to major networks around the worlds.

E-R DIAGRAM :

E-R Diagram constitute a technique for representing the logical structure of a database in a pictorial manner. This analysis is then used to organize data as a relation,

normalising relation and finally obtaining a relation database.

Entities : Which specify distinct real-world items in an application.

Properties (or): Which specify properties of an entity and relationships.

Attributes

Relationships : Which connect entities and represent meaningful dependencies between them.

http://www.laynetworks.com/Airline%20Reservation%20System_RDBMS.htm (2 of 4)1/27/2011 1:27:33 PM


Free Computer Science Tutorials - Provided by Laynetworks.com

NORMALIZATION :

The basic objective of normalization is to be reduce redundancy which means that information is to be stored only once. Storing information several times leads to

wastage of storage space and increase in the total size of the data stored.

If a Database is not properly designed it can gives rise to modification anomalies. Modification anomalies arise when data is added to, changed or deleted from a

database table. Similarly, in traditional databases as well as improperly designed relational databases, data redundancy can be a problem. These can be eliminated by

normalizing a database.

Normalization is the process of breaking down a table into smaller tables. So that each table deals with a single theme. There are three different kinds of modifications

of anomalies and formulated the first, second and third normal forms (3NF) is considered sufficient for most practical purposes. It should be considered only after a

through analysis and complete understanding of its implications.

FIRST NORMAL FORM (1NF) :

http://www.laynetworks.com/Airline%20Reservation%20System_RDBMS.htm (3 of 4)1/27/2011 1:27:33 PM


Free Computer Science Tutorials - Provided by Laynetworks.com

This form also called as a “flat file”. Each column should contain data in respect of a single attributes and no two rows may be identical.

To bring a table to First Normal Form, repeating groups of fields should be identified and moved to another table.

http://www.laynetworks.com/Airline%20Reservation%20System_RDBMS.htm (4 of 4)1/27/2011 1:27:33 PM


Airline Reservation System 2 - Free Computer Science Tutorials - Provided by Laynetworks.com

Airline Reservation System

SECOND NORMAL FORM (2NF) :

A relation is said to be in 2NF if it is 1NF and non-key attributes are functionality dependent on the key attributes. A ‘Functional Dependency’ is a relationship among

attributes. One attribute is said to be functionally dependent on another if the value of the first attribute depends on the value of the second attribute.

In the given description flight number and halt code is the composite key.

Splitting of relation given in table 1 into 2NF relations

FLIGHT DETAILS :

AR_FLIGHT_MST

FL_NO VARCHAR2(7) PRIMARY KEY

FL_NAME VARCHAR2(25) NOT NULL

ORG_CD NUMBER(3) NOT NULL

DES_CD NUMBER(3) NOT NULL

CAPACITY NUMBER(3) NOT NULL

http://www.laynetworks.com/Airline%20Reservation%20System2.htm (1 of 4)1/27/2011 1:28:20 PM


Airline Reservation System 2 - Free Computer Science Tutorials - Provided by Laynetworks.com

AR_FLIGHT_DET

FL_NO VARCHAR2(7) PRIMARY KEY (REFERENCE AR_FLIGHT_MST.FL_NO)

HALT_CD NUMBER(3) PRIMARY KEY

DIST_FRM_ORG NUMBER(3) -

NO_QUOTA NUMBER(3) -

NO_BOOKED NUMBER(3) -

JOUR_DATE - NOT NULL

THIRD NORMAL FORM (3NF) :

A Third Normal Form normalization will be needed where all attributes in a relation tuple are not functionally dependent only on the key attribute. A transitive

dependency is one in which one in which one attribute depends on second which is turned depends on a third and so on.

http://www.laynetworks.com/Airline%20Reservation%20System2.htm (2 of 4)1/27/2011 1:28:20 PM


Airline Reservation System 2 - Free Computer Science Tutorials - Provided by Laynetworks.com

FLIGHT DETAILS :

AR_FLIGHT_MST

FL_NO VARCHAR2(7) PRIMARY KEY

FL_NAME VARCHAR2(25) NOT NULL

ORG_CD NUMBER(3) NOT NULL

DES_CD NUMBER(3) NOT NULL

CAPACITY NUMBER(3) NOT NULL

AR_FLIGHT_DET

PRIMARY KEY (REFERENCE AR_FLIGHT_MST.


FL_NO VARCHAR2(7)
FL_NO)

HALT_CD NUMBER(3) PRIMARY KEY

DIST_FRM_ORG NUMBER(3) -

NO_QUOTA NUMBER(3) -

NO_BOOKED NUMBER(3 -

http://www.laynetworks.com/Airline%20Reservation%20System2.htm (3 of 4)1/27/2011 1:28:20 PM


Airline Reservation System 2 - Free Computer Science Tutorials - Provided by Laynetworks.com

JOUR_DATE - NOT NULL

AR_HALT_MST

HALT_CD NUMBER(3) PRIMARY KEY

DESCRIPTION VARCHAR2(30) NOT NULL

Cont...

http://www.laynetworks.com/Airline%20Reservation%20System2.htm (4 of 4)1/27/2011 1:28:20 PM


Airline Reservation System 3 - RDBMS - Free Computer Science Tutorials - Provided by Laynetworks.com

Airline Reservation System

DATA DICTIONARY :

FLIGHT DETAILS :

AR_FLIGHT_MST

FL_NO VARCHAR2(7) PRIMARY KEY

FL_NAME VARCHAR2(25) NOT NULL

ORG_CD NUMBER(3) NOT NULL

DES_CD NUMBER(3) NOT NULL

CAPACITY NUMBER(3) NOT NULL

AR_FLIGHT_DET

FL_NO VARCHAR2(7) PRIMARY KEY (REFERENCE AR_FLIGHT_MST.FL_NO)

HALT_CD NUMBER(3) PRIMARY KEY

DIST_FRM_ORG NUMBER(3)

NO_QUOTA NUMBER(3)

NO_BOOKED NUMBER(3)

JOUR_DATE NOT NULL

AR_HALT_MST

HALT_CD NUMBER(3) PRIMARY KEY

DESCRIPTION VARCHAR2(30) NOT NULL

CUSTOMER DETAILS :

AR_CUST_MST

http://www.laynetworks.com/Airline%20Reservation%20System3.htm (1 of 6)1/27/2011 1:28:52 PM


Airline Reservation System 3 - RDBMS - Free Computer Science Tutorials - Provided by Laynetworks.com

CITE_CODE VARCHAR2(3)

CUST_CODE VARCHAR2(6) PRIMARY KEY

NAME VARCHAR2(25) -

ADDRESS1 VARCHAR2(30) -

ADDRESS2 VARCHAR2(30) -

CITY VARCHAR2(25) -

PIN VARCHAR2(6) -

PH_MOBL_NO VARCHAR2(15) -

DIST_TRAVEL NUMBER(4) -

CON_PER_NAME VARCHAR2(25) NOT NULL

ADDRESS VARCHAR2(50) -

CITY VARCHAR2(25) -

RESERVATION DETAILS :

AR_RESERV_DET

CITE_CODE VARCHAR2(3) NOT NULL

CUST_CODE VARCHAR2(6) NOT NULL

FL_NO VARCHAR2(7) NOT NULL

ORG_CD NUMBER(3) NOT NULL

DES_CD NUMBER(3) NOT NULL

DIST_TRAVEL NUMBER(4)

BOOK_DATE DATE

TRAVEL_DATE DATE

STATUS CHAR(1)

http://www.laynetworks.com/Airline%20Reservation%20System3.htm (2 of 6)1/27/2011 1:28:52 PM


Airline Reservation System 3 - RDBMS - Free Computer Science Tutorials - Provided by Laynetworks.com

AR_CITE_MST

CITE_CODE VARCHAR2(3) PRIMARY KEY

CUST_NAME VARCHAR2(30) NOT NULL

SQL COMMANDS :

To develop the given application the below activities are followed in an order:

● Creation of Database

● Creation of Tables

● Creation of Database Triggers

● Creation of Stores Procedures

● Creation of Server Enforced validation checks

● Create of Indexes

● Creation of view

● Creation of synonyms

The following are some of the SQL commands used to implement this application :

http://www.laynetworks.com/Airline%20Reservation%20System3.htm (3 of 6)1/27/2011 1:28:52 PM


Airline Reservation System 3 - RDBMS - Free Computer Science Tutorials - Provided by Laynetworks.com

CREATION OF TABLES :

1. CREATE TABLE AR_FLIGHT_MST (FL_NO VARCHAR2(7), FL_NAME VARCHAR2(25), ORG_CD NUMBER(3),DES_CD NUMBER(3),CAPACITY NUMBER(3));

2. CREATE TABLE AR_FLIGHT_DET (FL_NO VARCHAR2(7),HALT_CD NUMBER(3), DIST_FRM_ORG NUMBER(3),NO_QUOTA NUMBER(3),NO_BOOKED NUMBER(3),

JOUR_DATE DATE);

3. CREATE TABLE AR_HALT_MST (HALT_CD NUMBER(3),DESCRIPTION VARCHAR2(30));

4. CREATE TABLE AR_CUST_MST (CITE_CODE VARCHAR(3),CUST_CD VARCHAR2(6),NAME VARCHAR2(25), ADDRESS1 VARCHAR2(30),ADDRESS2 VARCHAR2(30),CITY

VARCHAR2(25),PIN VARCHAR2(6),PH_MOBL_NO ARCHAR2(15),DIST_TRAVEL NUMBER(4),CON_PER_NAME VARCHAR2(25),ADDRESS VARCHAR2(50), CITY VARCHAR2

(25));

5. CREATE TABLE AR_RESERV_DET (CITE_CODE VARCHAR2(3), CUST_CODE VARCHAR2(6), FL_NO VARCHAR2(7), ORG_CD NUMBER(3), DES_CD NUMBER(3),

DIST_TRAVEL NUMBER(4),BOOK_DATE DATE,TRAVEL_DATE DATE, STATUS CHAR(1));

6. CREATE TABLE AR_CITE_DET (CITE CODE VARCHAR2(3),CITE_NAME VARCHAR2(30));

SELECT COMMANDS :

http://www.laynetworks.com/Airline%20Reservation%20System3.htm (4 of 6)1/27/2011 1:28:52 PM


Airline Reservation System 3 - RDBMS - Free Computer Science Tutorials - Provided by Laynetworks.com

1. To know the information of flight-wise originating and destination terminals

SELECT FL_NO,FL_NAME, ORG_CD,DES_CD FROM AR_FLIGHT_MST ;

2. To get the flight, date wise available seats

SELECT FL_NO,FL_NAME,JOUR_DATE (NO_QUOTA-NO_BOOKED)

AVAILABLE FROM AR_FLIGHT_DET ORDER BY FL_NO;

3. To count the number of flights

SELECT COUNT(FL_NO) FROM AR_FLIGHT_MST;

4. To find the halt code and names in alphabetic order

SELECT HALT_CD,DESCRIPTION FROM AR_HALT_MAST ORDER BY DESCRIPTION;

5. To find out the details of seats available by filght,halt wise

SELECT FL_NO,HALT_CD,JOUR_DATE,NO_QUOTA,NVL(NO_QUOTA-NO_BOOKED) FROM AR_FLIGHT_DET GROUP BY FL_NO,HALT_CD;

6. To find out the details of seats available by halt wise,filght

SELECT HALT_CD,FL_NO, JOUR_DATE,NO_QUOTA,NVL(NO_QUOTA-NO_BOOKED) FROM AR_FLIGHT_DET GROUP BY HALT_CD, FL_NO

7. To list the customers and their information

SELECT CUST_CODE,NAME,CITY,PH_MOBL_NO FROM AR_CUSTOMER;

8. city wise reservation(transaction) details

SELECT E.CITE_NAME,D.NAME,B.FL_NAME,A.ORG_CD,A.DESC_CD,C.DESCRIPTION, A.DIST_TRAVLE,A.BOOK_DATE,A.TRAVEL_DATE FROM AR_RESRV_DET A,

AR_FLIGHT_MST B,AR_HALT_MST C,AR_CUST_MST D,AR_CITE_MST E WHERE A.CITE_CODE=E.CITE_CODE AND A.CUST_CODE=D.CUST_CODE AND (A.ORG_CD=C.

HALT_CD OR A.DES_CD=C.HALT_CD) AND A.FL_NO=B.FL_NO

http://www.laynetworks.com/Airline%20Reservation%20System3.htm (5 of 6)1/27/2011 1:28:52 PM


Airline Reservation System 3 - RDBMS - Free Computer Science Tutorials - Provided by Laynetworks.com

GROUP BY E.CITE_NAME,B.FL_NAME;

http://www.laynetworks.com/Airline%20Reservation%20System3.htm (6 of 6)1/27/2011 1:28:52 PM

Anda mungkin juga menyukai