instruction
stringlengths
1.07k
3.45k
output
stringlengths
19
508
system
stringclasses
1 value
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: head. Primary Key: (head_id) head_id, INT name, TEXT, Value Examples: ['Dudley Hart', 'Nick Faldo', 'Tiger Woods'] born_state, TEXT, Value Examples: ['Delaware', 'Florida', 'California'] age, REAL [Foreign keys] [Question] How many heads of the departments are older than 56 ? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT count(*) FROM head WHERE age > 56;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: head. Primary Key: (head_id) head_id, INT name, TEXT, Value Examples: ['Jeff Maggert', 'Stewart Cink', 'Tiger Woods'] born_state, TEXT, Value Examples: ['Delaware', 'California', 'Connecticut'] age, REAL [Foreign keys] [Question] List the name, born state and age of the heads of departments ordered by age. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT name, born_state, age FROM head ORDER BY age;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: department. Primary Key: (department_id) department_id, INT name, TEXT, Value Examples: ['Health and Human Services', 'Housing and Urban Development', 'Education'] creation, TEXT, Value Examples: ['1789', '1947', '1870'] ranking, INT budget_in_billions, REAL num_employees, REAL [Foreign keys] [Question] List the creation year, name and budget of each department. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT creation, name, budget_in_billions FROM department;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: department. Primary Key: (department_id) department_id, INT name, TEXT, Value Examples: ['Health and Human Services', 'Housing and Urban Development', 'Treasury'] creation, TEXT, Value Examples: ['1789', '1947', '1870'] ranking, INT budget_in_billions, REAL num_employees, REAL [Foreign keys] [Question] What are the maximum and minimum budget of the departments? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT max(budget_in_billions), min(budget_in_billions) FROM department;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: department. Primary Key: (department_id) department_id, INT name, TEXT, Value Examples: ['Health and Human Services', 'Housing and Urban Development', 'Homeland Security'] creation, TEXT, Value Examples: ['1953', '1965', '1870'] ranking, INT budget_in_billions, REAL num_employees, REAL [Foreign keys] [Question] What is the average number of employees of the departments whose rank is between 10 and 15? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT avg(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: head. Primary Key: (head_id) head_id, INT name, TEXT, Value Examples: ['Franklin Langham', 'Dudley Hart', 'Stewart Cink'] born_state, TEXT, Value Examples: ['California', 'Florida', 'Connecticut'] age, REAL [Foreign keys] [Question] What are the names of the heads who are born outside the California state? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT name FROM head WHERE born_state != 'California';
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: department. Primary Key: (department_id) department_id, INT name, TEXT, Value Examples: ['State', 'Transportation', 'Homeland Security'] creation, TEXT, Value Examples: ['1789', '1947', '1870'] ranking, INT budget_in_billions, REAL num_employees, REAL - Table: management. Primary Key: (department_id) department_id, INT head_id, INT temporary_acting, TEXT, Value Examples: ['Yes', 'No'] - Table: head. Primary Key: (head_id) head_id, INT name, TEXT, Value Examples: ['Franklin Langham', 'Sergio García', 'Billy Mayfair'] born_state, TEXT, Value Examples: ['Alabama', 'Delaware', 'California'] age, REAL [Foreign keys] management(head_id) references head(head_id) management(department_id) references department(department_id) [Question] What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT DISTINCT t1.creation FROM department AS t1 JOIN management AS t2 ON t1.department_id = t2.department_id JOIN head AS t3 ON t2.head_id = t3.head_id WHERE t3.born_state = 'Alabama';
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: head. Primary Key: (head_id) head_id, INT name, TEXT, Value Examples: ['Stewart Cink', 'Dudley Hart', 'Tiger Woods'] born_state, TEXT, Value Examples: ['California', 'Connecticut', 'Delaware'] age, REAL [Foreign keys] [Question] What are the names of the states where at least 3 heads were born? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT born_state FROM head GROUP BY born_state HAVING count(*) >= 3;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: department. Primary Key: (department_id) department_id, INT name, TEXT, Value Examples: ['Defense', 'Treasury', 'Energy'] creation, TEXT, Value Examples: ['1789', '1947', '1870'] ranking, INT budget_in_billions, REAL num_employees, REAL [Foreign keys] [Question] In which year were most departments established? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT creation FROM department GROUP BY creation ORDER BY count(*) DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: department. Primary Key: (department_id) department_id, INT name, TEXT, Value Examples: ['Health and Human Services', 'Housing and Urban Development', 'Transportation'] creation, TEXT, Value Examples: ['1789', '1947', '1870'] ranking, INT budget_in_billions, REAL num_employees, REAL - Table: management. Primary Key: (department_id) department_id, INT head_id, INT temporary_acting, TEXT, Value Examples: ['Yes', 'No'] [Foreign keys] management(department_id) references department(department_id) [Question] Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.name, t1.num_employees FROM department AS t1 JOIN management AS t2 ON t1.department_id = t2.department_id WHERE t2.temporary_acting = 'Yes';
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: management. Primary Key: (department_id) department_id, INT head_id, INT temporary_acting, TEXT, Value Examples: ['Yes', 'No'] [Foreign keys] [Question] How many acting statuses are there? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT count(DISTINCT temporary_acting) FROM management;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: department. Primary Key: (department_id) department_id, INT name, TEXT, Value Examples: ['Education', 'Transportation', 'Homeland Security'] creation, TEXT, Value Examples: ['1789', '1947', '1870'] ranking, INT budget_in_billions, REAL num_employees, REAL - Table: management. Primary Key: (department_id) department_id, INT head_id, INT temporary_acting, TEXT, Value Examples: ['No', 'Yes'] [Foreign keys] management(department_id) references department(department_id) [Question] How many departments are led by heads who are not mentioned? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT count(*) FROM department WHERE department_id NOT IN (SELECT department_id FROM management);
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: management. Primary Key: (department_id) department_id, INT head_id, INT temporary_acting, TEXT, Value Examples: ['Yes', 'No'] - Table: head. Primary Key: (head_id) head_id, INT name, TEXT, Value Examples: ['Stewart Cink', 'Tiger Woods', 'Nick Faldo'] born_state, TEXT, Value Examples: ['Delaware', 'Connecticut', 'Florida'] age, REAL [Foreign keys] management(head_id) references head(head_id) [Question] What are the distinct ages of the heads who are acting? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT DISTINCT t1.age FROM management AS t2 JOIN head AS t1 ON t1.head_id = t2.head_id WHERE t2.temporary_acting = 'Yes';
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: department. Primary Key: (department_id) department_id, INT name, TEXT, Value Examples: ['Homeland Security', 'Health and Human Services', 'Housing and Urban Development'] creation, TEXT, Value Examples: ['1789', '1947', '1870'] ranking, INT budget_in_billions, REAL num_employees, REAL - Table: management. Primary Key: (department_id) department_id, INT head_id, INT temporary_acting, TEXT, Value Examples: ['Yes', 'No'] - Table: head. Primary Key: (head_id) head_id, INT name, TEXT, Value Examples: ['Pádraig Harrington', 'Franklin Langham', 'Stewart Cink'] born_state, TEXT, Value Examples: ['Delaware', 'California', 'Connecticut'] age, REAL [Foreign keys] management(head_id) references head(head_id) management(department_id) references department(department_id) [Question] List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t3.born_state FROM department AS t1 JOIN management AS t2 ON t1.department_id = t2.department_id JOIN head AS t3 ON t2.head_id = t3.head_id WHERE t1.name = 'Treasury' INTERSECT SELECT t3.born_state FROM department AS t1 JOIN management AS t2 ON t1.department_id = t2.department_id JOIN head AS t3 ON t2.head_id = t3.head_id WHERE t1.name = 'Homeland Security';
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: management. Primary Key: (department_id) department_id, INT head_id, INT temporary_acting, TEXT, Value Examples: ['Yes', 'No'] - Table: department. Primary Key: (department_id) department_id, INT name, TEXT, Value Examples: ['Health and Human Services', 'Housing and Urban Development', 'Homeland Security'] creation, TEXT, Value Examples: ['1789', '1947', '1870'] ranking, INT budget_in_billions, REAL num_employees, REAL [Foreign keys] management(department_id) references department(department_id) [Question] Which department has more than 1 head at a time? List the id, name and the number of heads. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.department_id, t1.name, count(*) FROM management AS t2 JOIN department AS t1 ON t1.department_id = t2.department_id GROUP BY t1.department_id HAVING count(*) > 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: head. Primary Key: (head_id) head_id, INT name, TEXT, Value Examples: ['Tiger Woods', 'K. J. Choi', 'Stewart Cink'] born_state, TEXT, Value Examples: ['Delaware', 'California', 'Connecticut'] age, REAL [Foreign keys] [Question] Which head's name has the substring 'Ha'? List the id and name. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT head_id, name FROM head WHERE name LIKE '%Ha%';
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: farm. Primary Key: (farm_id) farm_id, INT year, INT total_horses, REAL working_horses, REAL total_cattle, REAL oxen, REAL bulls, REAL cows, REAL pigs, REAL sheep_and_goats, REAL [Foreign keys] [Question] How many farms are there? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT count(*) FROM farm;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: farm. Primary Key: (farm_id) farm_id, INT year, INT total_horses, REAL working_horses, REAL total_cattle, REAL oxen, REAL bulls, REAL cows, REAL pigs, REAL sheep_and_goats, REAL [Foreign keys] [Question] Count the number of farms. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT count(*) FROM farm;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: farm. Primary Key: (farm_id) farm_id, INT year, INT total_horses, REAL working_horses, REAL total_cattle, REAL oxen, REAL bulls, REAL cows, REAL pigs, REAL sheep_and_goats, REAL [Foreign keys] [Question] List the total number of horses on farms in ascending order. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT total_horses FROM farm ORDER BY total_horses ASC;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: farm. Primary Key: (farm_id) farm_id, INT year, INT total_horses, REAL working_horses, REAL total_cattle, REAL oxen, REAL bulls, REAL cows, REAL pigs, REAL sheep_and_goats, REAL [Foreign keys] [Question] What is the total horses record for each farm, sorted ascending? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT total_horses FROM farm ORDER BY total_horses ASC;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ['Carnival M is back!', 'Aliens', 'MTV Asia Aid'] host_city_id, INT hosts, TEXT, Value Examples: ['Alicia Keys', 'Shaggy and Coco Lee', 'Miley Cyrus Jared Leto and Karen Mok'] [Foreign keys] [Question] What are the hosts of competitions whose theme is not "Aliens"? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT hosts FROM farm_competition WHERE theme != 'Aliens';
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ['Carnival M is back!', 'Aliens', 'Codehunters'] host_city_id, INT hosts, TEXT, Value Examples: ['Alicia Keys', 'Shaggy and Coco Lee', 'Mandy Moore and Ronan Keating'] [Foreign keys] [Question] Return the hosts of competitions for which the theme is not Aliens? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT hosts FROM farm_competition WHERE theme != 'Aliens';
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ['Codehunters', "Valentine's Day", 'MTV Asia Aid'] host_city_id, INT hosts, TEXT, Value Examples: ['Mandy Moore and Ronan Keating', 'Shaggy and Coco Lee', 'Miley Cyrus Jared Leto and Karen Mok'] [Foreign keys] [Question] What are the themes of farm competitions sorted by year in ascending order? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT theme FROM farm_competition ORDER BY YEAR ASC;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ["Valentine's Day", 'Codehunters', 'MTV Asia Aid'] host_city_id, INT hosts, TEXT, Value Examples: ['Mandy Moore and Ronan Keating', 'Miley Cyrus Jared Leto and Karen Mok', 'Leehom Wang and Kelly Rowland'] [Foreign keys] [Question] Return the themes of farm competitions, sorted by year ascending. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT theme FROM farm_competition ORDER BY YEAR ASC;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: farm. Primary Key: (farm_id) farm_id, INT year, INT total_horses, REAL working_horses, REAL total_cattle, REAL oxen, REAL bulls, REAL cows, REAL pigs, REAL sheep_and_goats, REAL [Foreign keys] [Question] What is the average number of working horses of farms with more than 5000 total number of horses? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT avg(working_horses) FROM farm WHERE total_horses > 5000;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: farm. Primary Key: (farm_id) farm_id, INT year, INT total_horses, REAL working_horses, REAL total_cattle, REAL oxen, REAL bulls, REAL cows, REAL pigs, REAL sheep_and_goats, REAL [Foreign keys] [Question] Give the average number of working horses on farms with more than 5000 total horses. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT avg(working_horses) FROM farm WHERE total_horses > 5000;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: farm. Primary Key: (farm_id) farm_id, INT year, INT total_horses, REAL working_horses, REAL total_cattle, REAL oxen, REAL bulls, REAL cows, REAL pigs, REAL sheep_and_goats, REAL [Foreign keys] [Question] What are the maximum and minimum number of cows across all farms. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT max(cows), min(cows) FROM farm;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: farm. Primary Key: (farm_id) farm_id, INT year, INT total_horses, REAL working_horses, REAL total_cattle, REAL oxen, REAL bulls, REAL cows, REAL pigs, REAL sheep_and_goats, REAL [Foreign keys] [Question] Return the maximum and minimum number of cows across all farms. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT max(cows), min(cows) FROM farm;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Perth-Andover', 'Plaster Rock', 'Grand Falls/Grand-Sault'] status, TEXT, Value Examples: ['Village', 'Town'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['1442 of 5,008', '1936 of 5,008', '636 of 5008'] [Foreign keys] [Question] How many different statuses do cities have? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT count(DISTINCT status) FROM city;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Perth-Andover', 'Grand Falls/Grand-Sault', 'Aroostook'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] Count the number of different statuses. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT count(DISTINCT status) FROM city;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Plaster Rock', 'Grand Falls/Grand-Sault', 'Perth-Andover'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] List official names of cities in descending order of population. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT official_name FROM city ORDER BY population DESC;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Plaster Rock', 'Grand Falls/Grand-Sault', 'Aroostook'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] What are the official names of cities, ordered descending by population? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT official_name FROM city ORDER BY population DESC;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Plaster Rock', 'Grand Falls/Grand-Sault', 'Perth-Andover'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] List the official name and status of the city with the largest population. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT official_name, status FROM city ORDER BY population DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Grand Falls/Grand-Sault', 'Plaster Rock', 'Perth-Andover'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] What is the official name and status of the city with the most residents? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT official_name, status FROM city ORDER BY population DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Perth-Andover', 'Grand Falls/Grand-Sault', 'Plaster Rock'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ['MTV Asia Aid', 'Carnival M is back!', "Valentine's Day"] host_city_id, INT hosts, TEXT, Value Examples: ['Miley Cyrus Jared Leto and Karen Mok', 'Leehom Wang and Kelly Rowland', 'Vanness Wu and Michelle Branch'] [Foreign keys] farm_competition(host_city_id) references city(city_id) [Question] Show the years and the official names of the host cities of competitions. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t2.year, t1.official_name FROM city AS t1 JOIN farm_competition AS t2 ON t1.city_id = t2.host_city_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Perth-Andover', 'Grand Falls/Grand-Sault', 'Aroostook'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ["Valentine's Day", 'MTV Asia Aid', 'Carnival M is back!'] host_city_id, INT hosts, TEXT, Value Examples: ['Miley Cyrus Jared Leto and Karen Mok', 'Leehom Wang and Kelly Rowland', 'Vanness Wu and Michelle Branch'] [Foreign keys] farm_competition(host_city_id) references city(city_id) [Question] Give the years and official names of the cities of each competition. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t2.year, t1.official_name FROM city AS t1 JOIN farm_competition AS t2 ON t1.city_id = t2.host_city_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Perth-Andover', 'Plaster Rock', 'Grand Falls/Grand-Sault'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ["Valentine's Day", 'Codehunters', 'Carnival M is back!'] host_city_id, INT hosts, TEXT, Value Examples: ['Alicia Keys', 'Mandy Moore and Ronan Keating', 'Miley Cyrus Jared Leto and Karen Mok'] [Foreign keys] farm_competition(host_city_id) references city(city_id) [Question] Show the official names of the cities that have hosted more than one competition. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.official_name FROM city AS t1 JOIN farm_competition AS t2 ON t1.city_id = t2.host_city_id GROUP BY t2.host_city_id HAVING count(*) > 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Perth-Andover', 'Plaster Rock', 'Grand Falls/Grand-Sault'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ['Carnival M is back!', "Valentine's Day", 'Codehunters'] host_city_id, INT hosts, TEXT, Value Examples: ['Alicia Keys', 'Mandy Moore and Ronan Keating', 'Shaggy and Coco Lee'] [Foreign keys] farm_competition(host_city_id) references city(city_id) [Question] What are the official names of cities that have hosted more than one competition? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.official_name FROM city AS t1 JOIN farm_competition AS t2 ON t1.city_id = t2.host_city_id GROUP BY t2.host_city_id HAVING count(*) > 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Plaster Rock', 'Perth-Andover', 'Grand Falls/Grand-Sault'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ['MTV Asia Aid', "Valentine's Day", 'Codehunters'] host_city_id, INT hosts, TEXT, Value Examples: ['Shaggy and Coco Lee', 'Mandy Moore and Ronan Keating', 'Miley Cyrus Jared Leto and Karen Mok'] [Foreign keys] farm_competition(host_city_id) references city(city_id) [Question] Show the status of the city that has hosted the greatest number of competitions. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.status FROM city AS t1 JOIN farm_competition AS t2 ON t1.city_id = t2.host_city_id GROUP BY t2.host_city_id ORDER BY count(*) DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Aroostook', 'Perth-Andover', 'Plaster Rock'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ['Carnival M is back!', 'MTV Asia Aid', "Valentine's Day"] host_city_id, INT hosts, TEXT, Value Examples: ['Alicia Keys', 'Shaggy and Coco Lee', 'Miley Cyrus Jared Leto and Karen Mok'] [Foreign keys] farm_competition(host_city_id) references city(city_id) [Question] What is the status of the city that has hosted the most competitions? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.status FROM city AS t1 JOIN farm_competition AS t2 ON t1.city_id = t2.host_city_id GROUP BY t2.host_city_id ORDER BY count(*) DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Plaster Rock', 'Perth-Andover', 'Grand Falls/Grand-Sault'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['1442 of 5,008', '1936 of 5,008', '2418 of 5008'] - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ["Valentine's Day", 'Aliens', 'MTV Asia Aid'] host_city_id, INT hosts, TEXT, Value Examples: ['Miley Cyrus Jared Leto and Karen Mok', 'Vanness Wu and Michelle Branch', 'Leehom Wang and Kelly Rowland'] [Foreign keys] farm_competition(host_city_id) references city(city_id) [Question] Please show the themes of competitions with host cities having populations larger than 1000. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t2.theme FROM city AS t1 JOIN farm_competition AS t2 ON t1.city_id = t2.host_city_id WHERE t1.population > 1000;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Perth-Andover', 'Grand Falls/Grand-Sault', 'Drummond'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['1442 of 5,008', '1936 of 5,008', '636 of 5008'] - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ["Valentine's Day", 'Aliens', 'Carnival M is back!'] host_city_id, INT hosts, TEXT, Value Examples: ['Mandy Moore and Ronan Keating', 'Shaggy and Coco Lee', 'Miley Cyrus Jared Leto and Karen Mok'] [Foreign keys] farm_competition(host_city_id) references city(city_id) [Question] What are the themes of competitions that have corresponding host cities with more than 1000 residents? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t2.theme FROM city AS t1 JOIN farm_competition AS t2 ON t1.city_id = t2.host_city_id WHERE t1.population > 1000;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Perth-Andover', 'Grand Falls/Grand-Sault', 'Plaster Rock'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['1442 of 5,008', '1936 of 5,008', '636 of 5008'] [Foreign keys] [Question] Please show the different statuses of cities and the average population of cities with each status. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT status, avg(population) FROM city GROUP BY status;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Perth-Andover', 'Plaster Rock', 'Grand Falls/Grand-Sault'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] What are the statuses and average populations of each city? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT status, avg(population) FROM city GROUP BY status;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Plaster Rock', 'Perth-Andover', 'Grand Falls/Grand-Sault'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] Please show the different statuses, ordered by the number of cities that have each. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT status FROM city GROUP BY status ORDER BY count(*) ASC;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Perth-Andover', 'Plaster Rock', 'Grand Falls/Grand-Sault'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] Return the different statuses of cities, ascending by frequency. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT status FROM city GROUP BY status ORDER BY count(*) ASC;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Aroostook', 'Plaster Rock', 'Drummond'] status, TEXT, Value Examples: ['Village', 'Town'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] List the most common type of Status across cities. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT status FROM city GROUP BY status ORDER BY count(*) DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Aroostook', 'Plaster Rock', 'Drummond'] status, TEXT, Value Examples: ['Village', 'Town'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['1442 of 5,008', '1936 of 5,008', '636 of 5008'] [Foreign keys] [Question] What is the most common status across all cities? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT status FROM city GROUP BY status ORDER BY count(*) DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Plaster Rock', 'Perth-Andover', 'Aroostook'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ["Valentine's Day", 'Carnival M is back!', 'Aliens'] host_city_id, INT hosts, TEXT, Value Examples: ['Alicia Keys', 'Shaggy and Coco Lee', 'Vanness Wu and Michelle Branch'] [Foreign keys] farm_competition(host_city_id) references city(city_id) [Question] List the official names of cities that have not held any competition. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT official_name FROM city WHERE city_id NOT IN (SELECT host_city_id FROM farm_competition);
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Perth-Andover', 'Plaster Rock', 'Grand Falls/Grand-Sault'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] - Table: farm_competition. Primary Key: (competition_id) competition_id, INT year, INT theme, TEXT, Value Examples: ["Valentine's Day", 'Carnival M is back!', 'MTV Asia Aid'] host_city_id, INT hosts, TEXT, Value Examples: ['Alicia Keys', 'Mandy Moore and Ronan Keating', 'Miley Cyrus Jared Leto and Karen Mok'] [Foreign keys] farm_competition(host_city_id) references city(city_id) [Question] What are the official names of cities that have not hosted a farm competition? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT official_name FROM city WHERE city_id NOT IN (SELECT host_city_id FROM farm_competition);
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Grand Falls/Grand-Sault', 'Perth-Andover', 'Plaster Rock'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['2418 of 5008', '3460 of 5008', '636 of 5008'] [Foreign keys] [Question] Show the status shared by cities with population bigger than 1500 and smaller than 500. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT status FROM city WHERE population > 1500 INTERSECT SELECT status FROM city WHERE population < 500;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Grand Falls/Grand-Sault', 'Perth-Andover', 'Plaster Rock'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['2418 of 5008', '636 of 5008', '3460 of 5008'] [Foreign keys] [Question] Which statuses correspond to both cities that have a population over 1500 and cities that have a population lower than 500? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT status FROM city WHERE population > 1500 INTERSECT SELECT status FROM city WHERE population < 500;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Grand Falls/Grand-Sault', 'Perth-Andover', 'Plaster Rock'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] Find the official names of cities with population bigger than 1500 or smaller than 500. [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT official_name FROM city WHERE population > 1500 OR population < 500;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Perth-Andover', 'Plaster Rock', 'Grand Falls/Grand-Sault'] status, TEXT, Value Examples: ['Town', 'Village'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] What are the official names of cities that have population over 1500 or less than 500? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT official_name FROM city WHERE population > 1500 OR population < 500;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Plaster Rock', 'Grand Falls/Grand-Sault', 'Aroostook'] status, TEXT, Value Examples: ['Village', 'Town'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] Show the census ranking of cities whose status are not "Village". [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT census_ranking FROM city WHERE status != "Village";
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: city. Primary Key: (city_id) city_id, INT official_name, TEXT, Value Examples: ['Grand Falls/Grand-Sault', 'Perth-Andover', 'Plaster Rock'] status, TEXT, Value Examples: ['Village', 'Town'] area_km_2, REAL population, REAL census_ranking, TEXT, Value Examples: ['636 of 5008', '1442 of 5,008', '1936 of 5,008'] [Foreign keys] [Question] What are the census rankings of cities that do not have the status "Village"? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT census_ranking FROM city WHERE status != "Village";
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['English', 'data structure', 'database'] course_description, VARCHAR(255), Value Examples: ['English', 'data structure', 'database'] other_details, VARCHAR(255), Value Examples: ['None'] - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME [Foreign keys] student_course_registrations(course_id) references courses(course_id) [Question] which course has most number of registered students? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.course_name FROM courses AS t1 JOIN student_course_registrations AS t2 ON t1.course_id = t2.course_id GROUP BY t1.course_id ORDER BY count(*) DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['Art history', 'statistics', 'data structure'] course_description, VARCHAR(255), Value Examples: ['Art history', 'statistics', 'data structure'] other_details, VARCHAR(255), Value Examples: ['None'] - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME [Foreign keys] student_course_registrations(course_id) references courses(course_id) [Question] What is the name of the course with the most registered students? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.course_name FROM courses AS t1 JOIN student_course_registrations AS t2 ON t1.course_id = t2.course_id GROUP BY t1.course_id ORDER BY count(*) DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME [Foreign keys] [Question] what is id of students who registered some courses but the least number of courses in these students? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME [Foreign keys] [Question] What are the ids of the students who registered for some courses but had the least number of courses for all students? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: candidates. Primary Key: (candidate_id) candidate_id, INTEGER candidate_details, VARCHAR(255), Value Examples: ['Tao', 'Leo', 'Alex'] - Table: people. Primary Key: (person_id) person_id, INTEGER first_name, VARCHAR(255), Value Examples: ['Dariana', 'Shannon', 'Verna'] middle_name, VARCHAR(255), Value Examples: ['Arielle', 'Mercedes', 'Amiya'] last_name, VARCHAR(255), Value Examples: ['Hartmann', 'Wintheiser', 'Bartoletti'] cell_mobile_number, VARCHAR(40), Value Examples: ['1-603-110-0647', '1-372-548-7538x314', '766-272-9964'] email_address, VARCHAR(40), Value Examples: ['[email protected]', '[email protected]', '[email protected]'] login_name, VARCHAR(40), Value Examples: ['mkou', 'zops', 'qrwl'] password, VARCHAR(40), Value Examples: ['b063331ea8116befaa7b84c59c6a22200f5f8caa', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c'] [Foreign keys] candidates(candidate_id) references people(person_id) [Question] what are the first name and last name of all candidates? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t2.first_name, t2.last_name FROM candidates AS t1 JOIN people AS t2 ON t1.candidate_id = t2.person_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: candidates. Primary Key: (candidate_id) candidate_id, INTEGER candidate_details, VARCHAR(255), Value Examples: ['Tao', 'Alex', 'Cindy'] - Table: people. Primary Key: (person_id) person_id, INTEGER first_name, VARCHAR(255), Value Examples: ['Dariana', 'Shannon', 'Virginie'] middle_name, VARCHAR(255), Value Examples: ['Arielle', 'Mercedes', 'Haley'] last_name, VARCHAR(255), Value Examples: ['Hartmann', 'Wintheiser', 'Bartoletti'] cell_mobile_number, VARCHAR(40), Value Examples: ['1-603-110-0647', '1-372-548-7538x314', '766-272-9964'] email_address, VARCHAR(40), Value Examples: ['[email protected]', '[email protected]', '[email protected]'] login_name, VARCHAR(40), Value Examples: ['zops', 'qrwl', 'bnto'] password, VARCHAR(40), Value Examples: ['b063331ea8116befaa7b84c59c6a22200f5f8caa', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c', 'ecae473cb54601e01457078ac0cdf4a1ced837bb'] [Foreign keys] candidates(candidate_id) references people(person_id) [Question] What are the first and last names of all the candidates? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t2.first_name, t2.last_name FROM candidates AS t1 JOIN people AS t2 ON t1.candidate_id = t2.person_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: students. Primary Key: (student_id) student_id, INTEGER student_details, VARCHAR(255), Value Examples: ['Martin', 'John', 'Joe'] - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] List the id of students who never attends courses? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT student_id FROM students WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance);
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: students. Primary Key: (student_id) student_id, INTEGER student_details, VARCHAR(255), Value Examples: ['Sarah', 'Martin', 'John'] - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] What are the ids of every student who has never attended a course? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT student_id FROM students WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance);
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] List the id of students who attended some courses? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT student_id FROM student_course_attendance;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] What are the ids of all students who have attended at least one course? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT student_id FROM student_course_attendance;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['Art history', 'data structure', 'English'] course_description, VARCHAR(255), Value Examples: ['Art history', 'data structure', 'English'] other_details, VARCHAR(255), Value Examples: ['None'] [Foreign keys] student_course_registrations(course_id) references courses(course_id) [Question] What are the ids of all students for courses and what are the names of those courses? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.student_id, t2.course_name FROM student_course_registrations AS t1 JOIN courses AS t2 ON t1.course_id = t2.course_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME - Table: students. Primary Key: (student_id) student_id, INTEGER student_details, VARCHAR(255), Value Examples: ['Martin', 'Joe', 'Sarah'] [Foreign keys] student_course_registrations(student_id) references students(student_id) [Question] What is detail of the student who most recently registered course? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t2.student_details FROM student_course_registrations AS t1 JOIN students AS t2 ON t1.student_id = t2.student_id ORDER BY t1.registration_date DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME - Table: students. Primary Key: (student_id) student_id, INTEGER student_details, VARCHAR(255), Value Examples: ['John', 'Joe', 'Nancy'] [Foreign keys] student_course_registrations(student_id) references students(student_id) [Question] What details do we have on the students who registered for courses most recently? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t2.student_details FROM student_course_registrations AS t1 JOIN students AS t2 ON t1.student_id = t2.student_id ORDER BY t1.registration_date DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['English', 'statistics', 'French'] course_description, VARCHAR(255), Value Examples: ['English', 'statistics', 'French'] other_details, VARCHAR(255), Value Examples: ['None'] - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] How many students attend course English? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT count(*) FROM courses AS t1 JOIN student_course_attendance AS t2 ON t1.course_id = t2.course_id WHERE t1.course_name = "English";
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['English', 'data structure', 'Art history'] course_description, VARCHAR(255), Value Examples: ['English', 'data structure', 'Art history'] other_details, VARCHAR(255), Value Examples: ['None'] - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] How many students are attending English courses? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT count(*) FROM courses AS t1 JOIN student_course_attendance AS t2 ON t1.course_id = t2.course_id WHERE t1.course_name = "English";
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['data structure', 'Art history', 'English'] course_description, VARCHAR(255), Value Examples: ['data structure', 'Art history', 'English'] other_details, VARCHAR(255), Value Examples: ['None'] - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] How many courses do the student whose id is 171 attend? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT count(*) FROM courses AS t1 JOIN student_course_attendance AS t2 ON t1.course_id = t2.course_id WHERE t2.student_id = 171;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['data structure', 'Art history', 'database'] course_description, VARCHAR(255), Value Examples: ['data structure', 'Art history', 'database'] other_details, VARCHAR(255), Value Examples: ['None'] - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] How many courses does the student with id 171 actually attend? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT count(*) FROM courses AS t1 JOIN student_course_attendance AS t2 ON t1.course_id = t2.course_id WHERE t2.student_id = 171;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: people. Primary Key: (person_id) person_id, INTEGER first_name, VARCHAR(255), Value Examples: ['Lizeth', 'Shannon', 'Hoyt'] middle_name, VARCHAR(255), Value Examples: ['Haley', 'Elissa', 'Hayley'] last_name, VARCHAR(255), Value Examples: ['Wintheiser', 'Bartoletti', 'Senger'] cell_mobile_number, VARCHAR(40), Value Examples: ['1-603-110-0647', '1-372-548-7538x314', '766-272-9964'] email_address, VARCHAR(40), Value Examples: ['[email protected]', '[email protected]', '[email protected]'] login_name, VARCHAR(40), Value Examples: ['zops', 'mkou', 'bnto'] password, VARCHAR(40), Value Examples: ['76a93d1d3b7becc932d203beac61d064bd54e947', 'ecae473cb54601e01457078ac0cdf4a1ced837bb', '7be9c03d5467d563555c51ebb3eb78e7f90832ec'] - Table: candidates. Primary Key: (candidate_id) candidate_id, INTEGER candidate_details, VARCHAR(255), Value Examples: ['Jane', 'Alex', 'Tao'] [Foreign keys] candidates(candidate_id) references people(person_id) [Question] Find id of the candidate whose email is [email protected]? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t2.candidate_id FROM people AS t1 JOIN candidates AS t2 ON t1.person_id = t2.candidate_id WHERE t1.email_address = "[email protected]";
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: people. Primary Key: (person_id) person_id, INTEGER first_name, VARCHAR(255), Value Examples: ['Lizeth', 'Shannon', 'Hoyt'] middle_name, VARCHAR(255), Value Examples: ['Haley', 'Elissa', 'Hayley'] last_name, VARCHAR(255), Value Examples: ['Wintheiser', 'Bartoletti', 'Senger'] cell_mobile_number, VARCHAR(40), Value Examples: ['1-603-110-0647', '1-372-548-7538x314', '766-272-9964'] email_address, VARCHAR(40), Value Examples: ['[email protected]', '[email protected]', '[email protected]'] login_name, VARCHAR(40), Value Examples: ['zops', 'mkou', 'bnto'] password, VARCHAR(40), Value Examples: ['76a93d1d3b7becc932d203beac61d064bd54e947', 'ecae473cb54601e01457078ac0cdf4a1ced837bb', '7be9c03d5467d563555c51ebb3eb78e7f90832ec'] - Table: candidates. Primary Key: (candidate_id) candidate_id, INTEGER candidate_details, VARCHAR(255), Value Examples: ['Jane', 'Alex', 'Tao'] [Foreign keys] candidates(candidate_id) references people(person_id) [Question] What is the id of the candidate whose email is [email protected]? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t2.candidate_id FROM people AS t1 JOIN candidates AS t2 ON t1.person_id = t2.candidate_id WHERE t1.email_address = "[email protected]";
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: candidate_assessments. Primary Key: (candidate_id) candidate_id, INTEGER qualification, CHAR(15), Value Examples: ['A', 'D', 'C'] assessment_date, DATETIME asessment_outcome_code, CHAR(15), Value Examples: ['Fail', 'Pass'] [Foreign keys] [Question] Find id of the candidate who most recently accessed the course? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: candidate_assessments. Primary Key: (candidate_id) candidate_id, INTEGER qualification, CHAR(15), Value Examples: ['A', 'D', 'C'] assessment_date, DATETIME asessment_outcome_code, CHAR(15), Value Examples: ['Pass', 'Fail'] [Foreign keys] [Question] What is the id of the candidate who most recently accessed the course? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: students. Primary Key: (student_id) student_id, INTEGER student_details, VARCHAR(255), Value Examples: ['Martin', 'Joe', 'Marry'] - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME [Foreign keys] student_course_registrations(student_id) references students(student_id) [Question] What is detail of the student who registered the most number of courses? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.student_details FROM students AS t1 JOIN student_course_registrations AS t2 ON t1.student_id = t2.student_id GROUP BY t1.student_id ORDER BY count(*) DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: students. Primary Key: (student_id) student_id, INTEGER student_details, VARCHAR(255), Value Examples: ['Marry', 'Barry', 'Sarah'] - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME [Foreign keys] student_course_registrations(student_id) references students(student_id) [Question] What are the details of the student who registered for the most number of courses? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.student_details FROM students AS t1 JOIN student_course_registrations AS t2 ON t1.student_id = t2.student_id GROUP BY t1.student_id ORDER BY count(*) DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: students. Primary Key: (student_id) student_id, INTEGER student_details, VARCHAR(255), Value Examples: ['Joe', 'Nancy', 'John'] - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME [Foreign keys] student_course_registrations(student_id) references students(student_id) [Question] List the id of students who registered some courses and the number of their registered courses? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.student_id, count(*) FROM students AS t1 JOIN student_course_registrations AS t2 ON t1.student_id = t2.student_id GROUP BY t1.student_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: students. Primary Key: (student_id) student_id, INTEGER student_details, VARCHAR(255), Value Examples: ['Joe', 'Marry', 'Sarah'] - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME [Foreign keys] student_course_registrations(student_id) references students(student_id) [Question] For every student who is registered for some course, how many courses are they registered for? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t1.student_id, count(*) FROM students AS t1 JOIN student_course_registrations AS t2 ON t1.student_id = t2.student_id GROUP BY t1.student_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: students. Primary Key: (student_id) student_id, INTEGER student_details, VARCHAR(255), Value Examples: ['Joe', 'Marry', 'Nancy'] - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['data structure', 'English', 'Art history'] course_description, VARCHAR(255), Value Examples: ['data structure', 'English', 'Art history'] other_details, VARCHAR(255), Value Examples: ['None'] [Foreign keys] student_course_registrations(course_id) references courses(course_id) student_course_registrations(student_id) references students(student_id) [Question] How many registed students do each course have? List course name and the number of their registered students? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t3.course_name, count(*) FROM students AS t1 JOIN student_course_registrations AS t2 ON t1.student_id = t2.student_id JOIN courses AS t3 ON t2.course_id = t3.course_id GROUP BY t2.course_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: students. Primary Key: (student_id) student_id, INTEGER student_details, VARCHAR(255), Value Examples: ['Marry', 'Barry', 'Sarah'] - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['Art history', 'data structure', 'French'] course_description, VARCHAR(255), Value Examples: ['Art history', 'data structure', 'French'] other_details, VARCHAR(255), Value Examples: ['None'] [Foreign keys] student_course_registrations(course_id) references courses(course_id) student_course_registrations(student_id) references students(student_id) [Question] For each course id, how many students are registered and what are the course names? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t3.course_name, count(*) FROM students AS t1 JOIN student_course_registrations AS t2 ON t1.student_id = t2.student_id JOIN courses AS t3 ON t2.course_id = t3.course_id GROUP BY t2.course_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: candidate_assessments. Primary Key: (candidate_id) candidate_id, INTEGER qualification, CHAR(15), Value Examples: ['A', 'D', 'C'] assessment_date, DATETIME asessment_outcome_code, CHAR(15), Value Examples: ['Pass', 'Fail'] [Foreign keys] [Question] Find id of candidates whose assessment code is "Pass"? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass";
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: candidate_assessments. Primary Key: (candidate_id) candidate_id, INTEGER qualification, CHAR(15), Value Examples: ['A', 'D', 'C'] assessment_date, DATETIME asessment_outcome_code, CHAR(15), Value Examples: ['Pass', 'Fail'] [Foreign keys] [Question] What are the ids of the candidates that have an outcome code of Pass? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass";
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: candidates. Primary Key: (candidate_id) candidate_id, INTEGER candidate_details, VARCHAR(255), Value Examples: ['Leo', 'Cindy', 'Robin'] - Table: candidate_assessments. Primary Key: (candidate_id) candidate_id, INTEGER qualification, CHAR(15), Value Examples: ['A', 'B', 'D'] assessment_date, DATETIME asessment_outcome_code, CHAR(15), Value Examples: ['Fail', 'Pass'] - Table: people. Primary Key: (person_id) person_id, INTEGER first_name, VARCHAR(255), Value Examples: ['Hoyt', 'Lizeth', 'Shannon'] middle_name, VARCHAR(255), Value Examples: ['Bell', 'Arielle', 'Elissa'] last_name, VARCHAR(255), Value Examples: ['Wintheiser', 'Bartoletti', 'Senger'] cell_mobile_number, VARCHAR(40), Value Examples: ['1-603-110-0647', '1-372-548-7538x314', '766-272-9964'] email_address, VARCHAR(40), Value Examples: ['[email protected]', '[email protected]', '[email protected]'] login_name, VARCHAR(40), Value Examples: ['zops', 'pgub', 'uuol'] password, VARCHAR(40), Value Examples: ['76a93d1d3b7becc932d203beac61d064bd54e947', '7be9c03d5467d563555c51ebb3eb78e7f90832ec', 'ecae473cb54601e01457078ac0cdf4a1ced837bb'] [Foreign keys] candidates(candidate_id) references people(person_id) candidate_assessments(candidate_id) references candidates(candidate_id) [Question] Find the cell mobile number of the candidates whose assessment code is "Fail"? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t3.cell_mobile_number FROM candidates AS t1 JOIN candidate_assessments AS t2 ON t1.candidate_id = t2.candidate_id JOIN people AS t3 ON t1.candidate_id = t3.person_id WHERE t2.asessment_outcome_code = "Fail";
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: candidates. Primary Key: (candidate_id) candidate_id, INTEGER candidate_details, VARCHAR(255), Value Examples: ['Tao', 'Leo', 'Jane'] - Table: candidate_assessments. Primary Key: (candidate_id) candidate_id, INTEGER qualification, CHAR(15), Value Examples: ['A', 'B', 'D'] assessment_date, DATETIME asessment_outcome_code, CHAR(15), Value Examples: ['Fail', 'Pass'] - Table: people. Primary Key: (person_id) person_id, INTEGER first_name, VARCHAR(255), Value Examples: ['Verna', 'Dariana', 'Mayra'] middle_name, VARCHAR(255), Value Examples: ['Bell', 'Arielle', 'Elissa'] last_name, VARCHAR(255), Value Examples: ['Feest', 'Hartmann', 'Grant'] cell_mobile_number, VARCHAR(40), Value Examples: ['1-603-110-0647', '1-372-548-7538x314', '766-272-9964'] email_address, VARCHAR(40), Value Examples: ['[email protected]', '[email protected]', '[email protected]'] login_name, VARCHAR(40), Value Examples: ['pgub', 'bnto', 'zops'] password, VARCHAR(40), Value Examples: ['ecae473cb54601e01457078ac0cdf4a1ced837bb', '76a93d1d3b7becc932d203beac61d064bd54e947', '7be9c03d5467d563555c51ebb3eb78e7f90832ec'] [Foreign keys] candidates(candidate_id) references people(person_id) candidate_assessments(candidate_id) references candidates(candidate_id) [Question] What are the cell phone numbers of the candidates that received an assessment code of "Fail"? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT t3.cell_mobile_number FROM candidates AS t1 JOIN candidate_assessments AS t2 ON t1.candidate_id = t2.candidate_id JOIN people AS t3 ON t1.candidate_id = t3.person_id WHERE t2.asessment_outcome_code = "Fail";
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] What are the id of students who registered course 301? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT student_id FROM student_course_attendance WHERE course_id = 301;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] What are the ids of the students who registered for course 301? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT student_id FROM student_course_attendance WHERE course_id = 301;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] What is the id of the student who most recently registered course 301? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] What are the ids of the students who registered for course 301 most recently? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: addresses. Primary Key: (address_id) address_id, INTEGER line_1, VARCHAR(80), Value Examples: ['801 Modesto Island Suite 306\nLacyville, VT 34059', '8760 Eldon Squares Suite 260\nMarquisestad, GA 38537', '242 Pacocha Streets\nEast Isabellashire, ND 03506'] line_2, VARCHAR(80), Value Examples: ['Suite 096', 'Suite 333', 'Suite 370'] city, VARCHAR(50), Value Examples: ['Lake Devon', 'South Minnie', "O'Connellview"] zip_postcode, CHAR(20), Value Examples: ['862', '716', '112'] state_province_county, VARCHAR(50), Value Examples: ['Washington', 'Michigan', 'Connecticut'] country, VARCHAR(50), Value Examples: ['USA'] - Table: people_addresses. Primary Key: (person_address_id) person_address_id, INTEGER person_id, INTEGER address_id, INTEGER date_from, DATETIME date_to, DATETIME [Foreign keys] people_addresses(address_id) references addresses(address_id) [Question] Find distinct cities of addresses of people? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT DISTINCT t1.city FROM addresses AS t1 JOIN people_addresses AS t2 ON t1.address_id = t2.address_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: addresses. Primary Key: (address_id) address_id, INTEGER line_1, VARCHAR(80), Value Examples: ['242 Pacocha Streets\nEast Isabellashire, ND 03506', '0177 Fisher Dam\nBerniershire, KS 00038-7574', '1770 Adriel Ramp Apt. 397\nWest Ashlynnchester, UT 91968'] line_2, VARCHAR(80), Value Examples: ['Apt. 163', 'Apt. 419', 'Apt. 884'] city, VARCHAR(50), Value Examples: ['Alizeshire', 'Lake Kaley', 'New Alta'] zip_postcode, CHAR(20), Value Examples: ['862', '716', '112'] state_province_county, VARCHAR(50), Value Examples: ['Vermont', 'SouthDakota', 'Washington'] country, VARCHAR(50), Value Examples: ['USA'] - Table: people_addresses. Primary Key: (person_address_id) person_address_id, INTEGER person_id, INTEGER address_id, INTEGER date_from, DATETIME date_to, DATETIME [Foreign keys] people_addresses(address_id) references addresses(address_id) [Question] What are the different cities where people live? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT DISTINCT t1.city FROM addresses AS t1 JOIN people_addresses AS t2 ON t1.address_id = t2.address_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: addresses. Primary Key: (address_id) address_id, INTEGER line_1, VARCHAR(80), Value Examples: ['242 Pacocha Streets\nEast Isabellashire, ND 03506', '801 Modesto Island Suite 306\nLacyville, VT 34059', '69165 Beatty Station\nHaleighstad, MS 55164'] line_2, VARCHAR(80), Value Examples: ['Suite 096', 'Suite 333', 'Suite 370'] city, VARCHAR(50), Value Examples: ['South Minnie', 'Stephaniemouth', 'Terencetown'] zip_postcode, CHAR(20), Value Examples: ['862', '716', '112'] state_province_county, VARCHAR(50), Value Examples: ['Vermont', 'Massachusetts', 'Washington'] country, VARCHAR(50), Value Examples: ['USA'] - Table: people_addresses. Primary Key: (person_address_id) person_address_id, INTEGER person_id, INTEGER address_id, INTEGER date_from, DATETIME date_to, DATETIME - Table: students. Primary Key: (student_id) student_id, INTEGER student_details, VARCHAR(255), Value Examples: ['Martin', 'Nikhil', 'Marry'] [Foreign keys] people_addresses(address_id) references addresses(address_id) [Question] Find distinct cities of address of students? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT DISTINCT t1.city FROM addresses AS t1 JOIN people_addresses AS t2 ON t1.address_id = t2.address_id JOIN students AS t3 ON t2.person_id = t3.student_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: addresses. Primary Key: (address_id) address_id, INTEGER line_1, VARCHAR(80), Value Examples: ['242 Pacocha Streets\nEast Isabellashire, ND 03506', '0177 Fisher Dam\nBerniershire, KS 00038-7574', '1770 Adriel Ramp Apt. 397\nWest Ashlynnchester, UT 91968'] line_2, VARCHAR(80), Value Examples: ['Apt. 163', 'Apt. 419', 'Apt. 884'] city, VARCHAR(50), Value Examples: ['Alizeshire', 'New Alta', 'Terencetown'] zip_postcode, CHAR(20), Value Examples: ['862', '716', '112'] state_province_county, VARCHAR(50), Value Examples: ['Vermont', 'SouthDakota', 'Washington'] country, VARCHAR(50), Value Examples: ['USA'] - Table: people_addresses. Primary Key: (person_address_id) person_address_id, INTEGER person_id, INTEGER address_id, INTEGER date_from, DATETIME date_to, DATETIME - Table: students. Primary Key: (student_id) student_id, INTEGER student_details, VARCHAR(255), Value Examples: ['Marry', 'Barry', 'Sarah'] [Foreign keys] people_addresses(address_id) references addresses(address_id) [Question] What are the different cities where students live? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT DISTINCT t1.city FROM addresses AS t1 JOIN people_addresses AS t2 ON t1.address_id = t2.address_id JOIN students AS t3 ON t2.person_id = t3.student_id;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['English', 'database', 'French'] course_description, VARCHAR(255), Value Examples: ['English', 'database', 'French'] other_details, VARCHAR(255), Value Examples: ['None'] [Foreign keys] [Question] List the names of courses in alphabetical order? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT course_name FROM courses ORDER BY course_name;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['database', 'data structure', 'Art history'] course_description, VARCHAR(255), Value Examples: ['database', 'data structure', 'Art history'] other_details, VARCHAR(255), Value Examples: ['None'] [Foreign keys] [Question] What are the names of the courses in alphabetical order? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT course_name FROM courses ORDER BY course_name;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: people. Primary Key: (person_id) person_id, INTEGER first_name, VARCHAR(255), Value Examples: ['Virginie', 'Dariana', 'Lizeth'] middle_name, VARCHAR(255), Value Examples: ['Mercedes', 'Elissa', 'Arielle'] last_name, VARCHAR(255), Value Examples: ['Bartoletti', 'Hartmann', 'Wintheiser'] cell_mobile_number, VARCHAR(40), Value Examples: ['1-603-110-0647', '766-272-9964', '1-372-548-7538x314'] email_address, VARCHAR(40), Value Examples: ['[email protected]', '[email protected]', '[email protected]'] login_name, VARCHAR(40), Value Examples: ['pgub', 'zops', 'uuol'] password, VARCHAR(40), Value Examples: ['b063331ea8116befaa7b84c59c6a22200f5f8caa', '5e4ff49a61b3544da3ad7dc7e2cf28847564c64c', 'b20b6a9f24aadeda70d54e410c3219f61fb063fb'] [Foreign keys] [Question] List the first names of people in alphabetical order? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT first_name FROM people ORDER BY first_name;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: people. Primary Key: (person_id) person_id, INTEGER first_name, VARCHAR(255), Value Examples: ['Virginie', 'Lizeth', 'Verna'] middle_name, VARCHAR(255), Value Examples: ['Mercedes', 'Haley', 'Arielle'] last_name, VARCHAR(255), Value Examples: ['Hartmann', 'Bartoletti', 'Wintheiser'] cell_mobile_number, VARCHAR(40), Value Examples: ['1-603-110-0647', '1-372-548-7538x314', '766-272-9964'] email_address, VARCHAR(40), Value Examples: ['[email protected]', '[email protected]', '[email protected]'] login_name, VARCHAR(40), Value Examples: ['pgub', 'zops', 'uuol'] password, VARCHAR(40), Value Examples: ['76a93d1d3b7becc932d203beac61d064bd54e947', 'ecae473cb54601e01457078ac0cdf4a1ced837bb', 'b063331ea8116befaa7b84c59c6a22200f5f8caa'] [Foreign keys] [Question] What are the first names of the people in alphabetical order? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT first_name FROM people ORDER BY first_name;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] student_course_attendance(student_id) references student_course_registrations(student_id) student_course_attendance(course_id) references student_course_registrations(course_id) [Question] What are the id of students who registered courses or attended courses? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance;
You are an experienced and professional database administrator.

No dataset card yet

Downloads last month
3