Task:
Step 1: Register to DB Designer
Step 2: Start Creating database model with the below table structure. Entities:
- Passenger:
- Attributes: PassengerID (Primary Key), FirstName, LastName, Email, Phone
- Flight:
- Attributes: FlightID (Primary Key), FlightNumber, DepartureAirport, ArrivalAirport, DepartureDateTime, ArrivalDateTime, TotalSeats
- Reservation:
- Attributes: ReservationID (Primary Key), PassengerID (Foreign Key references Passenger), FlightID (Foreign Key references Flight), ReservationDateTime
- Seat:
- Attributes: SeatID (Primary Key), FlightID (Foreign Key references Flight), SeatNumber, IsOccupied
In this model:
PassengerIDis the primary key for the Passenger entity.FlightIDis the primary key for the Flight entity.ReservationIDis the primary key for the Reservation entity.SeatIDis the primary key for the Seat entity.
Foreign keys establish relationships between entities:
- In the Reservation entity,
PassengerIDis a foreign key referencing the Passenger entity, andFlightIDis a foreign key referencing the Flight entity. - In the Seat entity,
FlightIDis a foreign key referencing the Flight entity.
This design allows you to associate passengers with reservations, flights with reservations, and seats with flights.
Take Quiz: With the above case now give below questions a try, can these query be solved or not ????
