Assignment - BAIT 2B G4
Assignment - BAIT 2B G4
1. Each group is assigned to a unique task. The task is to write a report answering a set of questions of a specific case study assigned below. Groups were
assigned according to the registered student list retrieved from the system.
2. Plagiarism will be checked using a plagiarism-checking tool and if it is confirmed that you have copied any part of your work, you will be awarded a zero
(0%) score out of 10% of your total coursework score.
3. You are not required to use any generative AI tool including ChatGPT. The use of these tools will be checked using a generative AI content check tool. If
it is confirmed that you have used any of the tools to create your content, a zero (0%) score out of 10% of your total CW score will be awarded.
4. A cover page should contain all important details including the title of the case study, group number and a list of group members who actively
participated.
5. The second page should include roles played by each group member in the task. Each member should sign to agree to his/her participation.
6. Unless it is a cover page, all pages in a report should be written in font style “Times New Roman”, font size 12, “justify” text alignment and 1.15 spacing.
7. All reports (in hard copies) should be physically submitted at IFM main campus, block A office number 517 on Wednesday, February 5th 2025 at 16:50.
All group members should come and sign the register at the time of submission. Any report received after this deadline will not be marked and will be
considered an incomplete case.
Page 1 of 5
TUTORIAL GROUP: BAIT 2B GROUP 4
Page 2 of 5
Table Schema: 2. Write an SQL query to find all students who are Irene Alex Kaiza IMC/BAIT/2315598
UNIVERSITY enrolled in a university located in the same city as Pili Haruna Mustafa IMC/BAIT/2315816
university_id (INT) their residence. Gladness Nassar Lingasiku IMC/BAIT/2316288
university_name (VARCHAR) 3. Write an SQL command to list all students along with Mwajuma Ramadhani IMC/BAIT/2316547
city (VARCHAR) their university names, ensuring proper matching via Matongodi IMC/BAIT/2317062
country (VARCHAR) university_id. Hawa Hashimu Mollel IMC/BAIT/2320716
contact_name (VARCHAR) 4. Write an SQL query to count the number of students Shazilu Karimu Selemani
phone (VARCHAR) enrolled in each course across all universities.
email (VARCHAR) 5. Write an SQL command to find the university with
total_students (INT) the highest number of enrolled students.
6. Write an SQL query to retrieve all students whose
STUDENT email addresses contain "edu" in their contact_email.
student_id (INT) 7. Write an SQL command to update the phone number
student_name (VARCHAR) of a university whose university_id is 10.
university_id (INT) 8. Write an SQL query to delete all student records
city (VARCHAR) where the course_enrolled field is NULL.
country (VARCHAR) 9. Write an SQL command to list all universities along
contact_email (VARCHAR) with the number of students they have, but only for
phone (VARCHAR) universities with more than 5000 students.
course_enrolled (VARCHAR) 10. Write an SQL query to rename the STUDENT table to
ENROLLMENT_RECORDS.
CASE STUDY 3 GROUP 3
Library and Book Inventory Management System 1. List all libraries located in a specific city (e.g., "New John Maneno Peter IMC/BAIT/2320880
Consider two sample tables named LIBRARY and BOOK, York") along with their manager's name and email. Fredrick Francis Dotto IMC/BAIT/2321368
each with 8 columns. 2. Find the total number of books available in each John Yusuph Hamin IMC/BAIT/2321528
library, sorted in descending order of the total count. Milton Mchina Masanja IMC/BAIT/2321718
Table Schema: 3. Retrieve the titles and authors of all books published Gasper Peter Chege IMC/BAIT/2322020
LIBRARY in the year 2020. Kelvin Lugendo Khalfan IMC/BAIT/2322172
library_id (INT) 4. Display the names of libraries that have more than Henry P Mobe IMC/BAIT/2322349
library_name (VARCHAR) 10,000 books in their inventory. Davidi Leonard Msangi IMC/BAIT/2322639
city (VARCHAR) 5. List all books that belong to the "Science Fiction" Walter Benjamini Nzogu IMC/BAIT/2322820
country (VARCHAR) genre and are currently available. Herman Bernard Sotel IMC/BAIT/2322947
manager_name (VARCHAR) 6. Find the library with the highest number of books and
phone (VARCHAR) display its name, city, and total number of books.
email (VARCHAR) 7. Retrieve the titles of books written by a specific
total_books (INT) author (e.g., "J.K. Rowling") and the libraries where
they are available.
BOOK 8. Calculate the average number of books per library
book_id (INT) across all libraries in the database.
title (VARCHAR) 9.
Page 3 of 5
author (VARCHAR) 10. List all libraries that do not have any books in the
publication_year (YEAR) "Mystery" genre.
genre (VARCHAR) 11. Find the oldest book in the database (based on
library_id (INT) publication year) and display its title, author, and
isbn (VARCHAR) library name.
availability_status (VARCHAR)
CASE STUDY 4 GROUP 4
Airline and Flight Management System 1. Write an SQL query to find the total number of flights Alex Mshingwa Robert IMC/BAIT/2323023
Consider two sample tables named AIRLINE and FLIGHT, operated by each airline, sorted in descending order. Godlove J Mbelle IMC/BAIT/2323082
each with 8 columns. 2. Write an SQL command to retrieve all flights that Peter W Shimba IMC/BAIT/2323198
have a departure time between 6:00 AM and 12:00 Abdulwahab A Saghire IMC/BAIT/2323318
Table Schema: PM. Festo Arsenius Ndege IMC/BAIT/2323561
AIRLINE 3. Write an SQL query to find the average flight duration Hans Evarist Momburi IMC/BAIT/2323732
airline_id (INT) for each airline. Ismail S Masoud IMC/BAIT/2323855
airline_name (VARCHAR) 4. Write an SQL command to list all flights where the Zacharia Mkumbo IMC/BAIT/2324008
country (VARCHAR) arrival city is the same as the departure city (loop Regan Richard Mushi IMC/BAIT/2324240
headquarters (VARCHAR) flights). Muntadhiru Jafari Mnali IMC/BAIT/2324325
contact_name (VARCHAR) 5. Write an SQL query to count the number of flights
phone (VARCHAR) departing from each city.
email (VARCHAR) 6. Write an SQL command to find the airline(s) that
total_flights (INT) operate flights in the highest number of unique
departure cities.
FLIGHT 7. Write an SQL query to retrieve the top 5 most
flight_id (INT) frequently used arrival cities in the FLIGHT table.
flight_number (VARCHAR) 8. Write an SQL command to delete all flights that have
airline_id (INT) an arrival time that is more than 24 hours later than
departure_city (VARCHAR) the departure time.
arrival_city (VARCHAR) 9. Write an SQL query to find flights that have no
departure_time (DATETIME) assigned airline (where airline_id is NULL).
arrival_time (DATETIME) 10. Write an SQL command to rename the AIRLINE table
status (VARCHAR) to CARRIER_INFORMATION.
CASE STUDY 5 GROUP 5
Hotel and Guest Reservation System 1. Write an SQL query to find the total number of Gidion Boniphace Yunge IMC/BAIT/2324397
Consider two sample tables named HOTEL and reservations made for each hotel, sorted in Michael Antony Maganga IMC/BAIT/2324473
RESERVATION, each with 8 columns. descending order. Ernest Gabriel Ndenza IMC/BAIT/2324556
2. Write an SQL command to retrieve all reservations Damian Damas Kisheke IMC/BAIT/2324940
Table Schema: with a check-in date in the next 7 days. Nickson Nicodemas Mjwauzi IMC/BAIT/2325152
HOTEL 3. Write an SQL query to list all reservations along with Robinson Shabu Nkenja IMC/BAIT/2325350
hotel_id (INT) their corresponding hotel names, ensuring proper Ibrahim S Mkenda IMC/BAIT/2325467
hotel_name (VARCHAR) matching via hotel_id. Mohamed Hassan Honi IMC/BAIT/2325760
Page 4 of 5
city (VARCHAR) 4. Write an SQL command to find the hotels that have Ismail Rajabu Shaban IMC/BAIT/2325987
country (VARCHAR) the highest number of available rooms (i.e., Boniface Josephat Valyamba IMC/BAIT/2326716
manager_name (VARCHAR) total_rooms - booked rooms). Deus Hamis Maganga IMC/BAIT/2326817
phone (VARCHAR) 5. Write an SQL query to retrieve the average Elvin Regnald Kayombo IMC/BAIT/2327016
email (VARCHAR) total_price for reservations in each hotel. David Kianga Mvungi IMC/BAIT/2327199
total_rooms (INT) 6. Write an SQL command to list all guests who have
made more than three reservations.
RESERVATION 7. Write an SQL query to count the number of
reservation_id (INT) reservations made in each city and display them in
guest_name (VARCHAR) descending order.
hotel_id (INT) 8. Write an SQL command to delete all reservations
check_in_date (DATE) where the check-out date was more than one year
check_out_date (DATE) ago.
room_number (VARCHAR) 9. Write an SQL query to find all hotels that have no
total_price (DECIMAL) reservations (i.e., no entries in the RESERVATION
status (VARCHAR) table for their hotel_id).
10. Write an SQL command to rename the RESERVATION
table to BOOKING_HISTORY.
Page 5 of 5