human
Schema:
railway (Railway_ID, Railway, Builder, Built, Wheels, Location, ObjectNumber)
train (Train_ID, Train_Num, Name, From, Arrival, Railway_ID)
manager (Manager_ID, Name, Country, Working_year_starts, Age, Level)
railway_manage (Railway_ID, Manager_ID, From_Year)
Please answer with SQL.
assistant
Sure, I understand.
human
Hi, Can you tell me the most common builder of railways?
assistant
SELECT Builder FROM railway GROUP BY Builder ORDER BY COUNT( * ) DESC LIMIT 1;
human
Can you tell me the last railways this builder has build?
assistant
SELECT Railway FROM railway GROUP BY Builder having Builder = 'GWR Swindon' ORDER BY built DESC LIMIT 1;
human
In what year was GWRSn build?
assistant
SELECT Built FROM railway GROUP BY Builder having Builder = "GWR Swindon" ORDER by Built desc LIMIT 1 ;