| | 1 | == Relational Mapping - Relational Schema and DDL == |
| | 2 | |
| | 3 | === Notation === |
| | 4 | |
| | 5 | 1. Relations are denoted as: `CAPITALIZED LETTERS`(attr₁, attr₂, ..., attrₙ), for a relation with 𝑛 attributes. |
| | 6 | |
| | 7 | 2. Primary key attributes are **__underscored and bolded__**. |
| | 8 | |
| | 9 | 3. Foreign key attributes have an asterisk * prefixed before them. |
| | 10 | |
| | 11 | __Note: Some foreign key attributes have the table they are referencing right after them to clarify this.__ |
| | 12 | |
| | 13 | === Relations - Relational Schema === |
| | 14 | |
| | 15 | `ACCOUNT`(__**email**__, name, surname, password) |
| | 16 | |
| | 17 | `TRANSPORT_ORGANIZER`(__***account_email**__ (`ACCOUNT`), company_name, company_embg) |
| | 18 | |
| | 19 | `ADMIN`(__***account_email**__ (`ACCOUNT`)) |
| | 20 | |
| | 21 | `STUDENT`(__***account_email**__ (`ACCOUNT`), university, index) |
| | 22 | |
| | 23 | `DRIVER`(__***account_email**__ (`ACCOUNT`), years_experience, *company (`TRANSPORT_ORGANIZER`)) |
| | 24 | |
| | 25 | `VEHICLE`(__**plate_num**__, model, brand, capacity, year_manuf) |
| | 26 | |
| | 27 | `AUTOMOBILE`(__***plate_num**__ (`VEHICLE`)) |
| | 28 | |
| | 29 | `TRAIN`(__***plate_num**__ (`VEHICLE`)) |
| | 30 | |
| | 31 | `BUS`(__***plate_num**__ (`VEHICLE`)) |
| | 32 | |
| | 33 | `VAN`(__***plate_num**__ (`VEHICLE`)) |
| | 34 | |
| | 35 | `VEHICLE_OPERATION`(__***driver**__, __***vehicle**__) |
| | 36 | |
| | 37 | `TRIP`(__**trid_id**__, __***transport_organizer**__, __***route**__, free_seats, date, status) |
| | 38 | |
| | 39 | `DRIVES_ON`(__***driver**__, __***trip**__) |
| | 40 | |
| | 41 | `ROUTE`(__**id**__, *transport_organizer, *from_loc (`LOCATION`), *to_loc (`LOCATION`)) |
| | 42 | |
| | 43 | `DAY_ACTIVE`(__***route**, __**day**__) |
| | 44 | |
| | 45 | `LOCATION`(__**latitude**__, __**longitude**__, __**time**__, name) |
| | 46 | |
| | 47 | `TRIP_STOPS`(__***trip**__, __***location**__, at_time) |
| | 48 | |
| | 49 | `TICKET`(__**id**__, *for_trip (`TRIP`), *linked_with (`TICKET`), *gets_on_loc (`LOCATION`), *gets_off_loc (`LOCATION`), *payment, *account, *review, date_purchased, time_purchased, price, seat, two_way) |
| | 50 | |
| | 51 | `STUDENT_TICKET`(__***ticket_id**__ (`TICKET`), discount) |
| | 52 | |
| | 53 | `CHILD_TICKET`(__***ticket_id**__ (`TICKET`), discount, embg, parent_embg) |
| | 54 | |
| | 55 | `PAYMENT`(__**payment_id**__, __***by_account**__ (`ACCOUNT`), date, total_price, n_tickets) |
| | 56 | |
| | 57 | `FAVORITE`(__***route**__, __***account**__) |
| | 58 | |
| | 59 | `REVIEW`(__**review_id**__, __***account**__, *ticket, description, rating) |
| | 60 | |
| | 61 | == DDL - Creation and Deletion of Tables == |
| | 62 | |
| | 63 | == Relational Schema Diagram == |