sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 allergy types exist?
SQL: SELECT count(DISTINCT allergytype) FROM Allergy_type
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 distinct allergies are there?
SQL: SELECT count(DISTINCT allergytype) FROM Allergy_type
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show all allergy types.
SQL: SELECT DISTINCT allergytype FROM Allergy_type
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 different allergy types?
SQL: SELECT DISTINCT allergytype FROM Allergy_type
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show all allergies and their types.
SQL: SELECT allergy ,  allergytype FROM Allergy_type
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 allergies and their types?
SQL: SELECT allergy ,  allergytype FROM Allergy_type
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show all allergies with type food.
SQL: SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype  =  "food"
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 all the different food allergies?
SQL: SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype  =  "food"
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 type of allergy Cat?
SQL: SELECT allergytype FROM Allergy_type WHERE allergy  =  "Cat"
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 allergy type of a cat allergy?
SQL: SELECT allergytype FROM Allergy_type WHERE allergy  =  "Cat"
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 allergies have type animal?
SQL: SELECT count(*) FROM Allergy_type WHERE allergytype  =  "animal"
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 animal type allergies exist?
SQL: SELECT count(*) FROM Allergy_type WHERE allergytype  =  "animal"
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show all allergy types and the number of allergies in each type.
SQL: SELECT allergytype ,  count(*) FROM Allergy_type GROUP BY allergytype
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 allergy types and how many allergies correspond to each one?
SQL: SELECT allergytype ,  count(*) FROM Allergy_type GROUP BY allergytype
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 allergy type has most number of allergies?
SQL: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 allergy type is most common?
SQL: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 allergy type has least number of allergies?
SQL: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 allergy type is the least common?
SQL: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 students are there?
SQL: SELECT count(*) FROM Student
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 students?
SQL: SELECT count(*) FROM Student
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show first name and last name for all students.
SQL: SELECT Fname ,  Lname FROM Student
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 full names of all students
SQL: SELECT Fname ,  Lname FROM Student
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 advisors are listed?
SQL: SELECT count(DISTINCT advisor) FROM Student
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 advisors are there?
SQL: SELECT count(DISTINCT advisor) FROM Student
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show all majors.
SQL: SELECT DISTINCT Major FROM Student
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 different majors?
SQL: SELECT DISTINCT Major FROM Student
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show all cities where students live.
SQL: SELECT DISTINCT city_code FROM Student
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 cities do students live in?
SQL: SELECT DISTINCT city_code FROM Student
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show first name, last name, age for all female students. Their sex is F.
SQL: SELECT Fname ,  Lname ,  Age FROM Student WHERE Sex  =  'F'
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 full names and ages for all female students whose sex is F?
SQL: SELECT Fname ,  Lname ,  Age FROM Student WHERE Sex  =  'F'
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show student ids for all male students.
SQL: SELECT StuID FROM Student WHERE Sex  =  'M'
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 student ids for all male students?
SQL: SELECT StuID FROM Student WHERE Sex  =  'M'
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 students are age 18?
SQL: SELECT count(*) FROM Student WHERE age  =  18
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 students are 18 years old?
SQL: SELECT count(*) FROM Student WHERE age  =  18
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show all student ids who are older than 20.
SQL: SELECT StuID FROM Student WHERE age  >  20
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 student ids for students over 20 years old?
SQL: SELECT StuID FROM Student WHERE age  >  20
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 city does the student whose last name is "Kim" live in?
SQL: SELECT city_code FROM Student WHERE LName  =  "Kim"
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Give the city that the student whose family name is Kim lives in.
SQL: SELECT city_code FROM Student WHERE LName  =  "Kim"
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Who is the advisor of student with ID 1004?
SQL: SELECT Advisor FROM Student WHERE StuID  =  1004
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Who advises student 1004?
SQL: SELECT Advisor FROM Student WHERE StuID  =  1004
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 students live in HKG or CHI?
SQL: SELECT count(*) FROM Student WHERE city_code  =  "HKG" OR city_code  =  "CHI"
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Give the number of students living in either HKG or CHI.
SQL: SELECT count(*) FROM Student WHERE city_code  =  "HKG" OR city_code  =  "CHI"
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show the minimum, average, and maximum age of all students.
SQL: SELECT min(age) ,  avg(age) ,  max(age) FROM Student
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 minimum, mean, and maximum age across all students?
SQL: SELECT min(age) ,  avg(age) ,  max(age) FROM Student
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 last name of the youngest student?
SQL: SELECT LName FROM Student WHERE age  =  (SELECT min(age) FROM Student)
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Provide the last name of the youngest student.
SQL: SELECT LName FROM Student WHERE age  =  (SELECT min(age) FROM Student)
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show the student id of the oldest student.
SQL: SELECT StuID FROM Student WHERE age  =  (SELECT max(age) FROM Student)
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 student id corresponds to the oldest student?
SQL: SELECT StuID FROM Student WHERE age  =  (SELECT max(age) FROM Student)
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show all majors and corresponding number of students.
SQL: SELECT major ,  count(*) FROM Student GROUP BY major
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 students are there for each major?
SQL: SELECT major ,  count(*) FROM Student GROUP BY major
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 major has most number of students?
SQL: SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 largest major?
SQL: SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show all ages and corresponding number of students.
SQL: SELECT age ,  count(*) FROM Student GROUP BY age
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 old is each student and how many students are each age?
SQL: SELECT age ,  count(*) FROM Student GROUP BY age
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show the average age for male and female students.
SQL: SELECT avg(age) ,  sex FROM Student GROUP BY sex
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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 average ages for male and female students?
SQL: SELECT avg(age) ,  sex FROM Student GROUP BY sex
-- Language PostgreSQL
        -- Tables: 
             -- Table: allergy type 
columns : [['allergy name', 'text'], ['allergy type', 'text']]

 -- Table: has allergy 
columns : [['stuid', 'number'], ['allergy', 'text']]

 -- Table: student 
columns : [['stuid', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', '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: Show all cities and corresponding number of students.
SQL: SELECT city_code ,  count(*) FROM Student GROUP BY city_code