answer stringlengths 18 557 | context stringlengths 27 489 | question stringlengths 12 244 | text stringlengths 275 1.7k |
|---|---|---|---|
SELECT COUNT(*) FROM railway | CREATE TABLE railway (Id VARCHAR) | How many railways are there? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM railway Context: CREATE TABLE railway (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many railways are there? The answer to your question is: SELECT COUNT(*) FROM railway. [/s> |
SELECT Builder FROM railway ORDER BY Builder | CREATE TABLE railway (Builder VARCHAR) | List the builders of railways in ascending alphabetical order. | <s>[INST] Given the following SQL query and context: Query: SELECT Builder FROM railway ORDER BY Builder Context: CREATE TABLE railway (Builder VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the builders of railways in ascending alphabetical order. The answer to your question is: S... |
SELECT Wheels, LOCATION FROM railway | CREATE TABLE railway (Wheels VARCHAR, LOCATION VARCHAR) | List the wheels and locations of the railways. | <s>[INST] Given the following SQL query and context: Query: SELECT Wheels, LOCATION FROM railway Context: CREATE TABLE railway (Wheels VARCHAR, LOCATION VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the wheels and locations of the railways. The answer to your question is: SELECT W... |
SELECT MAX(LEVEL) FROM manager WHERE Country <> "Australia " | CREATE TABLE manager (LEVEL INTEGER, Country VARCHAR) | What is the maximum level of managers in countries that are not "Australia"? | <s>[INST] Given the following SQL query and context: Query: SELECT MAX(LEVEL) FROM manager WHERE Country <> "Australia " Context: CREATE TABLE manager (LEVEL INTEGER, Country VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the maximum level of managers in countries that are not "... |
SELECT AVG(Age) FROM manager | CREATE TABLE manager (Age INTEGER) | What is the average age for all managers? | <s>[INST] Given the following SQL query and context: Query: SELECT AVG(Age) FROM manager Context: CREATE TABLE manager (Age INTEGER) [/INST] Based on the provided SQL query and context, your question is: What is the average age for all managers? The answer to your question is: SELECT AVG(Age) FROM manager. [/s> |
SELECT Name FROM manager ORDER BY LEVEL | CREATE TABLE manager (Name VARCHAR, LEVEL VARCHAR) | What are the names of managers in ascending order of level? | <s>[INST] Given the following SQL query and context: Query: SELECT Name FROM manager ORDER BY LEVEL Context: CREATE TABLE manager (Name VARCHAR, LEVEL VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the names of managers in ascending order of level? The answer to your question i... |
SELECT Name, Arrival FROM train | CREATE TABLE train (Name VARCHAR, Arrival VARCHAR) | What are the names and arrival times of trains? | <s>[INST] Given the following SQL query and context: Query: SELECT Name, Arrival FROM train Context: CREATE TABLE train (Name VARCHAR, Arrival VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the names and arrival times of trains? The answer to your question is: SELECT Name, Arri... |
SELECT Name FROM manager ORDER BY Age DESC LIMIT 1 | CREATE TABLE manager (Name VARCHAR, Age VARCHAR) | What is the name of the oldest manager? | <s>[INST] Given the following SQL query and context: Query: SELECT Name FROM manager ORDER BY Age DESC LIMIT 1 Context: CREATE TABLE manager (Name VARCHAR, Age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the name of the oldest manager? The answer to your question is: SELECT N... |
SELECT T2.Name, T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID | CREATE TABLE railway (Location VARCHAR, Railway_ID VARCHAR); CREATE TABLE train (Name VARCHAR, Railway_ID VARCHAR) | Show the names of trains and locations of railways they are in. | <s>[INST] Given the following SQL query and context: Query: SELECT T2.Name, T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID Context: CREATE TABLE railway (Location VARCHAR, Railway_ID VARCHAR); CREATE TABLE train (Name VARCHAR, Railway_ID VARCHAR) [/INST] Based on the provided SQL query... |
SELECT T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID WHERE T2.Name = "Andaman Exp" | CREATE TABLE railway (Builder VARCHAR, Railway_ID VARCHAR); CREATE TABLE train (Railway_ID VARCHAR, Name VARCHAR) | Show the builder of railways associated with the trains named "Andaman Exp". | <s>[INST] Given the following SQL query and context: Query: SELECT T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID WHERE T2.Name = "Andaman Exp" Context: CREATE TABLE railway (Builder VARCHAR, Railway_ID VARCHAR); CREATE TABLE train (Railway_ID VARCHAR, Name VARCHAR) [/INST] Based on the... |
SELECT T2.Railway_ID, T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID HAVING COUNT(*) > 1 | CREATE TABLE railway (Location VARCHAR, Railway_ID VARCHAR); CREATE TABLE train (Railway_ID VARCHAR) | Show id and location of railways that are associated with more than one train. | <s>[INST] Given the following SQL query and context: Query: SELECT T2.Railway_ID, T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID HAVING COUNT(*) > 1 Context: CREATE TABLE railway (Location VARCHAR, Railway_ID VARCHAR); CREATE TABLE train (Railway_ID VARCHAR) [/IN... |
SELECT T2.Railway_ID, T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE train (Railway_ID VARCHAR); CREATE TABLE railway (Builder VARCHAR, Railway_ID VARCHAR) | Show the id and builder of the railway that are associated with the most trains. | <s>[INST] Given the following SQL query and context: Query: SELECT T2.Railway_ID, T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE train (Railway_ID VARCHAR); CREATE TABLE railway (Builder VARCHAR, Railway_ID VARC... |
SELECT Builder, COUNT(*) FROM railway GROUP BY Builder | CREATE TABLE railway (Builder VARCHAR) | Show different builders of railways, along with the corresponding number of railways using each builder. | <s>[INST] Given the following SQL query and context: Query: SELECT Builder, COUNT(*) FROM railway GROUP BY Builder Context: CREATE TABLE railway (Builder VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show different builders of railways, along with the corresponding number of railways u... |
SELECT Builder FROM railway GROUP BY Builder ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE railway (Builder VARCHAR) | Show the most common builder of railways. | <s>[INST] Given the following SQL query and context: Query: SELECT Builder FROM railway GROUP BY Builder ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE railway (Builder VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the most common builder of railways. The answer to your ques... |
SELECT LOCATION, COUNT(*) FROM railway GROUP BY LOCATION | CREATE TABLE railway (LOCATION VARCHAR) | Show different locations of railways along with the corresponding number of railways at each location. | <s>[INST] Given the following SQL query and context: Query: SELECT LOCATION, COUNT(*) FROM railway GROUP BY LOCATION Context: CREATE TABLE railway (LOCATION VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show different locations of railways along with the corresponding number of railway... |
SELECT LOCATION FROM railway GROUP BY LOCATION HAVING COUNT(*) > 1 | CREATE TABLE railway (LOCATION VARCHAR) | Show the locations that have more than one railways. | <s>[INST] Given the following SQL query and context: Query: SELECT LOCATION FROM railway GROUP BY LOCATION HAVING COUNT(*) > 1 Context: CREATE TABLE railway (LOCATION VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the locations that have more than one railways. The answer to your q... |
SELECT ObjectNumber FROM railway WHERE NOT Railway_ID IN (SELECT Railway_ID FROM train) | CREATE TABLE train (ObjectNumber VARCHAR, Railway_ID VARCHAR); CREATE TABLE railway (ObjectNumber VARCHAR, Railway_ID VARCHAR) | List the object number of railways that do not have any trains. | <s>[INST] Given the following SQL query and context: Query: SELECT ObjectNumber FROM railway WHERE NOT Railway_ID IN (SELECT Railway_ID FROM train) Context: CREATE TABLE train (ObjectNumber VARCHAR, Railway_ID VARCHAR); CREATE TABLE railway (ObjectNumber VARCHAR, Railway_ID VARCHAR) [/INST] Based on the provided SQL qu... |
SELECT Country FROM manager WHERE Age > 50 INTERSECT SELECT Country FROM manager WHERE Age < 46 | CREATE TABLE manager (Country VARCHAR, Age INTEGER) | Show the countries that have both managers of age above 50 and managers of age below 46. | <s>[INST] Given the following SQL query and context: Query: SELECT Country FROM manager WHERE Age > 50 INTERSECT SELECT Country FROM manager WHERE Age < 46 Context: CREATE TABLE manager (Country VARCHAR, Age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show the countries that have bot... |
SELECT DISTINCT Country FROM manager | CREATE TABLE manager (Country VARCHAR) | Show the distinct countries of managers. | <s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT Country FROM manager Context: CREATE TABLE manager (Country VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the distinct countries of managers. The answer to your question is: SELECT DISTINCT Country FROM ma... |
SELECT Working_year_starts FROM manager ORDER BY LEVEL DESC | CREATE TABLE manager (Working_year_starts VARCHAR, LEVEL VARCHAR) | Show the working years of managers in descending order of their level. | <s>[INST] Given the following SQL query and context: Query: SELECT Working_year_starts FROM manager ORDER BY LEVEL DESC Context: CREATE TABLE manager (Working_year_starts VARCHAR, LEVEL VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the working years of managers in descending order... |
SELECT Country FROM manager WHERE Age > 50 OR Age < 46 | CREATE TABLE manager (Country VARCHAR, Age VARCHAR) | Show the countries that have managers of age above 50 or below 46. | <s>[INST] Given the following SQL query and context: Query: SELECT Country FROM manager WHERE Age > 50 OR Age < 46 Context: CREATE TABLE manager (Country VARCHAR, Age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the countries that have managers of age above 50 or below 46. The an... |
SELECT COUNT(*) FROM addresses WHERE country = 'USA' | CREATE TABLE addresses (country VARCHAR) | How many addresses are there in country USA? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM addresses WHERE country = 'USA' Context: CREATE TABLE addresses (country VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many addresses are there in country USA? The answer to your question is: SELECT CO... |
SELECT DISTINCT city FROM addresses | CREATE TABLE addresses (city VARCHAR) | Show all distinct cities in the address record. | <s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT city FROM addresses Context: CREATE TABLE addresses (city VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all distinct cities in the address record. The answer to your question is: SELECT DISTINCT city FROM ... |
SELECT state_province_county, COUNT(*) FROM addresses GROUP BY state_province_county | CREATE TABLE addresses (state_province_county VARCHAR) | Show each state and the number of addresses in each state. | <s>[INST] Given the following SQL query and context: Query: SELECT state_province_county, COUNT(*) FROM addresses GROUP BY state_province_county Context: CREATE TABLE addresses (state_province_county VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show each state and the number of addres... |
SELECT customer_name, customer_phone FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM customer_address_history) | CREATE TABLE customer_address_history (customer_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR) | Show names and phones of customers who do not have address information. | <s>[INST] Given the following SQL query and context: Query: SELECT customer_name, customer_phone FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM customer_address_history) Context: CREATE TABLE customer_address_history (customer_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE cu... |
SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR) | Show the name of the customer who has the most orders. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE custome... |
SELECT product_type_code FROM products GROUP BY product_type_code HAVING COUNT(*) >= 2 | CREATE TABLE products (product_type_code VARCHAR) | Show the product type codes which have at least two products. | <s>[INST] Given the following SQL query and context: Query: SELECT product_type_code FROM products GROUP BY product_type_code HAVING COUNT(*) >= 2 Context: CREATE TABLE products (product_type_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the product type codes which have at l... |
SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Completed' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Part' | CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_status_code VARCHAR) | Show the names of customers who have both an order in completed status and an order in part status. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Completed' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.custome... |
SELECT customer_name, customer_phone, payment_method_code FROM customers ORDER BY customer_number DESC | CREATE TABLE customers (customer_name VARCHAR, customer_phone VARCHAR, payment_method_code VARCHAR, customer_number VARCHAR) | Show the name, phone, and payment method code for all customers in descending order of customer number. | <s>[INST] Given the following SQL query and context: Query: SELECT customer_name, customer_phone, payment_method_code FROM customers ORDER BY customer_number DESC Context: CREATE TABLE customers (customer_name VARCHAR, customer_phone VARCHAR, payment_method_code VARCHAR, customer_number VARCHAR) [/INST] Based on the pr... |
SELECT T1.product_name, SUM(T2.order_quantity) FROM products AS T1 JOIN order_items AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id | CREATE TABLE products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE order_items (order_quantity INTEGER, product_id VARCHAR) | Show the product name and total order quantity for each product. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.product_name, SUM(T2.order_quantity) FROM products AS T1 JOIN order_items AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id Context: CREATE TABLE products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE order_items (order_quantit... |
SELECT MIN(product_price), MAX(product_price), AVG(product_price) FROM products | CREATE TABLE products (product_price INTEGER) | Show the minimum, maximum, average price for all products. | <s>[INST] Given the following SQL query and context: Query: SELECT MIN(product_price), MAX(product_price), AVG(product_price) FROM products Context: CREATE TABLE products (product_price INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show the minimum, maximum, average price for all produ... |
SELECT COUNT(*) FROM products WHERE product_price > (SELECT AVG(product_price) FROM products) | CREATE TABLE products (product_price INTEGER) | How many products have a price higher than the average? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM products WHERE product_price > (SELECT AVG(product_price) FROM products) Context: CREATE TABLE products (product_price INTEGER) [/INST] Based on the provided SQL query and context, your question is: How many products have a price higher th... |
SELECT T2.customer_name, T3.city, T1.date_from, T1.date_to FROM customer_address_history AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id JOIN addresses AS T3 ON T1.address_id = T3.address_id | CREATE TABLE addresses (city VARCHAR, address_id VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR); CREATE TABLE customer_address_history (date_from VARCHAR, date_to VARCHAR, customer_id VARCHAR, address_id VARCHAR) | Show the customer name, customer address city, date from, and date to for each customer address history. | <s>[INST] Given the following SQL query and context: Query: SELECT T2.customer_name, T3.city, T1.date_from, T1.date_to FROM customer_address_history AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id JOIN addresses AS T3 ON T1.address_id = T3.address_id Context: CREATE TABLE addresses (city VARCHAR, address_... |
SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_method_code = 'Credit Card' GROUP BY T1.customer_id HAVING COUNT(*) > 2 | CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR, payment_method_code VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR) | Show the names of customers who use Credit Card payment method and have more than 2 orders. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_method_code = 'Credit Card' GROUP BY T1.customer_id HAVING COUNT(*) > 2 Context: CREATE TABLE customers (customer_name VARCHAR, customer... |
SELECT T1.customer_name, T1.customer_phone FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T3.order_id = T2.order_id GROUP BY T1.customer_id ORDER BY SUM(T3.order_quantity) DESC LIMIT 1 | CREATE TABLE order_items (order_id VARCHAR, order_quantity INTEGER); CREATE TABLE customers (customer_name VARCHAR, customer_phone VARCHAR, customer_id VARCHAR); CREATE TABLE customer_orders (customer_id VARCHAR, order_id VARCHAR) | What are the name and phone of the customer with the most ordered product quantity? | <s>[INST] Given the following SQL query and context: Query: SELECT T1.customer_name, T1.customer_phone FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T3.order_id = T2.order_id GROUP BY T1.customer_id ORDER BY SUM(T3.order_quantity) DESC LIMIT 1 Context: CREA... |
SELECT product_type_code, product_name FROM products WHERE product_price > 1000 OR product_price < 500 | CREATE TABLE products (product_type_code VARCHAR, product_name VARCHAR, product_price VARCHAR) | Show the product type and name for the products with price higher than 1000 or lower than 500. | <s>[INST] Given the following SQL query and context: Query: SELECT product_type_code, product_name FROM products WHERE product_price > 1000 OR product_price < 500 Context: CREATE TABLE products (product_type_code VARCHAR, product_name VARCHAR, product_price VARCHAR) [/INST] Based on the provided SQL query and context, ... |
SELECT dorm_name FROM dorm WHERE gender = 'F' | CREATE TABLE dorm (dorm_name VARCHAR, gender VARCHAR) | Find the name of dorms only for female (F gender). | <s>[INST] Given the following SQL query and context: Query: SELECT dorm_name FROM dorm WHERE gender = 'F' Context: CREATE TABLE dorm (dorm_name VARCHAR, gender VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the name of dorms only for female (F gender). The answer to your question i... |
SELECT dorm_name FROM dorm WHERE student_capacity > 300 | CREATE TABLE dorm (dorm_name VARCHAR, student_capacity INTEGER) | Find the name of dorms that can accommodate more than 300 students. | <s>[INST] Given the following SQL query and context: Query: SELECT dorm_name FROM dorm WHERE student_capacity > 300 Context: CREATE TABLE dorm (dorm_name VARCHAR, student_capacity INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the name of dorms that can accommodate more than 300 st... |
SELECT COUNT(*) FROM student WHERE sex = 'F' AND age < 25 | CREATE TABLE student (sex VARCHAR, age VARCHAR) | How many female students (sex is F) whose age is below 25? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM student WHERE sex = 'F' AND age < 25 Context: CREATE TABLE student (sex VARCHAR, age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many female students (sex is F) whose age is below 25? The answer to y... |
SELECT fname FROM student WHERE age > 20 | CREATE TABLE student (fname VARCHAR, age INTEGER) | Find the first name of students who is older than 20. | <s>[INST] Given the following SQL query and context: Query: SELECT fname FROM student WHERE age > 20 Context: CREATE TABLE student (fname VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the first name of students who is older than 20. The answer to your question is: SEL... |
SELECT fname FROM student WHERE city_code = 'PHL' AND age BETWEEN 20 AND 25 | CREATE TABLE student (fname VARCHAR, city_code VARCHAR, age VARCHAR) | Find the first name of students living in city PHL whose age is between 20 and 25. | <s>[INST] Given the following SQL query and context: Query: SELECT fname FROM student WHERE city_code = 'PHL' AND age BETWEEN 20 AND 25 Context: CREATE TABLE student (fname VARCHAR, city_code VARCHAR, age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the first name of students liv... |
SELECT COUNT(*) FROM dorm | CREATE TABLE dorm (Id VARCHAR) | How many dorms are there? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM dorm Context: CREATE TABLE dorm (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many dorms are there? The answer to your question is: SELECT COUNT(*) FROM dorm. [/s> |
SELECT COUNT(*) FROM dorm_amenity | CREATE TABLE dorm_amenity (Id VARCHAR) | Find the number of distinct amenities. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM dorm_amenity Context: CREATE TABLE dorm_amenity (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number of distinct amenities. The answer to your question is: SELECT COUNT(*) FROM dorm_amenity. [... |
SELECT SUM(student_capacity) FROM dorm | CREATE TABLE dorm (student_capacity INTEGER) | Find the total capacity of all dorms. | <s>[INST] Given the following SQL query and context: Query: SELECT SUM(student_capacity) FROM dorm Context: CREATE TABLE dorm (student_capacity INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the total capacity of all dorms. The answer to your question is: SELECT SUM(student_capacit... |
SELECT AVG(age), city_code FROM student GROUP BY city_code | CREATE TABLE student (city_code VARCHAR, age INTEGER) | Find the average age of all students living in the each city. | <s>[INST] Given the following SQL query and context: Query: SELECT AVG(age), city_code FROM student GROUP BY city_code Context: CREATE TABLE student (city_code VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the average age of all students living in the each city. The a... |
SELECT AVG(student_capacity), SUM(student_capacity) FROM dorm WHERE gender = 'X' | CREATE TABLE dorm (student_capacity INTEGER, gender VARCHAR) | Find the average and total capacity of dorms for the students with gender X. | <s>[INST] Given the following SQL query and context: Query: SELECT AVG(student_capacity), SUM(student_capacity) FROM dorm WHERE gender = 'X' Context: CREATE TABLE dorm (student_capacity INTEGER, gender VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the average and total capacity of... |
SELECT COUNT(DISTINCT dormid) FROM has_amenity | CREATE TABLE has_amenity (dormid VARCHAR) | Find the number of dorms that have some amenity. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT dormid) FROM has_amenity Context: CREATE TABLE has_amenity (dormid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number of dorms that have some amenity. The answer to your question is: SELECT COU... |
SELECT dorm_name FROM dorm WHERE NOT dormid IN (SELECT dormid FROM has_amenity) | CREATE TABLE dorm (dorm_name VARCHAR, dormid VARCHAR); CREATE TABLE has_amenity (dorm_name VARCHAR, dormid VARCHAR) | Find the name of dorms that do not have any amenity | <s>[INST] Given the following SQL query and context: Query: SELECT dorm_name FROM dorm WHERE NOT dormid IN (SELECT dormid FROM has_amenity) Context: CREATE TABLE dorm (dorm_name VARCHAR, dormid VARCHAR); CREATE TABLE has_amenity (dorm_name VARCHAR, dormid VARCHAR) [/INST] Based on the provided SQL query and context, yo... |
SELECT COUNT(DISTINCT gender) FROM dorm | CREATE TABLE dorm (gender VARCHAR) | Find the number of distinct gender for dorms. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT gender) FROM dorm Context: CREATE TABLE dorm (gender VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number of distinct gender for dorms. The answer to your question is: SELECT COUNT(DISTINCT gende... |
SELECT student_capacity, gender FROM dorm WHERE dorm_name LIKE '%Donor%' | CREATE TABLE dorm (student_capacity VARCHAR, gender VARCHAR, dorm_name VARCHAR) | Find the capacity and gender type of the dorm whose name has substring ‘Donor’. | <s>[INST] Given the following SQL query and context: Query: SELECT student_capacity, gender FROM dorm WHERE dorm_name LIKE '%Donor%' Context: CREATE TABLE dorm (student_capacity VARCHAR, gender VARCHAR, dorm_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the capacity and gende... |
SELECT dorm_name, gender FROM dorm WHERE student_capacity > 300 OR student_capacity < 100 | CREATE TABLE dorm (dorm_name VARCHAR, gender VARCHAR, student_capacity VARCHAR) | Find the name and gender type of the dorms whose capacity is greater than 300 or less than 100. | <s>[INST] Given the following SQL query and context: Query: SELECT dorm_name, gender FROM dorm WHERE student_capacity > 300 OR student_capacity < 100 Context: CREATE TABLE dorm (dorm_name VARCHAR, gender VARCHAR, student_capacity VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the n... |
SELECT COUNT(DISTINCT major), COUNT(DISTINCT city_code) FROM student | CREATE TABLE student (major VARCHAR, city_code VARCHAR) | Find the numbers of different majors and cities. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT major), COUNT(DISTINCT city_code) FROM student Context: CREATE TABLE student (major VARCHAR, city_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the numbers of different majors and cities. The an... |
SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' INTERSECT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3... | CREATE TABLE dorm (dorm_name VARCHAR, dormid VARCHAR); CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR); CREATE TABLE dorm_amenity (amenid VARCHAR, amenity_name VARCHAR) | Find the name of dorms which have both TV Lounge and Study Room as amenities. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' INTERSECT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dorm... |
SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.am... | CREATE TABLE dorm (dorm_name VARCHAR, dormid VARCHAR); CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR); CREATE TABLE dorm_amenity (amenid VARCHAR, amenity_name VARCHAR) | Find the name of dorms which have TV Lounge but no Study Room as amenity. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid ... |
SELECT lname FROM student WHERE sex = 'F' AND city_code = 'BAL' UNION SELECT lname FROM student WHERE sex = 'M' AND age < 20 | CREATE TABLE student (lname VARCHAR, sex VARCHAR, city_code VARCHAR, age VARCHAR) | Find the last name of students who is either female (sex is F) and living in the city of code BAL or male (sex is M) and in age of below 20. | <s>[INST] Given the following SQL query and context: Query: SELECT lname FROM student WHERE sex = 'F' AND city_code = 'BAL' UNION SELECT lname FROM student WHERE sex = 'M' AND age < 20 Context: CREATE TABLE student (lname VARCHAR, sex VARCHAR, city_code VARCHAR, age VARCHAR) [/INST] Based on the provided SQL query and ... |
SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1 | CREATE TABLE dorm (dorm_name VARCHAR, student_capacity VARCHAR) | Find the name of the dorm with the largest capacity. | <s>[INST] Given the following SQL query and context: Query: SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1 Context: CREATE TABLE dorm (dorm_name VARCHAR, student_capacity VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the name of the dorm with the largest capacit... |
SELECT amenity_name FROM dorm_amenity ORDER BY amenity_name | CREATE TABLE dorm_amenity (amenity_name VARCHAR) | List in alphabetic order all different amenities. | <s>[INST] Given the following SQL query and context: Query: SELECT amenity_name FROM dorm_amenity ORDER BY amenity_name Context: CREATE TABLE dorm_amenity (amenity_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List in alphabetic order all different amenities. The answer to your qu... |
SELECT city_code FROM student GROUP BY city_code ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE student (city_code VARCHAR) | Find the code of city where most of students are living in. | <s>[INST] Given the following SQL query and context: Query: SELECT city_code FROM student GROUP BY city_code ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE student (city_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the code of city where most of students are living in.... |
SELECT fname, lname FROM student WHERE age < (SELECT AVG(age) FROM student) | CREATE TABLE student (fname VARCHAR, lname VARCHAR, age INTEGER) | Find the first and last name of students whose age is younger than the average age. | <s>[INST] Given the following SQL query and context: Query: SELECT fname, lname FROM student WHERE age < (SELECT AVG(age) FROM student) Context: CREATE TABLE student (fname VARCHAR, lname VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the first and last name of student... |
SELECT fname, lname FROM student WHERE city_code <> 'HKG' ORDER BY age | CREATE TABLE student (fname VARCHAR, lname VARCHAR, city_code VARCHAR, age VARCHAR) | List the first and last name of students who are not living in the city with code HKG, and sorted the results by their ages. | <s>[INST] Given the following SQL query and context: Query: SELECT fname, lname FROM student WHERE city_code <> 'HKG' ORDER BY age Context: CREATE TABLE student (fname VARCHAR, lname VARCHAR, city_code VARCHAR, age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the first and last n... |
SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T2.amenid = T1.amenid JOIN dorm AS T3 ON T2.dormid = T3.dormid WHERE T3.dorm_name = 'Anonymous Donor Hall' ORDER BY T1.amenity_name | CREATE TABLE has_amenity (amenid VARCHAR, dormid VARCHAR); CREATE TABLE dorm_amenity (amenity_name VARCHAR, amenid VARCHAR); CREATE TABLE dorm (dormid VARCHAR, dorm_name VARCHAR) | List name of all amenities which Anonymous Donor Hall has, and sort the results in alphabetic order. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T2.amenid = T1.amenid JOIN dorm AS T3 ON T2.dormid = T3.dormid WHERE T3.dorm_name = 'Anonymous Donor Hall' ORDER BY T1.amenity_name Context: CREATE TABLE has_amenity (amenid VARCHAR, dorm... |
SELECT COUNT(*), SUM(student_capacity), gender FROM dorm GROUP BY gender | CREATE TABLE dorm (gender VARCHAR, student_capacity INTEGER) | Find the number of dorms and total capacity for each gender. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*), SUM(student_capacity), gender FROM dorm GROUP BY gender Context: CREATE TABLE dorm (gender VARCHAR, student_capacity INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the number of dorms and total capacity fo... |
SELECT AVG(age), MAX(age), sex FROM student GROUP BY sex | CREATE TABLE student (sex VARCHAR, age INTEGER) | Find the average and oldest age for students with different sex. | <s>[INST] Given the following SQL query and context: Query: SELECT AVG(age), MAX(age), sex FROM student GROUP BY sex Context: CREATE TABLE student (sex VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the average and oldest age for students with different sex. The answer... |
SELECT COUNT(*), major FROM student GROUP BY major | CREATE TABLE student (major VARCHAR) | Find the number of students in each major. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*), major FROM student GROUP BY major Context: CREATE TABLE student (major VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number of students in each major. The answer to your question is: SELECT COUNT(*), ... |
SELECT COUNT(*), AVG(age), city_code FROM student GROUP BY city_code | CREATE TABLE student (city_code VARCHAR, age INTEGER) | Find the number and average age of students living in each city. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*), AVG(age), city_code FROM student GROUP BY city_code Context: CREATE TABLE student (city_code VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the number and average age of students living in eac... |
SELECT COUNT(*), AVG(age), city_code FROM student WHERE sex = 'M' GROUP BY city_code | CREATE TABLE student (city_code VARCHAR, age INTEGER, sex VARCHAR) | Find the average age and number of male students (with sex M) from each city. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*), AVG(age), city_code FROM student WHERE sex = 'M' GROUP BY city_code Context: CREATE TABLE student (city_code VARCHAR, age INTEGER, sex VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the average age and num... |
SELECT COUNT(*), city_code FROM student GROUP BY city_code HAVING COUNT(*) > 1 | CREATE TABLE student (city_code VARCHAR) | Find the number of students for the cities where have more than one student. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*), city_code FROM student GROUP BY city_code HAVING COUNT(*) > 1 Context: CREATE TABLE student (city_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number of students for the cities where have more t... |
SELECT fname, lname FROM student WHERE major <> (SELECT major FROM student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1) | CREATE TABLE student (fname VARCHAR, lname VARCHAR, major VARCHAR) | Find the first and last name of students who are not in the largest major. | <s>[INST] Given the following SQL query and context: Query: SELECT fname, lname FROM student WHERE major <> (SELECT major FROM student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1) Context: CREATE TABLE student (fname VARCHAR, lname VARCHAR, major VARCHAR) [/INST] Based on the provided SQL query and context, your ques... |
SELECT COUNT(*), sex FROM student WHERE age > (SELECT AVG(age) FROM student) GROUP BY sex | CREATE TABLE student (sex VARCHAR, age INTEGER) | Find the number of students whose age is older than the average age for each gender. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*), sex FROM student WHERE age > (SELECT AVG(age) FROM student) GROUP BY sex Context: CREATE TABLE student (sex VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Find the number of students whose age is o... |
SELECT AVG(T1.age), T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name | CREATE TABLE dorm (dorm_name VARCHAR, dormid VARCHAR); CREATE TABLE student (age INTEGER, stuid VARCHAR); CREATE TABLE lives_in (stuid VARCHAR, dormid VARCHAR) | Find the average age of students living in each dorm and the name of dorm. | <s>[INST] Given the following SQL query and context: Query: SELECT AVG(T1.age), T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name Context: CREATE TABLE dorm (dorm_name VARCHAR, dormid VARCHAR); CREATE TABLE student (age INTEGER, stu... |
SELECT COUNT(*), T1.dormid FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid WHERE T1.student_capacity > 100 GROUP BY T1.dormid | CREATE TABLE dorm (dormid VARCHAR, student_capacity INTEGER); CREATE TABLE has_amenity (dormid VARCHAR) | Find the number of amenities for each of the dorms that can accommodate more than 100 students. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*), T1.dormid FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid WHERE T1.student_capacity > 100 GROUP BY T1.dormid Context: CREATE TABLE dorm (dormid VARCHAR, student_capacity INTEGER); CREATE TABLE has_amenity (dormid VARCHAR) [/INS... |
SELECT COUNT(*), T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.age > 20 GROUP BY T3.dorm_name | CREATE TABLE dorm (dorm_name VARCHAR, dormid VARCHAR); CREATE TABLE lives_in (stuid VARCHAR, dormid VARCHAR); CREATE TABLE student (stuid VARCHAR, age INTEGER) | Find the number of students who is older than 20 in each dorm. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*), T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.age > 20 GROUP BY T3.dorm_name Context: CREATE TABLE dorm (dorm_name VARCHAR, dormid VARCHAR); CREATE TABLE lives_in (... |
SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' | CREATE TABLE student (fname VARCHAR, stuid VARCHAR); CREATE TABLE lives_in (stuid VARCHAR, dormid VARCHAR); CREATE TABLE dorm (dormid VARCHAR, dorm_name VARCHAR) | Find the first name of students who are living in the Smith Hall. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' Context: CREATE TABLE student (fname VARCHAR, stuid VARCHAR); CREATE TABLE lives_in (stuid VARCHAR, dormid ... |
SELECT AVG(T1.age) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.student_capacity = (SELECT MAX(student_capacity) FROM dorm) | CREATE TABLE dorm (student_capacity INTEGER); CREATE TABLE student (age INTEGER, stuid VARCHAR); CREATE TABLE lives_in (stuid VARCHAR, dormid VARCHAR); CREATE TABLE dorm (dormid VARCHAR, student_capacity INTEGER) | Find the average age of students who are living in the dorm with the largest capacity. | <s>[INST] Given the following SQL query and context: Query: SELECT AVG(T1.age) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.student_capacity = (SELECT MAX(student_capacity) FROM dorm) Context: CREATE TABLE dorm (student_capacity INTEGER); CREATE TABLE s... |
SELECT COUNT(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.gender = 'M' | CREATE TABLE dorm (dormid VARCHAR, gender VARCHAR); CREATE TABLE lives_in (stuid VARCHAR, dormid VARCHAR); CREATE TABLE student (stuid VARCHAR) | Find the total number of students living in the male dorm (with gender M). | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.gender = 'M' Context: CREATE TABLE dorm (dormid VARCHAR, gender VARCHAR); CREATE TABLE lives_in (stuid VARCHAR, dormid VARCHAR); CRE... |
SELECT COUNT(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' AND T1.sex = 'F' | CREATE TABLE lives_in (stuid VARCHAR, dormid VARCHAR); CREATE TABLE student (stuid VARCHAR, sex VARCHAR); CREATE TABLE dorm (dormid VARCHAR, dorm_name VARCHAR) | Find the number of female students (with F sex) living in Smith Hall | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' AND T1.sex = 'F' Context: CREATE TABLE lives_in (stuid VARCHAR, dormid VARCHAR); CREATE TABLE student (stui... |
SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' | CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR); CREATE TABLE dorm_amenity (amenity_name VARCHAR, amenid VARCHAR); CREATE TABLE dorm (dormid VARCHAR, dorm_name VARCHAR) | Find the name of amenities Smith Hall dorm have. | <s>[INST] Given the following SQL query and context: Query: SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' Context: CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR); CREATE TABLE dorm_amen... |
SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' ORDER BY T3.amenity_name | CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR); CREATE TABLE dorm_amenity (amenity_name VARCHAR, amenid VARCHAR); CREATE TABLE dorm (dormid VARCHAR, dorm_name VARCHAR) | Find the name of amenities Smith Hall dorm have. ordered the results by amenity names. | <s>[INST] Given the following SQL query and context: Query: SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' ORDER BY T3.amenity_name Context: CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR... |
SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T1.amenid = T2.amenid GROUP BY T2.amenid ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE dorm_amenity (amenity_name VARCHAR, amenid VARCHAR); CREATE TABLE has_amenity (amenid VARCHAR) | Find the name of amenity that is most common in all dorms. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T1.amenid = T2.amenid GROUP BY T2.amenid ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE dorm_amenity (amenity_name VARCHAR, amenid VARCHAR); CREATE TABLE has_amenity (amenid VARCHAR... |
SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T2.dormid FROM dorm AS T3 JOIN has_amenity AS T4 ON T3.dormid = T4.dormid JOIN dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T3.dormid ORDER BY COUNT(*) DESC LIMIT 1) | CREATE TABLE dorm_amenity (amenid VARCHAR); CREATE TABLE lives_in (stuid VARCHAR, dormid VARCHAR); CREATE TABLE dorm (dormid VARCHAR); CREATE TABLE student (fname VARCHAR, stuid VARCHAR); CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR) | Find the first name of students who are living in the dorm that has most number of amenities. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T2.dormid FROM dorm AS T3 JOIN has_amenity AS T4 ON T3.dormid = T4.dormid JOIN dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T3.dormid ORDER BY COUN... |
SELECT T1.dorm_name, T1.student_capacity FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid ORDER BY COUNT(*) LIMIT 1 | CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR); CREATE TABLE dorm_amenity (amenid VARCHAR); CREATE TABLE dorm (dorm_name VARCHAR, student_capacity VARCHAR, dormid VARCHAR) | Find the name and capacity of the dorm with least number of amenities. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.dorm_name, T1.student_capacity FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid ORDER BY COUNT(*) LIMIT 1 Context: CREATE TABLE has_amenity (dormid VARCHAR, amenid VAR... |
SELECT dorm_name FROM dorm EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' | CREATE TABLE dorm (dorm_name VARCHAR, dormid VARCHAR); CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR); CREATE TABLE dorm (dorm_name VARCHAR); CREATE TABLE dorm_amenity (amenid VARCHAR, amenity_name VARCHAR) | Find the name of dorms that do not have amenity TV Lounge. | <s>[INST] Given the following SQL query and context: Query: SELECT dorm_name FROM dorm EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' Context: CREATE TABLE dorm (dorm_name VARCHAR, dormid VAR... |
SELECT T1.fname, T1.lname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') | CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR); CREATE TABLE lives_in (stuid VARCHAR, dormid VARCHAR); CREATE TABLE student (fname VARCHAR, lname VARCHAR, stuid VARCHAR); CREATE TABLE dorm_amenity (amenid VARCHAR, amenity_name VARCHAR) | Find the first and last name of students who are living in the dorms that have amenity TV Lounge. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.fname, T1.lname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') Context: CREATE TABLE has_... |
SELECT T1.fname, T1.age FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE NOT T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') | CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR); CREATE TABLE student (fname VARCHAR, age VARCHAR, stuid VARCHAR); CREATE TABLE lives_in (stuid VARCHAR, dormid VARCHAR); CREATE TABLE dorm_amenity (amenid VARCHAR, amenity_name VARCHAR) | Find the first name and age of students who are living in the dorms that do not have amenity TV Lounge. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.fname, T1.age FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE NOT T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') Context: CREATE TABLE ha... |
SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid JOIN lives_in AS T4 ON T4.dormid = T1.dormid JOIN student AS T5 ON T5.stuid = T4.stuid WHERE T5.lname = 'Smith' | CREATE TABLE student (stuid VARCHAR, lname VARCHAR); CREATE TABLE dorm (dormid VARCHAR); CREATE TABLE lives_in (dormid VARCHAR, stuid VARCHAR); CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR); CREATE TABLE dorm_amenity (amenity_name VARCHAR, amenid VARCHAR) | Find the name of amenities of the dorm where the student with last name Smith is living in. | <s>[INST] Given the following SQL query and context: Query: SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid JOIN lives_in AS T4 ON T4.dormid = T1.dormid JOIN student AS T5 ON T5.stuid = T4.stuid WHERE T5.lname = 'Smith' Context: CRE... |
SELECT email_address, phone_number FROM customers ORDER BY email_address, phone_number | CREATE TABLE customers (email_address VARCHAR, phone_number VARCHAR) | Find the emails and phone numbers of all the customers, ordered by email address and phone number. | <s>[INST] Given the following SQL query and context: Query: SELECT email_address, phone_number FROM customers ORDER BY email_address, phone_number Context: CREATE TABLE customers (email_address VARCHAR, phone_number VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the emails and phon... |
SELECT town_city FROM customers WHERE customer_type_code = "Good Credit Rating" GROUP BY town_city ORDER BY COUNT(*) LIMIT 1 | CREATE TABLE customers (town_city VARCHAR, customer_type_code VARCHAR) | Which city has the least number of customers whose type code is "Good Credit Rating"? | <s>[INST] Given the following SQL query and context: Query: SELECT town_city FROM customers WHERE customer_type_code = "Good Credit Rating" GROUP BY town_city ORDER BY COUNT(*) LIMIT 1 Context: CREATE TABLE customers (town_city VARCHAR, customer_type_code VARCHAR) [/INST] Based on the provided SQL query and context, yo... |
SELECT t1.product_name, COUNT(*) FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name | CREATE TABLE products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE complaints (product_id VARCHAR) | List the name of all products along with the number of complaints that they have received. | <s>[INST] Given the following SQL query and context: Query: SELECT t1.product_name, COUNT(*) FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name Context: CREATE TABLE products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE complaints (product_id VARCHAR) [/INST]... |
SELECT t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY COUNT(*) LIMIT 1 | CREATE TABLE customers (email_address VARCHAR, customer_id VARCHAR); CREATE TABLE complaints (customer_id VARCHAR) | Find the emails of customers who has filed a complaints of the product with the most complaints. | <s>[INST] Given the following SQL query and context: Query: SELECT t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY COUNT(*) LIMIT 1 Context: CREATE TABLE customers (email_address VARCHAR, customer_id VARCHAR); CREATE TABLE complaints (custo... |
SELECT DISTINCT t1.product_name FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id JOIN customers AS t3 GROUP BY t3.customer_id ORDER BY COUNT(*) LIMIT 1 | CREATE TABLE customers (customer_id VARCHAR); CREATE TABLE products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE complaints (product_id VARCHAR) | Which products has been complained by the customer who has filed least amount of complaints? | <s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT t1.product_name FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id JOIN customers AS t3 GROUP BY t3.customer_id ORDER BY COUNT(*) LIMIT 1 Context: CREATE TABLE customers (customer_id VARCHAR); CREATE TABLE products (prod... |
SELECT t1.phone_number FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.date_complaint_raised DESC LIMIT 1 | CREATE TABLE customers (phone_number VARCHAR, customer_id VARCHAR); CREATE TABLE complaints (customer_id VARCHAR, date_complaint_raised VARCHAR) | What is the phone number of the customer who has filed the most recent complaint? | <s>[INST] Given the following SQL query and context: Query: SELECT t1.phone_number FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.date_complaint_raised DESC LIMIT 1 Context: CREATE TABLE customers (phone_number VARCHAR, customer_id VARCHAR); CREATE TABLE complaints (customer_i... |
SELECT email_address, phone_number FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM complaints) | CREATE TABLE complaints (email_address VARCHAR, phone_number VARCHAR, customer_id VARCHAR); CREATE TABLE customers (email_address VARCHAR, phone_number VARCHAR, customer_id VARCHAR) | Find the email and phone number of the customers who have never filed a complaint before. | <s>[INST] Given the following SQL query and context: Query: SELECT email_address, phone_number FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM complaints) Context: CREATE TABLE complaints (email_address VARCHAR, phone_number VARCHAR, customer_id VARCHAR); CREATE TABLE customers (email_address VARCHAR, ... |
SELECT phone_number FROM customers UNION SELECT phone_number FROM staff | CREATE TABLE staff (phone_number VARCHAR); CREATE TABLE customers (phone_number VARCHAR) | Find the phone number of all the customers and staff. | <s>[INST] Given the following SQL query and context: Query: SELECT phone_number FROM customers UNION SELECT phone_number FROM staff Context: CREATE TABLE staff (phone_number VARCHAR); CREATE TABLE customers (phone_number VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the phone numb... |
SELECT product_description FROM products WHERE product_name = "Chocolate" | CREATE TABLE products (product_description VARCHAR, product_name VARCHAR) | What is the description of the product named "Chocolate"? | <s>[INST] Given the following SQL query and context: Query: SELECT product_description FROM products WHERE product_name = "Chocolate" Context: CREATE TABLE products (product_description VARCHAR, product_name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the description of the p... |
SELECT product_name, product_category_code FROM products ORDER BY product_price DESC LIMIT 1 | CREATE TABLE products (product_name VARCHAR, product_category_code VARCHAR, product_price VARCHAR) | Find the name and category of the most expensive product. | <s>[INST] Given the following SQL query and context: Query: SELECT product_name, product_category_code FROM products ORDER BY product_price DESC LIMIT 1 Context: CREATE TABLE products (product_name VARCHAR, product_category_code VARCHAR, product_price VARCHAR) [/INST] Based on the provided SQL query and context, your q... |
SELECT product_price FROM products WHERE NOT product_id IN (SELECT product_id FROM complaints) | CREATE TABLE products (product_price VARCHAR, product_id VARCHAR); CREATE TABLE complaints (product_price VARCHAR, product_id VARCHAR) | Find the prices of products which has never received a single complaint. | <s>[INST] Given the following SQL query and context: Query: SELECT product_price FROM products WHERE NOT product_id IN (SELECT product_id FROM complaints) Context: CREATE TABLE products (product_price VARCHAR, product_id VARCHAR); CREATE TABLE complaints (product_price VARCHAR, product_id VARCHAR) [/INST] Based on the ... |
SELECT AVG(product_price), product_category_code FROM products GROUP BY product_category_code | CREATE TABLE products (product_category_code VARCHAR, product_price INTEGER) | What is the average price of the products for each category? | <s>[INST] Given the following SQL query and context: Query: SELECT AVG(product_price), product_category_code FROM products GROUP BY product_category_code Context: CREATE TABLE products (product_category_code VARCHAR, product_price INTEGER) [/INST] Based on the provided SQL query and context, your question is: What is t... |
SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id JOIN products AS t3 ON t2.product_id = t3.product_id ORDER BY t3.product_price LIMIT 1 | CREATE TABLE products (product_id VARCHAR, product_price VARCHAR); CREATE TABLE complaints (staff_id VARCHAR, product_id VARCHAR); CREATE TABLE staff (last_name VARCHAR, staff_id VARCHAR) | Find the last name of the staff member who processed the complaint of the cheapest product. | <s>[INST] Given the following SQL query and context: Query: SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id JOIN products AS t3 ON t2.product_id = t3.product_id ORDER BY t3.product_price LIMIT 1 Context: CREATE TABLE products (product_id VARCHAR, product_price VARCHAR); CREATE TA... |
SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING COUNT(*) > 3 | CREATE TABLE complaints (complaint_status_code VARCHAR) | Which complaint status has more than 3 records on file? | <s>[INST] Given the following SQL query and context: Query: SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING COUNT(*) > 3 Context: CREATE TABLE complaints (complaint_status_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which complaint status has m... |
SELECT last_name FROM staff WHERE email_address LIKE "%wrau%" | CREATE TABLE staff (last_name VARCHAR, email_address VARCHAR) | Find the last name of the staff whose email address contains "wrau". | <s>[INST] Given the following SQL query and context: Query: SELECT last_name FROM staff WHERE email_address LIKE "%wrau%" Context: CREATE TABLE staff (last_name VARCHAR, email_address VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the last name of the staff whose email address cont... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.