sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the total number of airlines?
SQL: SELECT count(*) FROM airlines
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many airlines does Russia has?
SQL: SELECT count(*) FROM airlines WHERE country  =  'Russia'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the number of airlines based in Russia?
SQL: SELECT count(*) FROM airlines WHERE country  =  'Russia'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the maximum elevation of all airports in the country of Iceland?
SQL: SELECT max(elevation) FROM airports WHERE country  =  'Iceland'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the highest elevation of an airport in the country of Iceland?
SQL: SELECT max(elevation) FROM airports WHERE country  =  'Iceland'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the name of the airports located in Cuba or Argentina.
SQL: SELECT name FROM airports WHERE country  =  'Cuba' OR country  =  'Argentina'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the names of all airports in Cuba or Argentina?
SQL: SELECT name FROM airports WHERE country  =  'Cuba' OR country  =  'Argentina'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the country of the airlines whose name starts with 'Orbit'.
SQL: SELECT country FROM airlines WHERE name LIKE 'Orbit%'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the countries of all airlines whose names start with Orbit?
SQL: SELECT country FROM airlines WHERE name LIKE 'Orbit%'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the name of airports whose altitude is between -50 and 50.
SQL: SELECT name FROM airports WHERE elevation BETWEEN -50 AND 50
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the names of all airports whose elevation is between -50 and 50?
SQL: SELECT name FROM airports WHERE elevation BETWEEN -50 AND 50
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Which country is the airport that has the highest altitude located in?
SQL: SELECT country FROM airports ORDER BY elevation DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the country of the airport with the highest elevation?
SQL: SELECT country FROM airports ORDER BY elevation DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the number of airports whose name contain the word 'International'.
SQL: SELECT count(*) FROM airports WHERE name LIKE '%International%'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many airports' names have the word Interanation in them?
SQL: SELECT count(*) FROM airports WHERE name LIKE '%International%'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many different cities do have some airport in the country of Greenland?
SQL: SELECT count(DISTINCT city) FROM airports WHERE country  =  'Greenland'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: In how many cities are there airports in the country of Greenland?
SQL: SELECT count(DISTINCT city) FROM airports WHERE country  =  'Greenland'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the number of routes operated by American Airlines.
SQL: SELECT count(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid WHERE T1.name  =  'American Airlines'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many routes does American Airlines operate?
SQL: SELECT count(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid WHERE T1.name  =  'American Airlines'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the number of routes whose destination airports are in Canada.
SQL: SELECT count(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid WHERE country  =  'Canada'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many routes end in a Canadian airport?
SQL: SELECT count(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid WHERE country  =  'Canada'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the name, city, and country of the airport that has the lowest altitude.
SQL: SELECT name ,  city ,  country FROM airports ORDER BY elevation LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the name, city, and country of the airport with the lowest altitude?
SQL: SELECT name ,  city ,  country FROM airports ORDER BY elevation LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the name, city, and country of the airport that has the highest latitude.
SQL: SELECT name ,  city ,  country FROM airports ORDER BY elevation DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the name, city, and country of the airport with the highest elevation?
SQL: SELECT name ,  city ,  country FROM airports ORDER BY elevation DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the name and city of the airport which is the destination of the most number of routes.
SQL: SELECT T1.name ,  T1.city ,  T2.dst_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid GROUP BY T2.dst_apid ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the name and city of the airport that the most routes end at?
SQL: SELECT T1.name ,  T1.city ,  T2.dst_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid GROUP BY T2.dst_apid ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the names of the top 10 airlines that operate the most number of routes.
SQL: SELECT T1.name ,  T2.alid FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid GROUP BY T2.alid ORDER BY count(*) DESC LIMIT 10
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: For the airline ids with the top 10 most routes operated, what are their names?
SQL: SELECT T1.name ,  T2.alid FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid GROUP BY T2.alid ORDER BY count(*) DESC LIMIT 10
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the name and city of the airport which is the source for the most number of flight routes.
SQL: SELECT T1.name ,  T1.city ,  T2.src_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.src_apid GROUP BY T2.src_apid ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the name and city of the airport from most of the routes start?
SQL: SELECT T1.name ,  T1.city ,  T2.src_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.src_apid GROUP BY T2.src_apid ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the number of different airports which are the destinations of the American Airlines.
SQL: SELECT count(DISTINCT dst_apid) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid WHERE T1.name  =  'American Airlines'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the number of different different airports that are destinations for American Airlines?
SQL: SELECT count(DISTINCT dst_apid) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid WHERE T1.name  =  'American Airlines'
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Which countries has the most number of airlines?
SQL: SELECT country FROM airlines GROUP BY country ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the name of the country with the most number of home airlines?
SQL: SELECT country FROM airlines GROUP BY country ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Which countries has the most number of airlines whose active status is 'Y'?
SQL: SELECT country FROM airlines WHERE active  =  'Y' GROUP BY country ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the countries with the most airlines whose active status is Y?
SQL: SELECT country FROM airlines WHERE active  =  'Y' GROUP BY country ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List all countries and their number of airlines in the descending order of number of airlines.
SQL: SELECT country ,  count(*) FROM airlines GROUP BY country ORDER BY count(*) DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many airlines operate out of each country in descending order?
SQL: SELECT country ,  count(*) FROM airlines GROUP BY country ORDER BY count(*) DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: How many airports are there per country? Order the countries by decreasing number of airports.
SQL: SELECT count(*) ,  country FROM airports GROUP BY country ORDER BY count(*) DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: routes 
columns : [['route id', 'number'], ['destination airport id', 'number'], ['destination airport', 'text'], ['source airport id', 'number'], ['source airport', 'text'], ['airline id', 'number'], ['airline', 'text'], ['code share', 'text']]

 -- Table: airports 
columns : [['airport id', 'number'], ['name', 'text'], ['city', 'text'], ['country', 'text'], ['x', 'number'], ['y', 'number'], ['elevation', 'number'], ['iata', 'text'], ['icao', 'text']]

 -- Table: airlines 
columns : [['airline id', 'number'], ['name', 'text'], ['iata', 'text'], ['icao', 'text'], ['call sign', 'text'], ['country', 'text'], ['active', 'text']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the number of airports per country, ordered from most to least?
SQL: SELECT count(*) ,  country FROM airports GROUP BY country ORDER BY count(*) DESC