brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
List lesson id of all lessons taught by staff with first name as Janessa, last name as Sawayn and nickname containing letter 's'.
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 lesson id of all lessons taught by staff with first name as Janessa, last name as Sawayn and nickname containing letter 's'.` to a syntactically-correct PostgreSQL query.
SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" AND nickname LIKE "%s%";
What are the the lesson ids of all staff taught by Janessa Sawayn whose nickname has the letter s?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 the lesson ids of all staff taught by Janessa Sawayn whose nickname has the letter s?` to a syntactically-correct PostgreSQL query.
SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" AND nickname LIKE "%s%";
How many lessons taught by staff whose first name has letter 'a' in it?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 lessons taught by staff whose first name has letter 'a' in it?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE "%a%"
How many lessons were taught by a staff member whose first name has the letter 'a' in it?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 lessons were taught by a staff member whose first name has the letter 'a' in it?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE "%a%"
How long is the total lesson time taught by staff with first name as Janessa and last name as Sawayn?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 long is the total lesson time taught by staff with first name as Janessa and last name as Sawayn?` to a syntactically-correct PostgreSQL query.
SELECT sum(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
What is the total time for all lessons taught by Janessa Sawayn?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 total time for all lessons taught by Janessa Sawayn?` to a syntactically-correct PostgreSQL query.
SELECT sum(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
What is average lesson price taught by staff with first name as Janessa and last name as Sawayn?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 average lesson price taught by staff with first name as Janessa and last name as Sawayn?` to a syntactically-correct PostgreSQL query.
SELECT avg(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
What is the average price for a lesson taught by Janessa Sawayn?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 average price for a lesson taught by Janessa Sawayn?` to a syntactically-correct PostgreSQL query.
SELECT avg(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn";
How many lesson does customer with first name Ray took?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 lesson does customer with first name Ray took?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Ray"
How many lessons did the customer with the first name Ray take?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 lessons did the customer with the first name Ray take?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Ray"
Which last names are both used by customers and by staff?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 last names are both used by customers and by staff?` to a syntactically-correct PostgreSQL query.
SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff
What are the last names that are used by customers and staff?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 that are used by customers and staff?` to a syntactically-correct PostgreSQL query.
SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff
What is the first name of the staff who did not give any lesson?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 first name of the staff who did not give any lesson?` to a syntactically-correct PostgreSQL query.
SELECT first_name FROM Staff EXCEPT SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id
What is the first name of all employees who do not give any lessons?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 first name of all employees who do not give any lessons?` to a syntactically-correct PostgreSQL query.
SELECT first_name FROM Staff EXCEPT SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id
What is the id and detail of the vehicle used in lessons for most of the times?
-- Language PostgreSQL -- Tables: -- Table: addresses columns : [['address id', 'number'], ['line 1 number building', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text']] -- Table: staff columns : [['staff id', 'number'], ['staff address id', 'number'], ['nickname', 'text'], ['first name', 'text'], ['middle name', 'text'], ['last name', 'text'], ['date of birth', 'time'], ['date joined staff', 'time'], ['date left staff', 'time']] -- Table: vehicles columns : [['vehicle id', 'number'], ['vehicle details', 'text']] -- Table: customers columns : [['customer id', 'number'], ['customer address id', 'number'], ['customer status code', 'text'], ['date became customer', 'time'], ['date of birth', 'time'], ['first name', 'text'], ['last name', 'text'], ['amount outstanding', 'number'], ['email address', 'text'], ['phone number', 'text'], ['cell mobile phone number', 'text']] -- Table: customer payments columns : [['customer id', 'number'], ['datetime payment', 'time'], ['payment method code', 'text'], ['amount payment', 'number']] -- Table: lessons columns : [['lesson id', 'number'], ['customer id', 'number'], ['lesson status code', 'text'], ['staff id', 'number'], ['vehicle id', 'number'], ['lesson date', 'time'], ['lesson time', 'text'], ['price', '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 id and detail of the vehicle used in lessons for most of the times?` to a syntactically-correct PostgreSQL query.
SELECT T1.vehicle_id , T1.vehicle_details FROM Vehicles AS T1 JOIN Lessons AS T2 ON T1.vehicle_id = T2.vehicle_id GROUP BY T1.vehicle_id ORDER BY count(*) DESC LIMIT 1
How many faculty do we have?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty do we have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Faculty
What is the total number of faculty members?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 total number of faculty members?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Faculty
What ranks do we have for faculty?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 ranks do we have for faculty?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT rank FROM Faculty
Find the list of distinct ranks for faculty.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 list of distinct ranks for faculty.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT rank FROM Faculty
Show all the distinct buildings that have faculty rooms.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 the distinct buildings that have faculty rooms.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT building FROM Faculty
What buildings have faculty offices?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 buildings have faculty offices?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT building FROM Faculty
Show the rank, first name, and last name for all the faculty.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 rank, first name, and last name for all the faculty.` to a syntactically-correct PostgreSQL query.
SELECT rank , Fname , Lname FROM Faculty
What are the rank, first name, and last name of the faculty members?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 rank, first name, and last name of the faculty members?` to a syntactically-correct PostgreSQL query.
SELECT rank , Fname , Lname FROM Faculty
Show the first name, last name, and phone number for all female faculty members.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 first name, last name, and phone number for all female faculty members.` to a syntactically-correct PostgreSQL query.
SELECT Fname , Lname , phone FROM Faculty WHERE Sex = 'F'
What are the first name, last name, and phone number of all the female faculty members?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 name, last name, and phone number of all the female faculty members?` to a syntactically-correct PostgreSQL query.
SELECT Fname , Lname , phone FROM Faculty WHERE Sex = 'F'
Show ids for all the male faculty.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 ids for all the male faculty.` to a syntactically-correct PostgreSQL query.
SELECT FacID FROM Faculty WHERE Sex = 'M'
What are the faculty ids of all the male faculty members?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty ids of all the male faculty members?` to a syntactically-correct PostgreSQL query.
SELECT FacID FROM Faculty WHERE Sex = 'M'
How many female Professors do we have?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 female Professors do we have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Faculty WHERE Sex = 'F' AND Rank = "Professor"
Count the number of female Professors we have.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 female Professors we have.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Faculty WHERE Sex = 'F' AND Rank = "Professor"
Show the phone, room, and building for the faculty named Jerry Prince.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 phone, room, and building for the faculty named Jerry Prince.` to a syntactically-correct PostgreSQL query.
SELECT phone , room , building FROM Faculty WHERE Fname = "Jerry" AND Lname = "Prince"
What are the phone, room, and building of the faculty member called Jerry Prince?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 phone, room, and building of the faculty member called Jerry Prince?` to a syntactically-correct PostgreSQL query.
SELECT phone , room , building FROM Faculty WHERE Fname = "Jerry" AND Lname = "Prince"
How many Professors are in building NEB?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 Professors are in building NEB?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Faculty WHERE Rank = "Professor" AND building = "NEB"
Count the number of Professors who have office in building NEB.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 Professors who have office in building NEB.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Faculty WHERE Rank = "Professor" AND building = "NEB"
Show the first name and last name for all the instructors.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 first name and last name for all the instructors.` to a syntactically-correct PostgreSQL query.
SELECT fname , lname FROM Faculty WHERE Rank = "Instructor"
What are the first name and last name of all the instructors?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 name and last name of all the instructors?` to a syntactically-correct PostgreSQL query.
SELECT fname , lname FROM Faculty WHERE Rank = "Instructor"
Show all the buildings along with the number of faculty members the buildings have.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 the buildings along with the number of faculty members the buildings have.` to a syntactically-correct PostgreSQL query.
SELECT building , count(*) FROM Faculty GROUP BY building
How many faculty members does each building have? List the result with the name of the building.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty members does each building have? List the result with the name of the building.` to a syntactically-correct PostgreSQL query.
SELECT building , count(*) FROM Faculty GROUP BY building
Which building has most faculty members?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 has most faculty members?` to a syntactically-correct PostgreSQL query.
SELECT building FROM Faculty GROUP BY building ORDER BY count(*) DESC LIMIT 1
Find the building that has the largest number of faculty members.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 building that has the largest number of faculty members.` to a syntactically-correct PostgreSQL query.
SELECT building FROM Faculty GROUP BY building ORDER BY count(*) DESC LIMIT 1
Show all the buildings that have at least 10 professors.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 the buildings that have at least 10 professors.` to a syntactically-correct PostgreSQL query.
SELECT building FROM Faculty WHERE rank = "Professor" GROUP BY building HAVING count(*) >= 10
In which buildings are there at least ten professors?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 buildings are there at least ten professors?` to a syntactically-correct PostgreSQL query.
SELECT building FROM Faculty WHERE rank = "Professor" GROUP BY building HAVING count(*) >= 10
For each faculty rank, show the number of faculty members who have it.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty rank, show the number of faculty members who have it.` to a syntactically-correct PostgreSQL query.
SELECT rank , count(*) FROM Faculty GROUP BY rank
How many faculty members do we have for each faculty rank?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty members do we have for each faculty rank?` to a syntactically-correct PostgreSQL query.
SELECT rank , count(*) FROM Faculty GROUP BY rank
Show all the ranks and the number of male and female faculty for each rank.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 the ranks and the number of male and female faculty for each rank.` to a syntactically-correct PostgreSQL query.
SELECT rank , sex , count(*) FROM Faculty GROUP BY rank , sex
How many faculty members do we have for each rank and gender?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty members do we have for each rank and gender?` to a syntactically-correct PostgreSQL query.
SELECT rank , sex , count(*) FROM Faculty GROUP BY rank , sex
Which rank has the smallest number of faculty members?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 rank has the smallest number of faculty members?` to a syntactically-correct PostgreSQL query.
SELECT rank FROM Faculty GROUP BY rank ORDER BY count(*) ASC LIMIT 1
Find the faculty rank that has the least members.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty rank that has the least members.` to a syntactically-correct PostgreSQL query.
SELECT rank FROM Faculty GROUP BY rank ORDER BY count(*) ASC LIMIT 1
Show the number of male and female assistant professors.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 male and female assistant professors.` to a syntactically-correct PostgreSQL query.
SELECT sex , count(*) FROM Faculty WHERE rank = "AsstProf" GROUP BY sex
How many male and female assistant professors do we have?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 male and female assistant professors do we have?` to a syntactically-correct PostgreSQL query.
SELECT sex , count(*) FROM Faculty WHERE rank = "AsstProf" GROUP BY sex
What are the first name and last name of Linda Smith's advisor?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 name and last name of Linda Smith's advisor?` to a syntactically-correct PostgreSQL query.
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T2.fname = "Linda" AND T2.lname = "Smith"
Who is the advisor of Linda Smith? Give me the first name and last name.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 `Who is the advisor of Linda Smith? Give me the first name and last name.` to a syntactically-correct PostgreSQL query.
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T2.fname = "Linda" AND T2.lname = "Smith"
Show the ids of students whose advisors are professors.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 of students whose advisors are professors.` to a syntactically-correct PostgreSQL query.
SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = "Professor"
Which students have professors as their advisors? Find their student ids.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 students have professors as their advisors? Find their student ids.` to a syntactically-correct PostgreSQL query.
SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = "Professor"
Show first name and last name for all the students advised by Michael Goodrich.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 first name and last name for all the students advised by Michael Goodrich.` to a syntactically-correct PostgreSQL query.
SELECT T2.fname , T2.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.fname = "Michael" AND T1.lname = "Goodrich"
Which students are advised by Michael Goodrich? Give me their first and last names.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 students are advised by Michael Goodrich? Give me their first and last names.` to a syntactically-correct PostgreSQL query.
SELECT T2.fname , T2.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.fname = "Michael" AND T1.lname = "Goodrich"
Show the faculty id of each faculty member, along with the number of students he or she advises.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty id of each faculty member, along with the number of students he or she advises.` to a syntactically-correct PostgreSQL query.
SELECT T1.FacID , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID
What are the faculty id and the number of students each faculty has?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty id and the number of students each faculty has?` to a syntactically-correct PostgreSQL query.
SELECT T1.FacID , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID
Show all the faculty ranks and the number of students advised by each rank.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 the faculty ranks and the number of students advised by each rank.` to a syntactically-correct PostgreSQL query.
SELECT T1.rank , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.rank
How many students are advised by each rank of faculty? List the rank and the number of students.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 are advised by each rank of faculty? List the rank and the number of students.` to a syntactically-correct PostgreSQL query.
SELECT T1.rank , count(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.rank
What are the first and last name of the faculty who has the most students?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 name of the faculty who has the most students?` to a syntactically-correct PostgreSQL query.
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID ORDER BY count(*) DESC LIMIT 1
Give me the the first and last name of the faculty who advises the most students.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 me the the first and last name of the faculty who advises the most students.` to a syntactically-correct PostgreSQL query.
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID ORDER BY count(*) DESC LIMIT 1
Show the ids for all the faculty members who have at least 2 students.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 for all the faculty members who have at least 2 students.` to a syntactically-correct PostgreSQL query.
SELECT T1.FacID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID HAVING count(*) >= 2
Which faculty members advise two ore more students? Give me their faculty ids.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty members advise two ore more students? Give me their faculty ids.` to a syntactically-correct PostgreSQL query.
SELECT T1.FacID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID HAVING count(*) >= 2
Show ids for the faculty members who don't advise any student.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 ids for the faculty members who don't advise any student.` to a syntactically-correct PostgreSQL query.
SELECT FacID FROM Faculty EXCEPT SELECT advisor FROM Student
What are the ids of the faculty members who do not advise any student.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 ids of the faculty members who do not advise any student.` to a syntactically-correct PostgreSQL query.
SELECT FacID FROM Faculty EXCEPT SELECT advisor FROM Student
What activities do we have?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 activities do we have?` to a syntactically-correct PostgreSQL query.
SELECT activity_name FROM Activity
List all the activities we have.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 the activities we have.` to a syntactically-correct PostgreSQL query.
SELECT activity_name FROM Activity
How many activities do we have?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 activities do we have?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Activity
Find the number of activities available.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 activities available.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Activity
How many faculty members participate in an activity?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty members participate in an activity?` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT FacID) FROM Faculty_participates_in
Give me the number of faculty members who participate in an activity
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 me the number of faculty members who participate in an activity` to a syntactically-correct PostgreSQL query.
SELECT count(DISTINCT FacID) FROM Faculty_participates_in
Show the ids of the faculty who don't participate in any activity.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 of the faculty who don't participate in any activity.` to a syntactically-correct PostgreSQL query.
SELECT FacID FROM Faculty EXCEPT SELECT FacID FROM Faculty_participates_in
Which faculty do not participate in any activity? Find their faculty ids.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty do not participate in any activity? Find their faculty ids.` to a syntactically-correct PostgreSQL query.
SELECT FacID FROM Faculty EXCEPT SELECT FacID FROM Faculty_participates_in
Show the ids of all the faculty members who participate in an activity and advise a student.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 of all the faculty members who participate in an activity and advise a student.` to a syntactically-correct PostgreSQL query.
SELECT FacID FROM Faculty_participates_in INTERSECT SELECT advisor FROM Student
What are ids of the faculty members who not only participate in an activity but also advise a student.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 ids of the faculty members who not only participate in an activity but also advise a student.` to a syntactically-correct PostgreSQL query.
SELECT FacID FROM Faculty_participates_in INTERSECT SELECT advisor FROM Student
How many activities does Mark Giuliano participate in?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 activities does Mark Giuliano participate in?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
Find the number of activities Mark Giuliano is involved in.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 activities Mark Giuliano is involved in.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
Show the names of all the activities Mark Giuliano participates in.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 all the activities Mark Giuliano participates in.` to a syntactically-correct PostgreSQL query.
SELECT T3.activity_name FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN Activity AS T3 ON T3.actid = T2.actid WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
What are the names of the activities Mark Giuliano is involved in
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 activities Mark Giuliano is involved in` to a syntactically-correct PostgreSQL query.
SELECT T3.activity_name FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN Activity AS T3 ON T3.actid = T2.actid WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
Show the first and last name of all the faculty members who participated in some activity, together with the number of activities they participated in.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 first and last name of all the faculty members who participated in some activity, together with the number of activities they participated in.` to a syntactically-correct PostgreSQL query.
SELECT T1.fname , T1.lname , count(*) , T1.FacID FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID
What is the first and last name of the faculty members who participated in at least one activity? For each of them, also show the number of activities they participated in.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 first and last name of the faculty members who participated in at least one activity? For each of them, also show the number of activities they participated in.` to a syntactically-correct PostgreSQL query.
SELECT T1.fname , T1.lname , count(*) , T1.FacID FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID
Show all the activity names and the number of faculty involved in each activity.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 the activity names and the number of faculty involved in each activity.` to a syntactically-correct PostgreSQL query.
SELECT T1.activity_name , count(*) FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID
How many faculty members participate in each activity? Return the activity names and the number of faculty members.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty members participate in each activity? Return the activity names and the number of faculty members.` to a syntactically-correct PostgreSQL query.
SELECT T1.activity_name , count(*) FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID
What is the first and last name of the faculty participating in the most activities?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 first and last name of the faculty participating in the most activities?` to a syntactically-correct PostgreSQL query.
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID ORDER BY count(*) DESC LIMIT 1
Find the first and last name of the faculty who is involved in the largest number of activities.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 and last name of the faculty who is involved in the largest number of activities.` to a syntactically-correct PostgreSQL query.
SELECT T1.fname , T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID ORDER BY count(*) DESC LIMIT 1
What is the name of the activity that has the most faculty members involved in?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 activity that has the most faculty members involved in?` to a syntactically-correct PostgreSQL query.
SELECT T1.activity_name FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY count(*) DESC LIMIT 1
Which activity has the most faculty members participating in? Find the activity name.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 activity has the most faculty members participating in? Find the activity name.` to a syntactically-correct PostgreSQL query.
SELECT T1.activity_name FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY count(*) DESC LIMIT 1
Show the ids of the students who don't participate in any activity.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 of the students who don't participate in any activity.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Participates_in
What are the ids of the students who are not involved in any activity
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 ids of the students who are not involved in any activity` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Participates_in
Show the ids for all the students who participate in an activity and are under 20.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 for all the students who participate in an activity and are under 20.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Participates_in INTERSECT SELECT StuID FROM Student WHERE age < 20
What are the ids of the students who are under 20 years old and are involved in at least one activity.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 ids of the students who are under 20 years old and are involved in at least one activity.` to a syntactically-correct PostgreSQL query.
SELECT StuID FROM Participates_in INTERSECT SELECT StuID FROM Student WHERE age < 20
What is the first and last name of the student participating in the most activities?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 first and last name of the student participating in the most activities?` to a syntactically-correct PostgreSQL query.
SELECT T1.fname , T1.lname FROM Student AS T1 JOIN Participates_in AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
Tell me the first and last name of the student who has the most activities.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 `Tell me the first and last name of the student who has the most activities.` to a syntactically-correct PostgreSQL query.
SELECT T1.fname , T1.lname FROM Student AS T1 JOIN Participates_in AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
What is the name of the activity with the most students?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 activity with the most students?` to a syntactically-correct PostgreSQL query.
SELECT T1.activity_name FROM Activity AS T1 JOIN Participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY count(*) DESC LIMIT 1
Find the name of the activity that has the largest number of student participants.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 activity that has the largest number of student participants.` to a syntactically-correct PostgreSQL query.
SELECT T1.activity_name FROM Activity AS T1 JOIN Participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY count(*) DESC LIMIT 1
Find the first names of the faculty members who are playing Canoeing or Kayaking.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 the faculty members who are playing Canoeing or Kayaking.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
Which faculty members are playing either Canoeing or Kayaking? Tell me their first names.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 faculty members are playing either Canoeing or Kayaking? Tell me their first names.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
Find the first names of professors who are not playing Canoeing or Kayaking.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 professors who are not playing Canoeing or Kayaking.` to a syntactically-correct PostgreSQL query.
SELECT lname FROM faculty WHERE rank = 'Professor' EXCEPT SELECT DISTINCT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
What are the first names of the professors who do not play Canoeing or Kayaking as activities?
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 the professors who do not play Canoeing or Kayaking as activities?` to a syntactically-correct PostgreSQL query.
SELECT lname FROM faculty WHERE rank = 'Professor' EXCEPT SELECT DISTINCT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
Find the first names of the faculty members who participate in Canoeing and Kayaking.
-- Language PostgreSQL -- Tables: -- Table: activity columns : [['activity id', 'number'], ['activity name', 'text']] -- Table: participates in columns : [['student id', 'number'], ['activity id', 'number']] -- Table: faculty participates in columns : [['faculty id', 'number'], ['activity id', 'number']] -- 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']] 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 the faculty members who participate in Canoeing and Kayaking.` to a syntactically-correct PostgreSQL query.
SELECT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' INTERSECT SELECT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Kayaking'