0% found this document useful (0 votes)
11 views3 pages

Olympic Data Structure Overview

The document describes the schema for a database that stores information about Olympic events, athletes, countries, sports, disciplines, equipment, results, and more. It includes 13 tables with attributes and relationships defined between the tables using foreign keys. Several example queries are provided that join various tables to retrieve specific data points related to athletes, events, countries and more.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Olympic Data Structure Overview

The document describes the schema for a database that stores information about Olympic events, athletes, countries, sports, disciplines, equipment, results, and more. It includes 13 tables with attributes and relationships defined between the tables using foreign keys. Several example queries are provided that join various tables to retrieve specific data points related to athletes, events, countries and more.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Olympic (olympiad_id, country_id, city, season, year); country_id -> Country(country_id)

Event_location (location_id, no_of_events, location_name);

Country (country_id, country_name, continent);

Athlete (athlete_id, country_id, sport_id, gender, date_of_birth, firstname, lastname); country_id ->
Country(country_id), sport_id -> Sports(sport_id)

Equipment (equipment_id, athlete_id, equipment_name, quantity); athlete_id -> Athlete(athlete_id)

Events (event_id, location_id, discipline_id, event_title, rules, no_of_athletes); location_id ->


Event_location(location_id), discipline_id -> Discipline(discipline_id)

Results (result_id, event_id, athlete_id, score, position, measurement); event_id -> Events(event_id),
athlete_id -> Athlete(athlete_id)

Discipline (discipline_id, sport_id, federation, discipline_name); sport_id -> Sports(sport_id)

Sports (sport_id, description, sport_name);

Winner (event_id, athlete_id, type_of_medal, final_score, measurement); event_id -> Events(event_id),


athlete_id -> Athlete(athlete_id);

chooses (olympiad_id, location_id, date); olympiad_id -> Olympic(olympiad_id), location_id ->


Event_location(location_id);

attend (athlete_id, event_id, order); athlete_id -> Athlete(athlete_id), event_id -> Events(event_id)

SELECT discipline_name, federation FROM Discipline INNER JOIN Sports ON


Discipline.sport_id = Sports.sport_id WHERE sport_name = 'Aquatic'

π discipline_name, federation σ sport_name = 'Aquatic' ( Discipline ⨝ Discipline.sport_id = Sports.sport_id Sports )
π country_name, continent, location_name, no_of_events σ no_of_events > 2 and date ≥ '2020-07-23' and date ≤ '2020-08-
08' ( ( ( Country ⨝ Country.country_id = Olympic.country_id Olympic ) ⨝ Olympic.olympiad_id = chooses.olympiad_id ch
ooses ) ⨝ Event_location.location_id = chooses.location_id Event_location )

SELECT country_name, continent,location_name, no_of_events FROM Country INNER JOIN


Olympic ON Country.country_id = Olympic.country_id INNER JOIN chooses ON
Olympic.olympiad_id = chooses.olympiad_id INNER JOIN Event_location ON
Event_location.location_id = chooses.location_id WHERE no_of_events > 2 and date >='2020-
07-23' and date <= '2020-08-08'

SELECT firstname, lastname FROM Athlete INNER JOIN Equipment ON Athlete.athlete_id =


Equipment.athlete_id WHERE Equipment.equipment_name = 'special swimming hats'

π firstname, lastname σ Equipment.equipment_name = 'special swimming


hats' ( Athlete ⨝ Athlete.athlete_id = Equipment.athlete_id Equipment )

SELECT firstname, lastname, event_title, score, measurement, position FROM Results INNER
JOIN Athlete ON Results.athlete_id = Athlete.athlete_id INNER JOIN Eventas ON
Eventas.event_id = Results.event_id WHERE [Link] = 'Rafal'

π firstname, lastname, event_title, score, measurement,


position σ [Link] = 'Rafal' ( ( Results ⨝ Results.athlete_id = Athlete.athlete_id Athlete ) ⨝ Events.event_id = Res
ults.event_id Events )
SELECT firstname, lastname, event_title, orderis, type_of_medal, final_score,
measurement FROM Eventas INNER JOIN attend ON
Eventas.event_id=attend.event_id INNER JOIN Athlete ON Athlete.athlete_id =
attend.athlete_id INNER JOIN Winner ON Athlete.athlete_id = Winner.athlete_id
WHERE orderis=1 and type_of_medal='Gold'

π firstname, lastname, event_title, orderis, type_of_medal, final_score,


measurement σ orderis = 1 and type_of_medal = 'Gold' ( ( ( Eventas ⨝ Eventas.event_id = attend.event_id attend ) ⨝ Athl
ete.athlete_id = attend.athlete_id Athlete ) ⨝ Athlete.athlete_id = Winner.athlete_id Winner )

You might also like