CME 3201 Database Management Systems: Dokuz Eylul University Engineering Faculty Department of Computer Engineering
CME 3201 Database Management Systems: Dokuz Eylul University Engineering Faculty Department of Computer Engineering
ENGINEERING FACULTY
DEPARTMENT OF COMPUTER ENGINEERING
CME 3201
DATABASE MANAGEMENT SYSTEMS
YODA AIRLINES
PROJECT FINAL REPORT
by
FİLİZ DEVRİM YILMAZ - 2015510069
EZGİ BERFİN ŞAHİN - 2016510089
December, 2018
İZMİR
TABLE OF CONTENTS
1. Problem Description
2. Solution System & Operation List
3. System Constraints
4. ER Diagram
5. Database Schema
6. Relational Algebra
7. SQL Statements
8. Interface Screenshots of Main Operations
9. Additional Properties
10. Used Technology, Tools & Challenges
1)PROBLEM DESCRIPTION
Every year millions of flights are made from one of the World’s 41,820
airports to another one. These days you don’t have to visit travel agent’s offices
in order to buy plane tickets. Many airline companies sell their plane tickets
online from their own websites. So we wanted to create a website for a airline
company named ‘YODA Airlines’. In this project we took examples from
websites of Turkish Airlines and Pegasus which are both famous airline
companies from Turkey. Airline Reservation System is a system that users can
book their flights online for their travels. The system incorporate airline
schedules, passenger reservations and ticket records.
3)SYSTEM CONSTRAINTS
Each user has their own tickets which contains all offered flights for a
particular city-pair with their available seats in the different booking classes.
Users can book for future flights maximum 1 year away from the booking
date.Users have a right for cancellation of the flight but the airline has a
right to not accept this request unless it is more than 2 hours from the flight
time.Users
must check-in online or from the airline counters maximum 30 minutes from the
flight time.
4)ER DIAGRAM
5)DATABASE SCHEMA
Primary Keys
USER_INFORMATION UId, PAYMENT_INFORMATION PId,
FLIGHT FId, AIRPLANE AId, TICKET TId, STAFF SId,
FLIGHT_CLASS FId, SEAT SId, PASSENGER PId
Foreign Keys
SEAT AId from AIRPLANE
PILOT FId from FLIGHT
SId from STAFF
FLIGHT AId from AIRPLANE
TICKET SId from SEAT
FId from FLIGHT
PId from PASSENGER
FId from FLIGHT_CLASS
FLIGHT_ATTENDANT FId from FLIGHT
SId from STAFF
PAYMENT_INFORMATION UId from USER_INFORMATION
6)RELATIONAL ALGEBRA
Query1
ALTER PROCEDURE [dbo].[SP_GetFlightsBySelection] @selectedCityFrom
NVARCHAR(50), @selectedCityTo NVARCHAR(50), @selectedDate
VARCHAR(10)
AS
SELECT [dbo].[FLIGHT].DFrom AS DEPARTURE, [dbo].
[FLIGHT].DWhere AS ARRIVAL, [dbo].[AIRPLANE].Model AS
AIRPLANE,
CONVERT(VARCHAR(10),[dbo].[FLIGHT].Date,3) AS DATE,
CONVERT(VARCHAR(10),[dbo].[FLIGHT].Date,8) AS TIME
FROM [dbo].[FLIGHT] JOIN [dbo].[AIRPLANE] ON [dbo].
[FLIGHT].AId = [dbo].[AIRPLANE].AId
WHERE @selectedCityFrom = [dbo].[FLIGHT].DFrom AND
@selectedCityTo = [dbo].[FLIGHT].DWhere AND @selectedDate =
CONVERT(VARCHAR(10),[dbo].[FLIGHT].Date,3)
∏(DFrom,DWhere,Model,DATE,TIME)
(@selectedCityFrom = DFrom AND @selectedCityTo = DWhere AND
@selectedDate = DATE)(FLIGHT.AId I><I AIRPLANE.AId)
Query2
USE [YodaAirlines]
GO
/****** Object: StoredProcedure [dbo].[SP_GetRoundTripToByFrom] Script
Date: 12/25/2018 8:07:23 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SP_GetRoundTripToByFrom] @selectedFrom
NVARCHAR(50)
AS
SELECT DISTINCT F.DWhere
FROM [dbo].[FLIGHT] AS F, [dbo].FLIGHT AS P
WHERE F.DFrom = P.DWhere AND F.DWhere = P.DFrom AND
F.Date < P.Date AND F.DFrom = @selectedFrom
7)SQL STATEMENTS
//inserting into USER INFORMATION table
INSERT INTO [dbo].[USER_INFORMATION]([NationalId],[UName],
[USurname],[Gender],[Nationality],[Language],[Profession],[DateOfBirth],
[Phone],[Email],[Password])
VALUES (23, 'Yoda', '-', 'Erkek', 'Tekir', 'Türkçe', 'Kedi', '2018-08-15',
'0xxxxxxxxxx', 'xxx@xxx', 'kediyimben')
//Stored Procedures
USE [YodaAirlines]
GO
/****** Object: StoredProcedure [dbo].[SP_DeleteById] Script Date:
12/25/2018 8:05:50 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[SP_DeleteById] @Id int
as
delete from [dbo].[USER_INFORMATION] where [dbo].
[USER_INFORMATION].UId = @Id
USE [YodaAirlines]
GO
/****** Object: StoredProcedure [dbo].[SP_GetFlightDateByFromWhere]
Script Date: 12/25/2018 8:06:25 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SP_GetFlightDateByFromWhere]
@selectedFrom NVARCHAR(50), @selectedWhere NVARCHAR(50)
AS
SELECT CONVERT(VARCHAR(10),[dbo].[FLIGHT].Date,3)
FROM [dbo].[FLIGHT]
WHERE [dbo].[FLIGHT].DFrom = @selectedFrom AND [dbo].
[FLIGHT].DWhere = @selectedWhere
GROUP BY [dbo].[FLIGHT].Date
ORDER BY [dbo].[FLIGHT].Date ASC
USE [YodaAirlines]
GO
/****** Object: StoredProcedure [dbo].[SP_GetFlightsBySelection] Script
Date: 12/25/2018 8:06:37 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
USE [YodaAirlines]
GO
/****** Object: StoredProcedure [dbo].[SP_GetReturnFligthsBySelection]
Script Date: 12/25/2018 8:07:00 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SP_GetReturnFligthsBySelection]
@selectedFrom NVARCHAR(50), @selectedTo NVARCHAR(50),
@selectedDate NVARCHAR(50)
AS
SELECT * FROM [dbo].[ReturnFlights] AS WR
WHERE WR.DEPARTURE = @selectedFrom AND WR.ARRIVAL =
@selectedTo AND WR.DATE = @selectedDate
USE [YodaAirlines]
GO
/****** Object: StoredProcedure [dbo].[SP_GetRoundTripFrom] Script Date:
12/25/2018 8:07:09 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SP_GetRoundTripFrom]
AS
SELECT DISTINCT F.DFrom FROM [dbo].[FLIGHT] AS F,
[dbo].FLIGHT AS P
WHERE F.DFrom = P.DWhere AND F.DWhere = P.DFrom AND
F.Date < P.Date
USE [YodaAirlines]
GO
/****** Object: StoredProcedure [dbo].[SP_GetToByFrom] Script Date:
12/25/2018 8:07:43 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SP_GetToByFrom] @selectedFrom
NVARCHAR(50)
AS
SELECT DISTINCT F.DWhere
FROM [dbo].[FLIGHT] AS F JOIN [dbo].[FLIGHT] AS P ON F.AId =
P.AId
WHERE F.DFrom = @selectedFrom
USE [YodaAirlines]
GO
/****** Object: StoredProcedure [dbo].[SP_GetUserByID] Script Date:
12/25/2018 8:07:55 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SP_GetUserByID] @ID int
AS
SELECT [dbo].[USER_INFORMATION].UId as UId, [dbo].
[USER_INFORMATION].NationalId as UNId, [dbo].
[USER_INFORMATION].UName as UName, [dbo].
[USER_INFORMATION].USurname as USurname, [dbo].
[USER_INFORMATION].Gender as UGender, [dbo].
[USER_INFORMATION].Nationality as UNationality, [dbo].
[USER_INFORMATION].Language as ULanguage, [dbo].
[USER_INFORMATION].Profession as UProfession, [dbo].
[USER_INFORMATION].DateOfBirth as UDateOfBirth, [dbo].
[USER_INFORMATION].Phone as UPhone, [dbo].
[USER_INFORMATION].Email as UEmail, [dbo].
[USER_INFORMATION].Password as UPassword
from [dbo].[USER_INFORMATION]
WHERE UId = @ID
USE [YodaAirlines]
GO
/****** Object: StoredProcedure [dbo].[SP_UserAdd] Script Date:
12/25/2018 8:08:07 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SP_UserAdd] (@UName nvarchar(50) = null,
@USurname nvarchar(50) = null, @Gender nvarchar(50) = null, @NationalId
int = null, @Nationality nvarchar(50) = null, @Language nvarchar(50) = null,
@Profession nvarchar(50) = null, @DateOfBirth date = null, @Email
nvarchar(50) = null, @Phone nvarchar(50) = null, @Password nvarchar(50) =
null)
AS
begin
INSERT INTO [dbo].[USER_INFORMATION]([NationalId],[UName],
[USurname],[Gender],[Nationality],[Language],[Profession],[DateOfBirth],
[Phone],[Email],[Password])
VALUES (@NationalId, @UName, @USurname, @Gender, @Nationality,
@Language, @Profession, @DateOfBirth, @Phone, @Email, @Password)
end
USE [YodaAirlines]
GO
/****** Object: StoredProcedure [dbo].[SP_GetRoundTripToByFrom] Script
Date: 12/25/2018 8:07:23 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SP_GetRoundTripToByFrom] @selectedFrom
NVARCHAR(50)
AS
SELECT DISTINCT F.DWhere FROM [dbo].[FLIGHT] AS F,
[dbo].FLIGHT AS P
WHERE F.DFrom = P.DWhere AND F.DWhere = P.DFrom AND
F.Date < P.Date AND F.DFrom = @selectedFrom
USE [YodaAirlines]
GO
/****** Object: StoredProcedure [dbo].[spSelectUsers] Script Date:
12/25/2018 8:08:16 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
//Views
USE [YodaAirlines]
GO
SET QUOTED_IDENTIFIER ON
GO
USE [YodaAirlines]
GO