Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What are the primary and foreign keys in these tables? Also, what data constrain

ID: 3680395 • Letter: W

Question

What are the primary and foreign keys in these tables? Also, what data constraints exist from these tables? Thanks

TRAIN (table) TRAIN_ID TRAIN_NAME TRAIN_SCHEDULE (table) TRAIN_ID STATION_ID ARRIVAL_TIME DEPARTURE_TIME TRAIN_SEATS (table) SEAT_ID SEAT_NUMBER TRAIN_ID STATION (table) STATION_ID STATION_NAME STATION_LOCATION PASSENGER (table) PASSENGER_ID PASSENGER_FIRSTNAME PASSENGER_LASTNAME ADDRESS PHONE_NUMBER RESERVATION (table) RESERVATION_ID PASSENGER_ID DATE_OF_TRAVEL STATION_ID SEAT_RESERVATION (table) SEAT_ID RESERVATION_ID

Explanation / Answer

Bellow constraints exist from these tables

not null - each value in a column must not be NULL
unique - value(s) in specified column(s) must be unique for each row in a table
primary key - value(s) in specified column(s) must be unique for each row in a table and not be NULL; normally each table in a database should have a primary key - it is used to identify individual records
foreign key - value(s) in specified column(s) must reference an existing record in another table (via it's primary key or some other unique constraint)

TRAIN (table) TRAIN_ID Primary Key TRAIN_NAME TRAIN_SCHEDULE (table) TRAIN_ID Foreign Key STATION_ID Foreign Key ARRIVAL_TIME DEPARTURE_TIME TRAIN_SEATS (table) SEAT_ID Primary Key SEAT_NUMBER TRAIN_ID Foreign Key STATION (table) STATION_ID Primary Key STATION_NAME STATION_LOCATION PASSENGER (table) PASSENGER_ID Primary Key PASSENGER_FIRSTNAME PASSENGER_LASTNAME ADDRESS PHONE_NUMBER RESERVATION (table) RESERVATION_ID Primary Key PASSENGER_ID Foreign Key DATE_OF_TRAVEL STATION_ID Foreign Key SEAT_RESERVATION (table) SEAT_ID Foreign Key RESERVATION_ID Foreign Key

Bellow constraints exist from these tables

not null - each value in a column must not be NULL
unique - value(s) in specified column(s) must be unique for each row in a table
primary key - value(s) in specified column(s) must be unique for each row in a table and not be NULL; normally each table in a database should have a primary key - it is used to identify individual records
foreign key - value(s) in specified column(s) must reference an existing record in another table (via it's primary key or some other unique constraint)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote