brief_instruction stringlengths 16 224 | instruction stringlengths 687 8.77k | output stringlengths 18 577 |
|---|---|---|
List the name of artworks whose type is not "Program Talent Show". |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `List the name of artworks whose type is not "Program Talent Show".` to a syntactically-correct PostgreSQL query.
| SELECT Name FROM artwork WHERE TYPE != "Program Talent Show" |
What are the names and locations of festivals? |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `What are the names and locations of festivals?` to a syntactically-correct PostgreSQL query.
| SELECT Festival_Name , LOCATION FROM festival_detail |
What are the names of the chairs of festivals, sorted in ascending order of the year held? |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `What are the names of the chairs of festivals, sorted in ascending order of the year held?` to a syntactically-correct PostgreSQL query.
| SELECT Chair_Name FROM festival_detail ORDER BY YEAR ASC |
What is the location of the festival with the largest number of audience? |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `What is the location of the festival with the largest number of audience?` to a syntactically-correct PostgreSQL query.
| SELECT LOCATION FROM festival_detail ORDER BY Num_of_Audience DESC LIMIT 1 |
What are the names of festivals held in year 2007? |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `What are the names of festivals held in year 2007?` to a syntactically-correct PostgreSQL query.
| SELECT Festival_Name FROM festival_detail WHERE YEAR = 2007 |
What is the average number of audience for festivals? |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `What is the average number of audience for festivals?` to a syntactically-correct PostgreSQL query.
| SELECT avg(Num_of_Audience) FROM festival_detail |
Show the names of the three most recent festivals. |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `Show the names of the three most recent festivals.` to a syntactically-correct PostgreSQL query.
| SELECT Festival_Name FROM festival_detail ORDER BY YEAR DESC LIMIT 3 |
For each nomination, show the name of the artwork and name of the festival where it is nominated. |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `For each nomination, show the name of the artwork and name of the festival where it is nominated.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Name , T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID |
Show distinct types of artworks that are nominated in festivals in 2007. |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `Show distinct types of artworks that are nominated in festivals in 2007.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T2.Type FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID WHERE T3.Year = 2007 |
Show the names of artworks in ascending order of the year they are nominated in. |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `Show the names of artworks in ascending order of the year they are nominated in.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID ORDER BY T3.Year |
Show the names of festivals that have nominated artworks of type "Program Talent Show". |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `Show the names of festivals that have nominated artworks of type "Program Talent Show".` to a syntactically-correct PostgreSQL query.
| SELECT T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID WHERE T2.Type = "Program Talent Show" |
Show the ids and names of festivals that have at least two nominations for artworks. |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `Show the ids and names of festivals that have at least two nominations for artworks.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Festival_ID , T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID GROUP BY T1.Festival_ID HAVING COUNT(*) >= 2 |
Show the id, name of each festival and the number of artworks it has nominated. |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `Show the id, name of each festival and the number of artworks it has nominated.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Festival_ID , T3.Festival_Name , COUNT(*) FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID GROUP BY T1.Festival_ID |
Please show different types of artworks with the corresponding number of artworks of each type. |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `Please show different types of artworks with the corresponding number of artworks of each type.` to a syntactically-correct PostgreSQL query.
| SELECT TYPE , COUNT(*) FROM artwork GROUP BY TYPE |
List the most common type of artworks. |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `List the most common type of artworks.` to a syntactically-correct PostgreSQL query.
| SELECT TYPE FROM artwork GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1 |
List the year in which there are more than one festivals. |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `List the year in which there are more than one festivals.` to a syntactically-correct PostgreSQL query.
| SELECT YEAR FROM festival_detail GROUP BY YEAR HAVING COUNT(*) > 1 |
List the name of artworks that are not nominated. |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `List the name of artworks that are not nominated.` to a syntactically-correct PostgreSQL query.
| SELECT Name FROM Artwork WHERE Artwork_ID NOT IN (SELECT Artwork_ID FROM nomination) |
Show the number of audience in year 2008 or 2010. |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `Show the number of audience in year 2008 or 2010.` to a syntactically-correct PostgreSQL query.
| SELECT Num_of_Audience FROM festival_detail WHERE YEAR = 2008 OR YEAR = 2010 |
What are the total number of the audiences who visited any of the festivals? |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `What are the total number of the audiences who visited any of the festivals?` to a syntactically-correct PostgreSQL query.
| SELECT sum(Num_of_Audience) FROM festival_detail |
In which year are there festivals both inside the 'United States' and outside the 'United States'? |
-- Language PostgreSQL
-- Tables:
-- Table: festival detail
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]
-- Table: artwork
columns : [['artwork id', 'number'], ['type', 'text'], ['name', 'text']]
-- Table: nomination
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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.
Translate `In which year are there festivals both inside the 'United States' and outside the 'United States'?` to a syntactically-correct PostgreSQL query.
| SELECT YEAR FROM festival_detail WHERE LOCATION = 'United States' INTERSECT SELECT YEAR FROM festival_detail WHERE LOCATION != 'United States' |
How many premises are there? |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `How many premises are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM premises |
What are all the distinct premise types? |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `What are all the distinct premise types?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT premises_type FROM premises |
Find the types and details for all premises and order by the premise type. |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `Find the types and details for all premises and order by the premise type.` to a syntactically-correct PostgreSQL query.
| SELECT premises_type , premise_details FROM premises ORDER BY premises_type |
Show each premise type and the number of premises in that type. |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `Show each premise type and the number of premises in that type.` to a syntactically-correct PostgreSQL query.
| SELECT premises_type , count(*) FROM premises GROUP BY premises_type |
Show all distinct product categories along with the number of mailshots in each category. |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `Show all distinct product categories along with the number of mailshots in each category.` to a syntactically-correct PostgreSQL query.
| SELECT product_category , count(*) FROM mailshot_campaigns GROUP BY product_category |
Show the name and phone of the customer without any mailshot. |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `Show the name and phone of the customer without any mailshot.` to a syntactically-correct PostgreSQL query.
| SELECT customer_name , customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM mailshot_customers) |
Show the name and phone for customers with a mailshot with outcome code 'No Response'. |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `Show the name and phone for customers with a mailshot with outcome code 'No Response'.` to a syntactically-correct PostgreSQL query.
| SELECT T1.customer_name , T1.customer_phone FROM customers AS T1 JOIN mailshot_customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.outcome_code = 'No Response' |
Show the outcome code of mailshots along with the number of mailshots in each outcome code. |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `Show the outcome code of mailshots along with the number of mailshots in each outcome code.` to a syntactically-correct PostgreSQL query.
| SELECT outcome_code , count(*) FROM mailshot_customers GROUP BY outcome_code |
Show the names of customers who have at least 2 mailshots with outcome code 'Order'. |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `Show the names of customers who have at least 2 mailshots with outcome code 'Order'.` to a syntactically-correct PostgreSQL query.
| SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE outcome_code = 'Order' GROUP BY T1.customer_id HAVING count(*) >= 2 |
Show the names of customers who have the most mailshots. |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `Show the names of customers who have the most mailshots.` to a syntactically-correct PostgreSQL query.
| SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1 |
What are the name and payment method of customers who have both mailshots in 'Order' outcome and mailshots in 'No Response' outcome. |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `What are the name and payment method of customers who have both mailshots in 'Order' outcome and mailshots in 'No Response' outcome.` to a syntactically-correct PostgreSQL query.
| SELECT T2.customer_name , T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.outcome_code = 'Order' INTERSECT SELECT T2.customer_name , T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.outcome_code = 'No Response' |
Show the premise type and address type code for all customer addresses. |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `Show the premise type and address type code for all customer addresses.` to a syntactically-correct PostgreSQL query.
| SELECT T2.premises_type , T1.address_type_code FROM customer_addresses AS T1 JOIN premises AS T2 ON T1.premise_id = T2.premise_id |
What are the distinct address type codes for all customer addresses? |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `What are the distinct address type codes for all customer addresses?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT address_type_code FROM customer_addresses |
Show the shipping charge and customer id for customer orders with order status Cancelled or Paid. |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `Show the shipping charge and customer id for customer orders with order status Cancelled or Paid.` to a syntactically-correct PostgreSQL query.
| SELECT order_shipping_charges , customer_id FROM customer_orders WHERE order_status_code = 'Cancelled' OR order_status_code = 'Paid' |
Show the names of customers having an order with shipping method FedEx and order status Paid. |
-- Language PostgreSQL
-- Tables:
-- Table: premises
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]
-- Table: products
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]
-- Table: customers
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]
-- Table: mailshot campaigns
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]
-- Table: customer addresses
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]
-- Table: customer orders
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]
-- Table: mailshot customers
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]
-- Table: order items
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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.
Translate `Show the names of customers having an order with shipping method FedEx and order status Paid.` to a syntactically-correct PostgreSQL query.
| SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE shipping_method_code = 'FedEx' AND order_status_code = 'Paid' |
How many courses are there in total? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `How many courses are there in total?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM COURSE |
Count the number of courses. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Count the number of courses.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM COURSE |
How many courses have more than 2 credits? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `How many courses have more than 2 credits?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM COURSE WHERE Credits > 2 |
Count the number of courses with more than 2 credits. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Count the number of courses with more than 2 credits.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM COURSE WHERE Credits > 2 |
List all names of courses with 1 credit? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `List all names of courses with 1 credit?` to a syntactically-correct PostgreSQL query.
| SELECT CName FROM COURSE WHERE Credits = 1 |
What are the names of courses with 1 credit? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the names of courses with 1 credit?` to a syntactically-correct PostgreSQL query.
| SELECT CName FROM COURSE WHERE Credits = 1 |
Which courses are taught on days MTW? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Which courses are taught on days MTW?` to a syntactically-correct PostgreSQL query.
| SELECT CName FROM COURSE WHERE Days = "MTW" |
What are the course names for courses taught on MTW? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the course names for courses taught on MTW?` to a syntactically-correct PostgreSQL query.
| SELECT CName FROM COURSE WHERE Days = "MTW" |
What is the number of departments in Division "AS"? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What is the number of departments in Division "AS"?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM DEPARTMENT WHERE Division = "AS" |
How many departments are in the division AS? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `How many departments are in the division AS?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM DEPARTMENT WHERE Division = "AS" |
What are the phones of departments in Room 268? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the phones of departments in Room 268?` to a syntactically-correct PostgreSQL query.
| SELECT DPhone FROM DEPARTMENT WHERE Room = 268 |
Give the phones for departments in room 268. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Give the phones for departments in room 268.` to a syntactically-correct PostgreSQL query.
| SELECT DPhone FROM DEPARTMENT WHERE Room = 268 |
Find the number of students that have at least one grade "B". |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the number of students that have at least one grade "B".` to a syntactically-correct PostgreSQL query.
| SELECT COUNT(DISTINCT StuID) FROM ENROLLED_IN WHERE Grade = "B" |
How many students have had at least one "B" grade? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `How many students have had at least one "B" grade?` to a syntactically-correct PostgreSQL query.
| SELECT COUNT(DISTINCT StuID) FROM ENROLLED_IN WHERE Grade = "B" |
Find the max and min grade point for all letter grade. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the max and min grade point for all letter grade.` to a syntactically-correct PostgreSQL query.
| SELECT max(gradepoint) , min(gradepoint) FROM GRADECONVERSION |
What are the maximum and minumum grade points? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the maximum and minumum grade points?` to a syntactically-correct PostgreSQL query.
| SELECT max(gradepoint) , min(gradepoint) FROM GRADECONVERSION |
Find the first names of students whose first names contain letter "a". |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the first names of students whose first names contain letter "a".` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT Fname FROM STUDENT WHERE Fname LIKE '%a%' |
What are the first names for students who have an "a" in their first name? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the first names for students who have an "a" in their first name?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT Fname FROM STUDENT WHERE Fname LIKE '%a%' |
Find the first names and last names of male (sex is M) faculties who live in building NEB. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the first names and last names of male (sex is M) faculties who live in building NEB.` to a syntactically-correct PostgreSQL query.
| SELECT Fname , Lname FROM FACULTY WHERE sex = "M" AND Building = "NEB" |
What are the full names of faculties with sex M and who live in building NEB? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the full names of faculties with sex M and who live in building NEB?` to a syntactically-correct PostgreSQL query.
| SELECT Fname , Lname FROM FACULTY WHERE sex = "M" AND Building = "NEB" |
Find the rooms of faculties with rank professor who live in building NEB. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the rooms of faculties with rank professor who live in building NEB.` to a syntactically-correct PostgreSQL query.
| SELECT Room FROM FACULTY WHERE Rank = "Professor" AND Building = "NEB" |
What are the rooms for members of the faculty who are professors and who live in building NEB? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the rooms for members of the faculty who are professors and who live in building NEB?` to a syntactically-correct PostgreSQL query.
| SELECT Room FROM FACULTY WHERE Rank = "Professor" AND Building = "NEB" |
Find the department name that is in Building "Mergenthaler". |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the department name that is in Building "Mergenthaler".` to a syntactically-correct PostgreSQL query.
| SELECT DName FROM DEPARTMENT WHERE Building = "Mergenthaler" |
What is the name of the department in the Building Mergenthaler? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What is the name of the department in the Building Mergenthaler?` to a syntactically-correct PostgreSQL query.
| SELECT DName FROM DEPARTMENT WHERE Building = "Mergenthaler" |
List all information about courses sorted by credits in the ascending order. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `List all information about courses sorted by credits in the ascending order.` to a syntactically-correct PostgreSQL query.
| SELECT * FROM COURSE ORDER BY Credits |
What is all the information about courses, ordered by credits ascending? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What is all the information about courses, ordered by credits ascending?` to a syntactically-correct PostgreSQL query.
| SELECT * FROM COURSE ORDER BY Credits |
List the course name of courses sorted by credits. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `List the course name of courses sorted by credits.` to a syntactically-correct PostgreSQL query.
| SELECT CName FROM COURSE ORDER BY Credits |
What are the course names, ordered by credits? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the course names, ordered by credits?` to a syntactically-correct PostgreSQL query.
| SELECT CName FROM COURSE ORDER BY Credits |
Find the first name of students in the descending order of age. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the first name of students in the descending order of age.` to a syntactically-correct PostgreSQL query.
| SELECT Fname FROM STUDENT ORDER BY Age DESC |
What are the first names of students, ordered by age from greatest to least? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the first names of students, ordered by age from greatest to least?` to a syntactically-correct PostgreSQL query.
| SELECT Fname FROM STUDENT ORDER BY Age DESC |
Find the last name of female (sex is F) students in the descending order of age. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the last name of female (sex is F) students in the descending order of age.` to a syntactically-correct PostgreSQL query.
| SELECT LName FROM STUDENT WHERE Sex = "F" ORDER BY Age DESC |
What are the last names of female students, ordered by age descending? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the last names of female students, ordered by age descending?` to a syntactically-correct PostgreSQL query.
| SELECT LName FROM STUDENT WHERE Sex = "F" ORDER BY Age DESC |
Find the last names of faculties in building Barton in alphabetic order. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the last names of faculties in building Barton in alphabetic order.` to a syntactically-correct PostgreSQL query.
| SELECT Lname FROM FACULTY WHERE Building = "Barton" ORDER BY Lname |
What are the last names of faculty in building Barton, sorted by last name? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the last names of faculty in building Barton, sorted by last name?` to a syntactically-correct PostgreSQL query.
| SELECT Lname FROM FACULTY WHERE Building = "Barton" ORDER BY Lname |
Find the first names of faculties of rank Professor in alphabetic order. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the first names of faculties of rank Professor in alphabetic order.` to a syntactically-correct PostgreSQL query.
| SELECT Fname FROM FACULTY WHERE Rank = "Professor" ORDER BY Fname |
What are the first names for all faculty professors, ordered by first name? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the first names for all faculty professors, ordered by first name?` to a syntactically-correct PostgreSQL query.
| SELECT Fname FROM FACULTY WHERE Rank = "Professor" ORDER BY Fname |
Find the name of the department that has the biggest number of students minored in? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the name of the department that has the biggest number of students minored in?` to a syntactically-correct PostgreSQL query.
| SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY count(*) DESC LIMIT 1 |
What is the name of the department with the most students minoring in it? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What is the name of the department with the most students minoring in it?` to a syntactically-correct PostgreSQL query.
| SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY count(*) DESC LIMIT 1 |
Find the name of the department that has no students minored in? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the name of the department that has no students minored in?` to a syntactically-correct PostgreSQL query.
| SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO |
What is the name of the department htat has no students minoring in it? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What is the name of the department htat has no students minoring in it?` to a syntactically-correct PostgreSQL query.
| SELECT DName FROM DEPARTMENT EXCEPT SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MINOR_IN AS T2 ON T1.DNO = T2.DNO |
Find the name of the department that has the fewest members. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the name of the department that has the fewest members.` to a syntactically-correct PostgreSQL query.
| SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LIMIT 1 |
What is the name of the department with the fewest members? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What is the name of the department with the fewest members?` to a syntactically-correct PostgreSQL query.
| SELECT T1.DName FROM DEPARTMENT AS T1 JOIN MEMBER_OF AS T2 ON T1.DNO = T2.DNO GROUP BY T2.DNO ORDER BY count(*) ASC LIMIT 1 |
Find the rank of the faculty that the fewest faculties belong to. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the rank of the faculty that the fewest faculties belong to.` to a syntactically-correct PostgreSQL query.
| SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY count(*) ASC LIMIT 1 |
What is the least common faculty rank? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What is the least common faculty rank?` to a syntactically-correct PostgreSQL query.
| SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY count(*) ASC LIMIT 1 |
What are the first and last names of the instructors who teach the top 3 number of courses? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the first and last names of the instructors who teach the top 3 number of courses?` to a syntactically-correct PostgreSQL query.
| SELECT T2.Fname , T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 3 |
What are the full names of the 3 instructors who teach the most courses? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the full names of the 3 instructors who teach the most courses?` to a syntactically-correct PostgreSQL query.
| SELECT T2.Fname , T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 3 |
Which building does the instructor who teaches the most number of courses live in? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Which building does the instructor who teaches the most number of courses live in?` to a syntactically-correct PostgreSQL query.
| SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 1 |
Give the building that the instructor who teaches the greatest number of courses lives in. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Give the building that the instructor who teaches the greatest number of courses lives in.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Building FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 1 |
What are the name of courses that have at least five enrollments? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the name of courses that have at least five enrollments?` to a syntactically-correct PostgreSQL query.
| SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID = T2.CID GROUP BY T2.CID HAVING COUNT(*) >= 5 |
Give the names of the courses with at least five enrollments. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Give the names of the courses with at least five enrollments.` to a syntactically-correct PostgreSQL query.
| SELECT T1.CName FROM COURSE AS T1 JOIN ENROLLED_IN AS T2 ON T1.CID = T2.CID GROUP BY T2.CID HAVING COUNT(*) >= 5 |
Find the first name and last name of the instructor of course that has course name |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the first name and last name of the instructor of course that has course name` to a syntactically-correct PostgreSQL query.
| SELECT T2.Fname , T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID WHERE T1.CName = "COMPUTER LITERACY" |
What is the full name of the instructor who has a course named COMPUTER LITERACY? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What is the full name of the instructor who has a course named COMPUTER LITERACY?` to a syntactically-correct PostgreSQL query.
| SELECT T2.Fname , T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID WHERE T1.CName = "COMPUTER LITERACY" |
Find the department name and room of the course INTRODUCTION TO COMPUTER SCIENCE. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the department name and room of the course INTRODUCTION TO COMPUTER SCIENCE.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Dname , T2.Room FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DNO = T2.DNO WHERE T1.CName = "INTRODUCTION TO COMPUTER SCIENCE" |
What are the department name and room for the course INTRODUCTION TO COMPUTER SCIENCE? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the department name and room for the course INTRODUCTION TO COMPUTER SCIENCE?` to a syntactically-correct PostgreSQL query.
| SELECT T2.Dname , T2.Room FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DNO = T2.DNO WHERE T1.CName = "INTRODUCTION TO COMPUTER SCIENCE" |
Find the student first and last names and grade points of all enrollments. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the student first and last names and grade points of all enrollments.` to a syntactically-correct PostgreSQL query.
| SELECT T3.Fname , T3.LName , T2.gradepoint FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID |
What are the full names and gradepoints for all enrollments? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the full names and gradepoints for all enrollments?` to a syntactically-correct PostgreSQL query.
| SELECT T3.Fname , T3.LName , T2.gradepoint FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID |
Find the distinct student first names of all students that have grade point at least 3.8 in one course. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the distinct student first names of all students that have grade point at least 3.8 in one course.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T3.Fname FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T2.gradepoint >= 3.8 |
What are the distinct first names for students with a grade point of 3.8 or above in at least one course? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the distinct first names for students with a grade point of 3.8 or above in at least one course?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT T3.Fname FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T2.gradepoint >= 3.8 |
Find the full names of faculties who are members of department with department number 520. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the full names of faculties who are members of department with department number 520.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Fname , T1.Lname FROM FACULTY AS T1 JOIN MEMBER_OF AS T2 ON T1.FacID = T2.FacID WHERE T2.DNO = 520 |
What are the full names of faculty members who are a part of department 520? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the full names of faculty members who are a part of department 520?` to a syntactically-correct PostgreSQL query.
| SELECT T1.Fname , T1.Lname FROM FACULTY AS T1 JOIN MEMBER_OF AS T2 ON T1.FacID = T2.FacID WHERE T2.DNO = 520 |
What are the first names and last names of the students that minor in the department with DNO 140. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the first names and last names of the students that minor in the department with DNO 140.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Fname , T2.Lname FROM MINOR_IN AS T1 JOIN STUDENT AS T2 ON T1.StuID = T2.StuID WHERE T1.DNO = 140 |
What are the full names of students minoring in department 140? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the full names of students minoring in department 140?` to a syntactically-correct PostgreSQL query.
| SELECT T2.Fname , T2.Lname FROM MINOR_IN AS T1 JOIN STUDENT AS T2 ON T1.StuID = T2.StuID WHERE T1.DNO = 140 |
Find the last names of faculties who are members of computer science department. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the last names of faculties who are members of computer science department.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Lname FROM DEPARTMENT AS T1 JOIN FACULTY AS T2 ON T1.DNO = T3.DNO JOIN MEMBER_OF AS T3 ON T2.FacID = T3.FacID WHERE T1.DName = "Computer Science" |
What are the last names of faculty who are part of the computer science department? |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `What are the last names of faculty who are part of the computer science department?` to a syntactically-correct PostgreSQL query.
| SELECT T2.Lname FROM DEPARTMENT AS T1 JOIN FACULTY AS T2 ON T1.DNO = T3.DNO JOIN MEMBER_OF AS T3 ON T2.FacID = T3.FacID WHERE T1.DName = "Computer Science" |
Find the average grade point of student whose last name is Smith. |
-- Language PostgreSQL
-- Tables:
-- Table: student
columns : [['student id', 'number'], ['last name', 'text'], ['first name', 'text'], ['age', 'number'], ['sex', 'text'], ['major', 'number'], ['advisor', 'number'], ['city code', 'text']]
-- Table: faculty
columns : [['faculty id', 'number'], ['last name', 'text'], ['first name', 'text'], ['rank', 'text'], ['sex', 'text'], ['phone', 'number'], ['room', 'text'], ['building', 'text']]
-- Table: department
columns : [['department number', 'number'], ['division', 'text'], ['department name', 'text'], ['room', 'text'], ['building', 'text'], ['department phone', 'number']]
-- Table: member of
columns : [['faculty id', 'number'], ['department number', 'number'], ['appt type', 'text']]
-- Table: course
columns : [['course id', 'text'], ['course name', 'text'], ['credits', 'number'], ['instructor', 'number'], ['days', 'text'], ['hours', 'text'], ['department number', 'number']]
-- Table: minor in
columns : [['student id', 'number'], ['department number', 'number']]
-- Table: enrolled in
columns : [['student id', 'number'], ['course id', 'text'], ['grade', 'text']]
-- Table: grade conversion
columns : [['letter grade', 'text'], ['grade point', 'number']]
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.
Translate `Find the average grade point of student whose last name is Smith.` to a syntactically-correct PostgreSQL query.
| SELECT avg(T2.gradepoint) FROM ENROLLED_IN AS T1 JOIN GRADECONVERSION AS T2 JOIN STUDENT AS T3 ON T1.Grade = T2.lettergrade AND T1.StuID = T3.StuID WHERE T3.LName = "Smith" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.