What is the code of airport that has fewest number of flights?
CREATE TABLE FLIGHTS (DestAirport VARCHAR, SourceAirport VARCHAR); CREATE TABLE AIRPORTS (AirportCode VARCHAR)
SELECT TOP 1 T1.AirportCode FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.DestAirport OR T1.AirportCode = T2.SourceAirport GROUP BY T1.AirportCode ORDER BY COUNT(*)
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE FLIGHTS (DestAirport VARCHAR, SourceAirport VARCHAR); CREATE TABLE AIRPORTS (AirportCode VARCHAR) Question: What is the code of airport that has fewest number of flights? [/INST] SELECT TOP 1 T1.AirportCode FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.DestAirport OR T1.AirportCode = T2.SourceAirport GROUP BY T1.AirportCode ORDER BY COUNT(*) </s>