
CREATE TABLE station (
	"Station_ID" INTEGER, 
	"Name" TEXT, 
	"Annual_entry_exit" REAL, 
	"Annual_interchanges" REAL, 
	"Total_Passengers" REAL, 
	"Location" TEXT, 
	"Main_Services" TEXT, 
	"Number_of_Platforms" INTEGER, 
	PRIMARY KEY ("Station_ID")
)


CREATE TABLE train (
	"Train_ID" INTEGER, 
	"Name" TEXT, 
	"Time" TEXT, 
	"Service" TEXT, 
	PRIMARY KEY ("Train_ID")
)


CREATE TABLE train_station (
	"Train_ID" INTEGER, 
	"Station_ID" INTEGER, 
	PRIMARY KEY ("Train_ID", "Station_ID"), 
	FOREIGN KEY("Train_ID") REFERENCES train ("Train_ID"), 
	FOREIGN KEY("Station_ID") REFERENCES station ("Station_ID")
)

CREATE TABLE station (
	"Station_ID" INTEGER, 
	"Name" TEXT, 
	"Annual_entry_exit" REAL, 
	"Annual_interchanges" REAL, 
	"Total_Passengers" REAL, 
	"Location" TEXT, 
	"Main_Services" TEXT, 
	"Number_of_Platforms" INTEGER, 
	PRIMARY KEY ("Station_ID")
)

/*
2 rows from station table:
Station_ID	Name	Annual_entry_exit	Annual_interchanges	Total_Passengers	Location	Main_Services	Number_of_Platforms
1	London Waterloo	94.046	9.489	103.534	London	South Western Main Line West of England Main Line	19
2	London Victoria	76.231	9.157	85.38	London	Brighton Main Line Chatham Main Line	19
*/


CREATE TABLE train (
	"Train_ID" INTEGER, 
	"Name" TEXT, 
	"Time" TEXT, 
	"Service" TEXT, 
	PRIMARY KEY ("Train_ID")
)

/*
2 rows from train table:
Train_ID	Name	Time	Service
1	Ananthapuri Express	17:15	Daily
2	Guruvayur Express	22:10	Daily
*/


CREATE TABLE train_station (
	"Train_ID" INTEGER, 
	"Station_ID" INTEGER, 
	PRIMARY KEY ("Train_ID", "Station_ID"), 
	FOREIGN KEY("Train_ID") REFERENCES train ("Train_ID"), 
	FOREIGN KEY("Station_ID") REFERENCES station ("Station_ID")
)

/*
2 rows from train_station table:
Train_ID	Station_ID
1	1
2	1
*/
Show the names and main services for train stations that have the top three total number of passengers.
SELECT name ,  main_services FROM station ORDER BY total_passengers DESC LIMIT 3
[{'Name': 'London Waterloo', 'Main_Services': 'South Western Main Line West of England Main Line'}, {'Name': 'London Victoria', 'Main_Services': 'Brighton Main Line Chatham Main Line'}, {'Name': 'London Bridge', 'Main_Services': 'South Eastern Main Line Thameslink'}]