University of Computer Studies (Taungoo)
Second Year Computer Science & Technology
Database System Concepts (CST-2124)
Tutorial -1 (Second Year Section (A)) Date 9-1-2025
Users (user_id, user_name, email, password, profile_picture, bio, privacy_setting)
Posts (post_id, user_id, content, timestamp, visibility)
Likes ( like_id, user_id, post_id, timestamp, reaction_type)
Comments (comment_id, user_id, post_id, content, timestamp, replies)
Messages (message_id, sender_id, receiver_id, content, timestamp, read_status)
Friendships (friendship_id, first_user_id, second_user_id, status, timestamp)
Notification (notification_id, user_id, type, source_id, timestamp)
Media (media_id, user_id, file_type, file_url, timestamp)
Activity_logs (log_id, user_id, actionType, timestamp)
Figure 1: Social media database
1. Consider the social media database of Figure1. Assume that the ID number uniquely identify in each
table. What are the appropriate primary key and foreign key? (5 mark)
2. Construct a schema diagram for the social media database of Figure1. (5 mark)
3. Write down the expression with the relational algebra by considering the following Flight_booking
database. (15 mark)
Passenger ( pid, pname, pgender, pcity)
Flight ( fid, fdate, time, departure_city, arrival_city)
Booking ( pid, fid, num_of_seats)
(a) Find the id of passengers who lives in the same city.
(b) Find the passenger names who do not have any bookings in any flights.
(c) Get the details of flight that are scheduled on both date ‘2024/03/10’ and ‘2024/03/11’’.
(d) Get the details of passenger who have booked flight id ‘123’.
(e) Find the city of passengers who have booked from ‘Yangon’ to ‘Naypyitaw’.