
CREATE TABLE event (
	"ID" INTEGER, 
	"Name" TEXT, 
	"Stadium_ID" INTEGER, 
	"Year" TEXT, 
	PRIMARY KEY ("ID"), 
	FOREIGN KEY("Stadium_ID") REFERENCES stadium ("ID")
)


CREATE TABLE record (
	"ID" INTEGER, 
	"Result" TEXT, 
	"Swimmer_ID" INTEGER, 
	"Event_ID" INTEGER, 
	PRIMARY KEY ("Swimmer_ID", "Event_ID"), 
	FOREIGN KEY("Swimmer_ID") REFERENCES swimmer ("ID"), 
	FOREIGN KEY("Event_ID") REFERENCES event ("ID")
)


CREATE TABLE stadium (
	"ID" INTEGER, 
	name TEXT, 
	"Capacity" INTEGER, 
	"City" TEXT, 
	"Country" TEXT, 
	"Opening_year" INTEGER, 
	PRIMARY KEY ("ID")
)


CREATE TABLE swimmer (
	"ID" INTEGER, 
	name TEXT, 
	"Nationality" TEXT, 
	meter_100 REAL, 
	meter_200 TEXT, 
	meter_300 TEXT, 
	meter_400 TEXT, 
	meter_500 TEXT, 
	meter_600 TEXT, 
	meter_700 TEXT, 
	"Time" TEXT, 
	PRIMARY KEY ("ID")
)

CREATE TABLE event (
	"ID" INTEGER, 
	"Name" TEXT, 
	"Stadium_ID" INTEGER, 
	"Year" TEXT, 
	PRIMARY KEY ("ID"), 
	FOREIGN KEY("Stadium_ID") REFERENCES stadium ("ID")
)

/*
2 rows from event table:
ID	Name	Stadium_ID	Year
1	FINA	1	2016
2	Pacific	10	2011
*/


CREATE TABLE record (
	"ID" INTEGER, 
	"Result" TEXT, 
	"Swimmer_ID" INTEGER, 
	"Event_ID" INTEGER, 
	PRIMARY KEY ("Swimmer_ID", "Event_ID"), 
	FOREIGN KEY("Swimmer_ID") REFERENCES swimmer ("ID"), 
	FOREIGN KEY("Event_ID") REFERENCES event ("ID")
)

/*
2 rows from record table:
ID	Result	Swimmer_ID	Event_ID
1	NC	1	1
2	Win	1	2
*/


CREATE TABLE stadium (
	"ID" INTEGER, 
	name TEXT, 
	"Capacity" INTEGER, 
	"City" TEXT, 
	"Country" TEXT, 
	"Opening_year" INTEGER, 
	PRIMARY KEY ("ID")
)

/*
2 rows from stadium table:
ID	name	Capacity	City	Country	Opening_year
1	Nou Mestalla	75000	Valencia	Spain	2004
2	Gazprom Arena	69501	Saint Petersburg	Russia	2005
*/


CREATE TABLE swimmer (
	"ID" INTEGER, 
	name TEXT, 
	"Nationality" TEXT, 
	meter_100 REAL, 
	meter_200 TEXT, 
	meter_300 TEXT, 
	meter_400 TEXT, 
	meter_500 TEXT, 
	meter_600 TEXT, 
	meter_700 TEXT, 
	"Time" TEXT, 
	PRIMARY KEY ("ID")
)

/*
2 rows from swimmer table:
ID	name	Nationality	meter_100	meter_200	meter_300	meter_400	meter_500	meter_600	meter_700	Time
7	Przemysław Stańczyk	Poland	57.31	1:57.10	2:56.02	3:55.36	4:54.21	5:52.59	6:50.91	7:47.91
4	Craig Stevens	Australia	57.35	1:56.34	2:55.90	3:55.72	4:55.08	5:54.45	6:52.69	7:48.67
*/
Find all details for each swimmer.
SELECT * FROM swimmer
[{'ID': 7, 'name': 'Przemysław Stańczyk', 'Nationality': 'Poland', 'meter_100': 57.31, 'meter_200': '1:57.10', 'meter_300': '2:56.02', 'meter_400': '3:55.36', 'meter_500': '4:54.21', 'meter_600': '5:52.59', 'meter_700': '6:50.91', 'Time': '7:47.91'}, {'ID': 4, 'name': 'Craig Stevens', 'Nationality': 'Australia', 'meter_100': 57.35, 'meter_200': '1:56.34', 'meter_300': '2:55.90', 'meter_400': '3:55.72', 'meter_500': '4:55.08', 'meter_600': '5:54.45', 'meter_700': '6:52.69', 'Time': '7:48.67'}, {'ID': 5, 'name': 'Federico Colbertaldo', 'Nationality': 'Italy', 'meter_100': 57.66, 'meter_200': '1:56.77', 'meter_300': '2:56.04', 'meter_400': '3:55.37', 'meter_500': '4:54.48', 'meter_600': '5:53.53', 'meter_700': '6:52.58', 'Time': '7:49.98'}, {'ID': 8, 'name': 'Sébastien Rouault', 'Nationality': 'France', 'meter_100': 55.67, 'meter_200': '1:54.40', 'meter_300': '2:53.46', 'meter_400': '3:52.93', 'meter_500': '4:52.85', 'meter_600': '5:53.03', 'meter_700': '6:53.34', 'Time': '7:52.04'}, {'ID': 1, 'name': 'Sergiy Fesenko', 'Nationality': 'Ukraine', 'meter_100': 57.34, 'meter_200': '1:57.26', 'meter_300': '2:57.10', 'meter_400': '3:57.12', 'meter_500': '4:57.03', 'meter_600': '5:56.31', 'meter_700': '6:55.07', 'Time': '7:53.43'}, {'ID': 2, 'name': 'Grant Hackett', 'Nationality': 'Australia', 'meter_100': 57.34, 'meter_200': '1:57.21', 'meter_300': '2:56.95', 'meter_400': '3:57.00', 'meter_500': '4:56.96', 'meter_600': '5:57.10', 'meter_700': '6:57.44', 'Time': '7:55.39'}, {'ID': 6, 'name': 'Ryan Cochrane', 'Nationality': 'Canada', 'meter_100': 57.84, 'meter_200': '1:57.26', 'meter_300': '2:56.64', 'meter_400': '3:56.34', 'meter_500': '4:56.15', 'meter_600': '5:56.99', 'meter_700': '6:57.69', 'Time': '7:56.56'}, {'ID': 3, 'name': 'Oussama Mellouli', 'Nationality': 'Tunisia', 'meter_100': 57.31, 'meter_200': '1:56.44', 'meter_300': '2:55.94', 'meter_400': '3:55.49', 'meter_500': '4:54.19', 'meter_600': '5:52.92', 'meter_700': '6:50.80', 'Time': '7:46.95'}]