== Relational Mapping - Relational Schema and DDL == === Notation === 1. Relations are denoted as: `CAPITALIZED LETTERS`(attr₁, attr₂, ..., attrₙ), for a relation with 𝑛 attributes. 2. Primary key attributes are **__underscored and bolded__**. 3. Foreign key attributes have an asterisk * prefixed before them. __Note: Some foreign key attributes have the table they are referencing right after them to clarify this.__ === Relations - Relational Schema === `ACCOUNT`(__**email**__, name, surname, password) `TRANSPORT_ORGANIZER`(__***account_email**__ (`ACCOUNT`), company_name, company_embg) `ADMIN`(__***account_email**__ (`ACCOUNT`)) `STUDENT`(__***account_email**__ (`ACCOUNT`), university, index) `DRIVER`(__***account_email**__ (`ACCOUNT`), years_experience, *works_for_email(`TRANSPORT_ORGANIZER`)) `VEHICLE`(__**plate_num**__, model, brand, capacity, year_manuf) `AUTOMOBILE`(__***plate_num**__ (`VEHICLE`)) `TRAIN`(__***plate_num**__ (`VEHICLE`)) `BUS`(__***plate_num**__ (`VEHICLE`)) `VAN`(__***plate_num**__ (`VEHICLE`)) `DRIVER_VEHICLE_OPERATION`(__***driver_email**__(`DRIVER`), __***plate_num**__(`VEHICLE`)) `TRIP`(__**trid_id**__, __***transport_organizer_email**__(`TRANSPORT_ORGANIZER`), __***route_id**__(`ROUTE`), free_seats, date, status) `DRIVES_ON`(__***driver_email**__(`DRIVER`), __***trip_id**__(`TRIP`)) `ROUTE`(__**id**__, *transport_organizer_email(`TRANSPORT_ORGANIZER`), *from_loc (`LOCATION`), *to_loc (`LOCATION`)) `DAY_ACTIVE`(__***route_id**(`ROUTE`) __**day**__) `LOCATION`(__**latitude**__, __**longitude**__, name) `TRIP_STOPS`(__***trip_id**__(`TRIP`), __***location**__, time) `TICKET`(__**id**__, *trip_id(`TRIP`), *gets_on_loc (`LOCATION`), *gets_off_loc (`LOCATION`), *account_email (`ACCOUNT`), date_purchased, time_purchased, price, seat) `TICKET_RELATIONS`(*trip_id_1(`TRIP`), *trip_id_2(`TRIP`)) `STUDENT_TICKET`(__***ticket_id**__ (`TICKET`), discount) `CHILD_TICKET`(__***ticket_id**__ (`TICKET`), discount, embg, parent_embg) `PAYMENT`(__**payment_id**__, __***account_email**__ (`ACCOUNT`), date, total_price, n_tickets) `FAVORITE`(__***route_id**__(`ROUTE`), __***account_email**__ (`ACCOUNT`)) `REVIEW`(__**review_id**__, __***account_email**__ (`ACCOUNT`), *ticket_id, description, rating) == DDL - Creation and Deletion of Tables == == Relational Schema Diagram ==