0% found this document useful (0 votes)
6 views

Midterm Database

Uploaded by

dxnvmk2pvw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Midterm Database

Uploaded by

dxnvmk2pvw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Midterm Database Management Systems

• Creating a detailed report with screenshots of the code and


task results
• Upload the report to moodle

Variant 1: Airport and Passenger Management

Task 1a: Create a Table for Airports

Objective: Design a table to store airport information with appropriate data types
and constraints.
Columns: airport_id (integer), airport_name (string), country (string), state (string),
city (string), created_at (timestamp), updated_at (timestamp).
Requirements: Use appropriate data types, set airport_id as a primary key, and
ensure that timestamps for creation and update are managed automatically.

Task 2a: Insert Data into the Passengers Table

Objective: Populate the passengers table with diverse entries to reflect a variety of
passengers.
Data Points: Include first name, last name, gender, date of birth, citizenship,
residence, and passport number.
Challenge: Insert at least 2 records with varying data, ensuring the inclusion of
diEerent nationalities and age groups.

Task 3a: Update Passenger Information in the Passengers Table

Objective: Modify existing entries to reflect changes such as name changes or


updates in residency.
Scenario: Update the last name and country of residence for specific passengers
identified by passport number.

Task 4a: Delete a Passenger from the Passengers Table

Objective: Remove records from the database based on specific conditions.


Condition: Delete passengers who have not updated their information in the last 5
years.
Requirement: Use a conditional statement based on the updated_at timestamp.

Task 5a: Retrieve All Passengers with Their Corresponding Baggage Information
(using dump file)
Objective: Use an INNER JOIN to display joined data from the passengers and
baggage tables.
Details: Show all columns from both tables where records exist in both.

Task 6a: List All Passengers and Any Baggage They Might Have Checked In
(using dump file)

Objective: Implement a LEFT JOIN to show all passengers and their baggage,
including those without any baggage.
Output: Include null values where no baggage is associated.

Task 7a: List All Baggage and the Passengers Associated with Them (using dump
file)

Objective: Use a RIGHT JOIN to display all baggage and link each to a passenger if
available.
Challenge: Display passenger details for each piece of baggage, even if no
passenger data is linked.

Task 8a: Combine Passenger Information with Their Baggage, Showing All
Records(using dump file)

Objective: Use a FULL OUTER JOIN to create a comprehensive list of all passengers
and baggage records.
Complexity: Handle cases where there are passengers without baggage and
baggage without registered passengers.

Task 9a: Create an Index on the Country of Residence in the Passengers


Table(using dump file)

Objective: Improve query performance for searches based on the country of


residence.
Requirement: Create an index on the country_of_residence column to facilitate
faster searches.a
Variant 2: Flight and Airline Management

Task 1b: Create a Table for Flights


Objective: Establish a table to manage flight information with the necessary fields
and relationships.
Columns: Include identifiers for flights, gates, airlines, airports, and timestamps
for scheduled and actual departure/arrival.
Requirements: Ensure foreign keys link to airlines and airports correctly.

Task 2b: Add a Flight Record into the Flights Table

Objective: Insert data representing a new flight, including all necessary details.
Data Points: Flight ID, departing and arriving gates, linked airline, and timestamps.
Challenge: Ensure that the data adheres to the constraints set by foreign keys and
scheduled times.

Task 3b: Change a Flight’s Scheduled Departure Time


Objective: Update the departure time for a specified flight.
Scenario: Modify the scheduled departure time based on operational requirements
or delays.

Task 4b: Remove a Flight from the Flights Table

Objective: Delete a flight entry based on specific operational criteria, such as


cancellation.
Condition: Use a condition based on flight status or departure dates.

Task 5b: List All Flights Along with Airline Names(using dump file)

Objective: Use an INNER JOIN to correlate flights with their respective airlines.
Details: Display flight details alongside the airline names.

Task 6b: Show All Flights, Including Those Without a Registered Airline(using
dump file)

Objective: Implement a LEFT JOIN to list all flights, ensuring those without a linked
airline are included.
Output: Display flights with null values for airlines where applicable.

Task 7b: Display All Airlines and Their Flights(using dump file)

Objective: Use a RIGHT JOIN to show all airlines and their associated flights.
Challenge: Ensure all airlines are listed, even those without current flights.

Task 8b: Merge Details of Flights with Airlines, Showing All Records(using dump
file)
Objective: Use a FULL OUTER JOIN to display a complete set of records from both
flights and airlines.

Complexity: Handle mismatches where flights might not have an airline and vice
versa.

Task 9b: Index the Departure and Arrival Gates in the Flights Table(using dump
file)

Objective: Enhance query performance for operations involving gate information.


Requirement: Create indexes on the departing_gate and arriving_gate columns.
Variant 3: Baggage and Security Management

Task 1c: Define a Table for Baggage

Objective: Create a table to store baggage details linked to bookings and


passengers.
Columns: Baggage ID, weight, booking ID, and timestamps.
Requirements: Include foreign keys to link baggage to bookings.

Task 2c: Enter Baggage Information into the Baggage Table

Objective: Populate the table with details of baggage checked in for various flights.
Data Points: Include baggage weight and associated booking ID.
Challenge: Ensure all entries are valid and comply with airline baggage policies.

Task 3c: Update the Weight of Baggage

Objective: Modify records to adjust the reported weight of baggage as might be


needed after re-checking.
Scenario: Update the weight based on additional items added or removed post
initial check-in.

Task 4c: Delete Baggage Information from the Baggage Table

Objective: Remove records for baggage that was withdrawn or not loaded onto the
flight.
Condition: Specify conditions such as baggage not linked to any current booking.

Task 5c: Display All Security Checks Along with Passenger Details(using dump
file)

Objective: Use an INNER JOIN to associate security check results with


corresponding passenger information.
Details: Show comprehensive security and passenger details together.

Task 6c: Display All Passengers, Including Those Without a Security


Check(using dump file)

Objective: Implement a LEFT JOIN to list all passengers, showing those without a
security check record as well.
Output: Include null values for security check details where no checks have been
performed.

Task 7c: Show All Security Checks and Related Passenger Information(using
dump file)
Objective: Use a RIGHT JOIN to ensure all security checks are listed along with
linked passenger data.

Challenge: Display all security check records, filling in passenger details where
available.

Task 8c: Connect Security Checks with Passengers, Displaying All


Results(using dump file)

Objective: Use a FULL OUTER JOIN to show a comprehensive list including all
security checks and passenger records.
Complexity: Handle cases where there may be security checks or passengers
listed without corresponding matches.

Task 9c: Set Up an Index for Baggage Weights(using dump file)

Objective: Improve search and query performance related to baggage weight.


Requirement: Create an index on the weight_in_kg column.
Variant 4: Security Checks and Booking Management
Task 1d: Define a Table for Security_Check

Objective: Establish a table to manage security check records with detailed fields.

Columns: Security check ID, check result, related passenger ID, and timestamps.
Requirements: Include a foreign key to link to passengers, ensuring relational
integrity.

Task 2d: Insert a Security Check Record with Results

Objective: Populate the security check table with new entries reflecting the
outcomes of checks.

Data Points: Include the result of the security check and the associated passenger
ID.
Challenge: Ensure that all records are linked correctly to existing passenger
records.

Task 3d: Modify the Result of a Security Check

Objective: Update records in the security check table to reflect changes in the
security status or error corrections.
Scenario: Amend entries where initial results were recorded incorrectly.

Task 4d: Remove a Record from the Security_Check Table

Objective: Delete entries based on specific criteria such as outdated or


superseded security checks.
Condition: Specify conditions based on the age of the record or updates in security
policy.

Task 5d: Show Bookings and Their Corresponding Flight Details(using dump
file)

Objective: Use an INNER JOIN to display detailed information linking bookings with
flights.
Details: Present complete booking details alongside the respective flight
information.

Task 6d: Show All Bookings, Including Ones Without Flight Details(using dump
file)

Objective: Implement a LEFT JOIN to list all bookings, accounting for those without
associated flight details.
Output: Display all booking records with null values for any missing flight data.
Task 7d: Show All Flight Details and Associated Bookings(using dump file)

Objective: Use a RIGHT JOIN to ensure all flight records are shown along with any
linked bookings.
Challenge: Display all flights, particularly focusing on those with associated
booking details.

Task 8d: Link Bookings with Flights, Showing All Combinations(using dump file)

Objective: Use a FULL OUTER JOIN to compile a comprehensive listing of all


bookings and flight records.
Complexity: Manage entries where there may be bookings without flights and
flights without bookings.

Task 9d: Create an Index on the Check Results in the Security_Check


Table(using dump file)

Objective: Enhance the performance of queries filtering by security check results.


Requirement: Index the check_result column to speed up searches and reporting
based on security outcomes.

You might also like