Professional Documents
Culture Documents
Project description:
Each flight has a limited number of available seats. There are number
of flights that go from/to different cities at different dates and time.
The system shall maintain a table for the list of available flights
where each row within the table has the following fields: Flight
number,
Departure city, Destination City, Departure date, Departure time,
Arrival date, Arrival Time, Capacity, and Available seats.
The System shall maintain a table for the customers where each row
within the table has the following fields: Confirmation number,
Customer Name, Customer Address, and Departure Flight Number.
The values within this table will be created when the user makes a
reservation.
Requirements:
Draw relationship between entities using Edraw Max , then
Create tables using oracle,. After that write 10 SQL statements
to perform these queries.
The ERD
Create tables using oracle
select count(confirmationNumber)
from customer, flight
where customer.flightNumber = flight.flightNumber
and flight.departureCity = 'KSA'
and flight.arrivalDate between sysdate -7 and sysdate;
2. Display customer name who is registered for two flights last
month.
select customerName
from customer, flight
where customer.flightNumber = flight.flightNumber
and flight.arrivalDate between add_months( sysdate , -1 ) and
sysdate
group by customerName
having count(confirmationNumber) = 2;
select count(flightNumber)
from flight
where departureCity = 'UK'
and arrivalDate = sysdate;
select count(confirmationNumber)
from customer, flight
where customer.flightNumber = flight.flightNumber
and flight.arrivalDate = sysdate - 1;
5. Display the arrival date for the last flight that is coming
from USA
select max(arrivalDate)
from flight
where departureCity = 'USA';
6. Display the nearest flight’s departure date that have two
Seats together for Australia ? يريد تاريخ وموعد أول طائرة متجهة
الستراليا وبها كرسيين لم يتم حجزهم
select max(arrivalDate)
from flight
where departureCity = 'Australia'
and availableSeats >= 2;
select *
from flight
where departureDate = sysdate;
8. display flights that are less than half full and its departure
date before three days. ايام وعدد3 اذكر الرحالت التي موعد أقالعها بعد
الكراسي المحجوزة بها أقل من النصف
select *
from flight
where departureDate = sysdate + 3
and availableSeats > (capacity / 2);
9. for each flight display customer name, total number of seats
he is reserves. اذكر اسم العميل ورقم الرحلة وعدد الكراسي التي قام بحجزها
في هذه الرحلة