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: weather. Primary Key: () date, TEXT, Value Examples: ['10/30/2013', '10/31/2013', '11/30/2013'] max_temperature_f, INTEGER mean_temperature_f, INTEGER min_temperature_f, INTEGER max_dew_point_f, INTEGER mean_dew_point_f, INTEGER min_dew_point_f, INTEGER max_humidity, INTEGER mean_humidity, INTEGER min_humidity, INTEGER max_sea_level_pressure_inches, NUMERIC mean_sea_level_pressure_inches, NUMERIC min_sea_level_pressure_inches, NUMERIC max_visibility_miles, INTEGER mean_visibility_miles, INTEGER min_visibility_miles, INTEGER max_wind_speed_mph, INTEGER mean_wind_speed_mph, INTEGER max_gust_speed_mph, INTEGER precipitation_inches, INTEGER cloud_cover, INTEGER events, TEXT, Value Examples: ['Rain-Thunderstorm', 'Rain', 'rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] What are the dates that have an average sea level pressure between 30.3 and 31? [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 date FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31;
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: weather. Primary Key: () date, TEXT, Value Examples: ['9/1/2013', '9/2/2013', '9/3/2013'] max_temperature_f, INTEGER mean_temperature_f, INTEGER min_temperature_f, INTEGER max_dew_point_f, INTEGER mean_dew_point_f, INTEGER min_dew_point_f, INTEGER max_humidity, INTEGER mean_humidity, INTEGER min_humidity, INTEGER max_sea_level_pressure_inches, NUMERIC mean_sea_level_pressure_inches, NUMERIC min_sea_level_pressure_inches, NUMERIC max_visibility_miles, INTEGER mean_visibility_miles, INTEGER min_visibility_miles, INTEGER max_wind_speed_mph, INTEGER mean_wind_speed_mph, INTEGER max_gust_speed_mph, INTEGER precipitation_inches, INTEGER cloud_cover, INTEGER events, TEXT, Value Examples: ['Rain-Thunderstorm', 'Rain', 'rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] Find the day in which the difference between the max temperature and min temperature was the smallest. Also report the difference. [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 date , max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f 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: weather. Primary Key: () date, TEXT, Value Examples: ['9/1/2013', '9/2/2013', '9/3/2013'] max_temperature_f, INTEGER mean_temperature_f, INTEGER min_temperature_f, INTEGER max_dew_point_f, INTEGER mean_dew_point_f, INTEGER min_dew_point_f, INTEGER max_humidity, INTEGER mean_humidity, INTEGER min_humidity, INTEGER max_sea_level_pressure_inches, NUMERIC mean_sea_level_pressure_inches, NUMERIC min_sea_level_pressure_inches, NUMERIC max_visibility_miles, INTEGER mean_visibility_miles, INTEGER min_visibility_miles, INTEGER max_wind_speed_mph, INTEGER mean_wind_speed_mph, INTEGER max_gust_speed_mph, INTEGER precipitation_inches, INTEGER cloud_cover, INTEGER events, TEXT, Value Examples: ['Rain', 'rain', 'Rain-Thunderstorm'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] What are the days that had the smallest temperature range, and what was that range? [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 date , max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f 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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['Evelyn Park and Ride', 'Castro Street and El Camino Real', 'University and Emerson'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'San Francisco', 'Redwood City'] installation_date, TEXT, Value Examples: ['8/12/2013', '12/31/2013', '8/15/2013'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 12:46:02', '2015-06-02 12:47:02', '2015-06-02 12:48:02'] [Foreign keys] status(station_id) references station(id) [Question] What are the id and name of the stations that have ever had more than 12 bikes available? [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.id, t1.name FROM station AS t1 JOIN status AS t2 ON t1.id = t2.station_id WHERE t2.bikes_available > 12;
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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['Evelyn Park and Ride', 'Castro Street and El Camino Real', 'University and Emerson'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'San Francisco', 'Redwood City'] installation_date, TEXT, Value Examples: ['8/12/2013', '12/31/2013', '8/15/2013'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 12:46:02', '2015-06-02 12:47:02', '2015-06-02 12:48:02'] [Foreign keys] status(station_id) references station(id) [Question] What are the different ids and names of the stations that have had more than 12 bikes available? [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.id, t1.name FROM station AS t1 JOIN status AS t2 ON t1.id = t2.station_id WHERE t2.bikes_available > 12;
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: weather. Primary Key: () date, TEXT, Value Examples: ['10/7/2013', '7/10/2014', '10/7/2014'] max_temperature_f, INTEGER mean_temperature_f, INTEGER min_temperature_f, INTEGER max_dew_point_f, INTEGER mean_dew_point_f, INTEGER min_dew_point_f, INTEGER max_humidity, INTEGER mean_humidity, INTEGER min_humidity, INTEGER max_sea_level_pressure_inches, NUMERIC mean_sea_level_pressure_inches, NUMERIC min_sea_level_pressure_inches, NUMERIC max_visibility_miles, INTEGER mean_visibility_miles, INTEGER min_visibility_miles, INTEGER max_wind_speed_mph, INTEGER mean_wind_speed_mph, INTEGER max_gust_speed_mph, INTEGER precipitation_inches, INTEGER cloud_cover, INTEGER events, TEXT, Value Examples: ['Rain-Thunderstorm', 'Fog', 'Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER - Table: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/27/2015 10:30', '8/27/2015 10:40', '8/27/2015 8:10'] start_station_name, TEXT, Value Examples: ['Howard at 2nd', 'South Van Ness at Market', 'Market at Sansome'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/27/2015 10:30', '8/27/2015 10:50', '8/27/2015 8:10'] end_station_name, TEXT, Value Examples: ['2nd at Townsend', 'San Francisco Caltrain (Townsend at 4th)', 'Howard at 2nd'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] Give me the zip code where the average mean humidity is below 70 and at least 100 trips took place. [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 zip_code FROM weather GROUP BY zip_code HAVING avg(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING count(*) >= 100;
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: weather. Primary Key: () date, TEXT, Value Examples: ['10/7/2013', '7/10/2014', '10/7/2014'] max_temperature_f, INTEGER mean_temperature_f, INTEGER min_temperature_f, INTEGER max_dew_point_f, INTEGER mean_dew_point_f, INTEGER min_dew_point_f, INTEGER max_humidity, INTEGER mean_humidity, INTEGER min_humidity, INTEGER max_sea_level_pressure_inches, NUMERIC mean_sea_level_pressure_inches, NUMERIC min_sea_level_pressure_inches, NUMERIC max_visibility_miles, INTEGER mean_visibility_miles, INTEGER min_visibility_miles, INTEGER max_wind_speed_mph, INTEGER mean_wind_speed_mph, INTEGER max_gust_speed_mph, INTEGER precipitation_inches, INTEGER cloud_cover, INTEGER events, TEXT, Value Examples: ['Rain-Thunderstorm', 'Fog', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER - Table: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/27/2015 10:30', '8/27/2015 10:40', '8/27/2015 10:10'] start_station_name, TEXT, Value Examples: ['South Van Ness at Market', 'Market at Sansome', 'Washington at Kearny'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/27/2015 10:30', '8/27/2015 10:50', '8/27/2015 10:10'] end_station_name, TEXT, Value Examples: ['2nd at Townsend', 'San Francisco Caltrain (Townsend at 4th)', 'Temporary Transbay Terminal (Howard at Beale)'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] What are the zip codes that have an average mean humidity below 70 and had at least 100 trips come through 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 zip_code FROM weather GROUP BY zip_code HAVING avg(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING count(*) >= 100;
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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['San Jose City Hall', 'Redwood City Caltrain Station', 'Redwood City Public Library'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Palo Alto', 'Redwood City', 'San Jose'] installation_date, TEXT, Value Examples: ['8/12/2013', '8/15/2013', '8/16/2013'] - Table: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/22/2015 8:10', '8/23/2015 10:23', '8/24/2015 8:10'] start_station_name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Mountain View City Hall', 'San Francisco City Hall'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/22/2015 8:10', '8/22/2015 10:10', '8/24/2015 8:10'] end_station_name, TEXT, Value Examples: ['Palo Alto Caltrain Station', 'Yerba Buena Center of the Arts (3rd @ Howard)', 'San Jose City Hall'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] What are the names of stations that are located in Palo Alto city but have never been the ending point of trips more than 100 times? [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 station WHERE city = "Palo Alto" EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING count(*) > 100;
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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['Stanford in Redwood City', 'Palo Alto Caltrain Station', 'Yerba Buena Center of the Arts (3rd @ Howard)'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Palo Alto', 'San Jose', 'Redwood City'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] - Table: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/21/2015 17:03', '8/21/2015 17:04', '8/21/2015 17:05'] start_station_name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Palo Alto Caltrain Station', 'Stanford in Redwood City'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/21/2015 17:10', '8/21/2015 17:13', '8/21/2015 17:07'] end_station_name, TEXT, Value Examples: ['Palo Alto Caltrain Station', 'Yerba Buena Center of the Arts (3rd @ Howard)', 'Stanford in Redwood City'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] What are the names of the stations that are located in Palo Alto but have never been the ending point of the trips [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 station WHERE city = "Palo Alto" EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING count(*) > 100;
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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['Santa Clara at Almaden', 'San Salvador at 1st', 'San Jose City Hall'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'Redwood City', 'Palo Alto'] installation_date, TEXT, Value Examples: ['12/31/2013', '8/6/2013', '8/5/2013'] - Table: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/22/2015 0:02', '8/22/2015 0:15', '8/22/2015 0:37'] start_station_name, TEXT, Value Examples: ['Howard at 2nd', 'South Van Ness at Market', 'Market at Sansome'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/22/2015 0:39', '8/22/2015 0:00', '8/22/2015 0:03'] end_station_name, TEXT, Value Examples: ['2nd at Townsend', 'San Francisco Caltrain (Townsend at 4th)', 'Howard at 2nd'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Subscriber', 'Customer'] zip_code, INTEGER [Foreign keys] [Question] How many trips started from Mountain View city and ended at Palo Alto 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 count(*) FROM station AS t1 JOIN trip AS t2 JOIN station AS t3 JOIN trip AS t4 ON t1.id = t2.start_station_id AND t2.id = t4.id AND t3.id = t4.end_station_id WHERE t1.city = "Mountain View" AND t3.city = "Palo Alto";
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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['San Jose Diridon Caltrain Station', 'Santa Clara at Almaden', 'San Salvador at 1st'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'Palo Alto', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] - Table: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/22/2015 0:02', '8/22/2015 0:15', '8/22/2015 0:37'] start_station_name, TEXT, Value Examples: ['Howard at 2nd', 'South Van Ness at Market', 'Market at Sansome'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/22/2015 0:39', '8/22/2015 0:00', '8/22/2015 0:03'] end_station_name, TEXT, Value Examples: ['2nd at Townsend', 'San Francisco Caltrain (Townsend at 4th)', 'Howard at 2nd'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] How many trips stated from a station in Mountain View and ended at one in Palo Alto? [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 station AS t1 JOIN trip AS t2 JOIN station AS t3 JOIN trip AS t4 ON t1.id = t2.start_station_id AND t2.id = t4.id AND t3.id = t4.end_station_id WHERE t1.city = "Mountain View" AND t3.city = "Palo Alto";
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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['Evelyn Park and Ride', 'Castro Street and El Camino Real', 'University and Emerson'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'San Francisco', 'Redwood City'] installation_date, TEXT, Value Examples: ['12/31/2013', '8/6/2013', '8/5/2013'] - Table: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/22/2015 0:02', '8/22/2015 0:15', '8/22/2015 0:37'] start_station_name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'University and Emerson', 'Castro Street and El Camino Real'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/22/2015 0:39', '8/22/2015 0:00', '8/22/2015 0:03'] end_station_name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Castro Street and El Camino Real', 'University and Emerson'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Subscriber', 'Customer'] zip_code, INTEGER [Foreign keys] [Question] What is the average latitude and longitude of the starting points of all trips? [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(t1.lat), avg(t1.long) FROM station AS t1 JOIN trip AS t2 ON t1.id = t2.start_station_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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['Evelyn Park and Ride', 'Castro Street and El Camino Real', 'University and Emerson'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'San Francisco', 'Redwood City'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] - Table: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/23/2015 3:23', '8/24/2015 6:24', '8/24/2015 7:24'] start_station_name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'University and Emerson', 'Castro Street and El Camino Real'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/24/2015 6:24', '8/24/2015 7:24', '8/24/2015 9:24'] end_station_name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Castro Street and El Camino Real', 'University and Emerson'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] What is the average latitude and longitude of all starting stations for the trips? [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(t1.lat), avg(t1.long) FROM station AS t1 JOIN trip AS t2 ON t1.id = t2.start_station_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: book. Primary Key: (book_id) book_id, INT title, TEXT, Value Examples: ['Bloody Mary', "Michael Moorcock's Multiverse", 'Cyberella'] issues, REAL writer, TEXT, Value Examples: ['Howard Chaykin', 'Dave Gibbons', 'Elaine Lee'] [Foreign keys] [Question] How many books 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 book;
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: book. Primary Key: (book_id) book_id, INT title, TEXT, Value Examples: ['The Black Lamb', 'The Dome: Ground Zero', 'Gemini Blood'] issues, REAL writer, TEXT, Value Examples: ['Michael Moorcock', 'Elaine Lee', 'Christopher Hinz'] [Foreign keys] [Question] List the writers of the books in ascending 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 writer FROM book ORDER BY writer 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: book. Primary Key: (book_id) book_id, INT title, TEXT, Value Examples: ['The Black Lamb', 'The Dome: Ground Zero', 'Gemini Blood'] issues, REAL writer, TEXT, Value Examples: ['Christopher Hinz', 'Christopher Moeller', 'Garth Ennis'] [Foreign keys] [Question] List the titles of the books in ascending order of issues. [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 title FROM book ORDER BY issues 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: book. Primary Key: (book_id) book_id, INT title, TEXT, Value Examples: ['The Black Lamb', 'The Dome: Ground Zero', "Sheva's War"] issues, REAL writer, TEXT, Value Examples: ['Elaine Lee', 'Christopher Hinz', 'Garth Ennis'] [Foreign keys] [Question] What are the titles of the books whose writer is not "Elaine Lee"? [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 title FROM book WHERE writer != "Elaine Lee";
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: book. Primary Key: (book_id) book_id, INT title, TEXT, Value Examples: ['The Black Lamb', 'The Dome: Ground Zero', "Sheva's War"] issues, REAL writer, TEXT, Value Examples: ['Dave Gibbons', 'Garth Ennis', 'Michael Moorcock'] [Foreign keys] [Question] What are the title and issues of the books? [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 title, issues FROM book;
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: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Thomson Reuters', 'Springer Nature', 'Bertelsmann'] publication_date, TEXT, Value Examples: ['March 2008', 'March 2007', 'April 2007'] price, REAL [Foreign keys] [Question] What are the dates of publications in descending order of price? [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 publication_date FROM publication ORDER BY price 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: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Springer Nature', 'Thomson Reuters', 'Bertelsmann'] publication_date, TEXT, Value Examples: ['April 2007', 'August 2008', 'March 2008'] price, REAL [Foreign keys] [Question] What are the distinct publishers of publications with price higher than 5000000? [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 publisher FROM publication WHERE price > 5000000;
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: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Thomson Reuters', 'Springer Nature', 'Bertelsmann'] publication_date, TEXT, Value Examples: ['April 2007', 'August 2008', 'June 2006'] price, REAL [Foreign keys] [Question] List the publisher of the publication with the highest price. [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 publisher FROM publication ORDER BY price 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: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Thomson Reuters', 'Springer Nature', 'Bertelsmann'] publication_date, TEXT, Value Examples: ['April 2007', 'August 2008', 'June 2006'] price, REAL [Foreign keys] [Question] List the publication dates of publications with 3 lowest prices. [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 publication_date FROM publication ORDER BY price ASC LIMIT 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: book. Primary Key: (book_id) book_id, INT title, TEXT, Value Examples: ['The Black Lamb', 'The Dome: Ground Zero', 'Dead Corps'] issues, REAL writer, TEXT, Value Examples: ['Howard Chaykin', 'Elaine Lee', 'Dave Gibbons'] - Table: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Thomson Reuters', 'Bertelsmann', 'Pearson'] publication_date, TEXT, Value Examples: ['October 2005', 'April 2007', 'June 2006'] price, REAL [Foreign keys] publication(book_id) references book(book_id) [Question] Show the title and publication dates of books. [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.title, t2.publication_date FROM book AS t1 JOIN publication AS t2 ON t1.book_id = t2.book_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: book. Primary Key: (book_id) book_id, INT title, TEXT, Value Examples: ["Sheva's War", "Michael Moorcock's Multiverse", 'Gemini Blood'] issues, REAL writer, TEXT, Value Examples: ['Christopher Hinz', 'Timothy Truman', 'Dave Gibbons'] - Table: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Thomson Reuters', 'Springer Nature', 'Bertelsmann'] publication_date, TEXT, Value Examples: ['June 2006', 'October 2005', 'March 2008'] price, REAL [Foreign keys] publication(book_id) references book(book_id) [Question] Show writers who have published a book with price more than 4000000. [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.writer FROM book AS t1 JOIN publication AS t2 ON t1.book_id = t2.book_id WHERE t2.price > 4000000;
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: book. Primary Key: (book_id) book_id, INT title, TEXT, Value Examples: ['The Black Lamb', 'The Dome: Ground Zero', 'Dead Corps'] issues, REAL writer, TEXT, Value Examples: ['Howard Chaykin', 'Elaine Lee', 'Garth Ennis'] - Table: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Thomson Reuters', 'Springer Nature', 'Wiley'] publication_date, TEXT, Value Examples: ['April 2007', 'October 2005', 'June 2006'] price, REAL [Foreign keys] publication(book_id) references book(book_id) [Question] Show the titles of books in descending order of publication price. [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.title FROM book AS t1 JOIN publication AS t2 ON t1.book_id = t2.book_id ORDER BY t2.price 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: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Pearson', 'Thomson Reuters', 'Springer Nature'] publication_date, TEXT, Value Examples: ['March 2008', 'March 2007', 'August 2008'] price, REAL [Foreign keys] [Question] Show publishers that have more than one publication. [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 publisher FROM publication GROUP BY publisher 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: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Thomson Reuters', 'Springer Nature', 'Bertelsmann'] publication_date, TEXT, Value Examples: ['October 2005', 'March 2008', 'March 2007'] price, REAL [Foreign keys] [Question] Show different publishers together with the number of publications they 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 publisher, count(*) FROM publication GROUP BY publisher;
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: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Pearson', 'Springer Nature', 'Thomson Reuters'] publication_date, TEXT, Value Examples: ['October 2005', 'April 2007', 'August 2008'] price, REAL [Foreign keys] [Question] Please show the most common publication date. [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 publication_date FROM publication GROUP BY publication_date 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: book. Primary Key: (book_id) book_id, INT title, TEXT, Value Examples: ['The Black Lamb', 'The Dome: Ground Zero', 'Gemini Blood'] issues, REAL writer, TEXT, Value Examples: ['Howard Chaykin', 'Michael Moorcock', 'Christopher Hinz'] [Foreign keys] [Question] List the writers who have written more than one book. [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 writer FROM book GROUP BY writer 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: book. Primary Key: (book_id) book_id, INT title, TEXT, Value Examples: ['The Black Lamb', 'The Dome: Ground Zero', "Sheva's War"] issues, REAL writer, TEXT, Value Examples: ['Dave Gibbons', 'Christopher Hinz', 'Christopher Moeller'] - Table: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Springer Nature', 'Pearson', 'Thomson Reuters'] publication_date, TEXT, Value Examples: ['October 2005', 'August 2008', 'April 2007'] price, REAL [Foreign keys] publication(book_id) references book(book_id) [Question] List the titles of books that are not published. [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 title FROM book WHERE book_id NOT IN (SELECT book_id FROM publication);
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: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Pearson', 'Springer Nature', 'Thomson Reuters'] publication_date, TEXT, Value Examples: ['March 2008', 'March 2007', 'June 2006'] price, REAL [Foreign keys] [Question] Show the publishers that have publications with price higher than 10000000 and publications with price lower than 5000000. [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 publisher FROM publication WHERE price > 10000000 INTERSECT SELECT publisher FROM publication WHERE price < 5000000;
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: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Thomson Reuters', 'Springer Nature', 'Pearson'] publication_date, TEXT, Value Examples: ['October 2005', 'August 2008', 'June 2006'] price, REAL [Foreign keys] [Question] What is the number of distinct publication dates? [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 publication_date) FROM publication;
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: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Thomson Reuters', 'Springer Nature', 'Bertelsmann'] publication_date, TEXT, Value Examples: ['October 2005', 'March 2008', 'March 2007'] price, REAL [Foreign keys] [Question] How many distinct publication dates are there in our record? [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 publication_date) FROM publication;
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: publication. Primary Key: (publication_id) publication_id, INT book_id, INT publisher, TEXT, Value Examples: ['Wiley', 'Pearson', 'Thomson Reuters'] publication_date, TEXT, Value Examples: ['April 2007', 'October 2005', 'August 2008'] price, REAL [Foreign keys] [Question] Show the prices of publications whose publisher is either "Person" or "Wiley" [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 price FROM publication WHERE publisher = "Person" OR publisher = "Wiley";
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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Alan Fletcher', 'Kate Ritchie', 'Ray Meagher'] musical_id, INT character, TEXT, Value Examples: ['Lou Carpenter', 'Sally Fletcher', 'Alf Stewart'] duration, TEXT, Value Examples: ['1988, 1992—', '1995, 1996—', '1988–2008, 2013'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] How many actors 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 actor;
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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Alan Fletcher', 'Ian Smith'] musical_id, INT character, TEXT, Value Examples: ['Lou Carpenter', 'Alf Stewart', 'Irene Roberts'] duration, TEXT, Value Examples: ['1988, 1992—', '1988–2008, 2013', '1995, 1996—'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] Count the number of actors. [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 actor;
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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Ian Smith', 'Tom Oliver'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Lou Carpenter', 'Karl Kennedy'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1987–1991, 1996–2009, 2011', '1988, 1992—'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] List the name of actors in ascending 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 name FROM actor ORDER BY name 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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Tom Oliver', 'Alan Fletcher'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Sally Fletcher', 'Lou Carpenter'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1987–1991, 1996–2009, 2011', '1988–2008, 2013'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] What are the names of actors, ordered alphabetically? [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 actor ORDER BY name 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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Ian Smith', 'Ray Meagher'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Lou Carpenter', 'Irene Roberts'] duration, TEXT, Value Examples: ['1988–2008, 2013', '1988, 1992—', '1995, 1996—'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] What are the characters and duration of actors? [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 CHARACTER, duration FROM actor;
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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Ian Smith', 'Lynne McGranger', 'Alan Fletcher'] musical_id, INT character, TEXT, Value Examples: ['Lou Carpenter', 'Irene Roberts', 'Toadfish Rebecchi'] duration, TEXT, Value Examples: ['1988, 1992—', '1988–2008, 2013', '1995, 1996—'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] Return the characters and durations for each actor. [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 CHARACTER, duration FROM actor;
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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Stefan Dennis', 'Tom Oliver', 'Kate Ritchie'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Irene Roberts', 'Sally Fletcher'] duration, TEXT, Value Examples: ['1988–2008, 2013', '1988, 1992—', '1985–1992, 1993, 2004—'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] List the name of actors whose age is not 20. [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 actor WHERE age != 20;
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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Alan Fletcher', 'Ryan Moloney'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Lou Carpenter', 'Irene Roberts'] duration, TEXT, Value Examples: ['1988–2008, 2013', '1987–1991, 1996–2009, 2011', '1988, 1992—'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] What are the names of actors who are not 20 years old? [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 actor WHERE age != 20;
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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Stefan Dennis', 'Ray Meagher'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Lou Carpenter', 'Irene Roberts'] duration, TEXT, Value Examples: ['1988, 1992—', '1995, 1996—', '1988–2008, 2013'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] What are the characters of actors in descending order of 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 CHARACTER FROM actor ORDER BY age 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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Ray Meagher', 'Ian Smith', 'Lynne McGranger'] musical_id, INT character, TEXT, Value Examples: ['Lou Carpenter', 'Irene Roberts', 'Susan Kennedy'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1987–1991, 1996–2009, 2011', '1988, 1992—'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] Return the characters for actors, ordered by age descending. [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 CHARACTER FROM actor ORDER BY age 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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Ian Smith', 'Alan Fletcher'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Harold Bishop', 'Sally Fletcher'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1987–1991, 1996–2009, 2011', '1988, 1992—'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] What is the duration of the oldest actor? [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 duration FROM actor ORDER BY age 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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Ian Smith', 'Ray Meagher'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Irene Roberts', 'Lou Carpenter'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1987–1991, 1996–2009, 2011', '1988, 1992—'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] Return the duration of the actor with the greatest 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 duration FROM actor ORDER BY age 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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Director of a Musical'] nominee, TEXT, Value Examples: ['Bob Fosse', 'Cleavant Derricks'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] What are the names of musicals with nominee "Bob Fosse"? [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 musical WHERE nominee = "Bob Fosse";
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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Rent'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Director of a Musical'] nominee, TEXT, Value Examples: ['Bob Fosse', 'Cleavant Derricks'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] Return the names of musicals who have the nominee Bob Fosse. [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 musical WHERE nominee = "Bob Fosse";
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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'West Side Story'] year, INT award, TEXT, Value Examples: ['Drama Desk Award', 'Tony Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Director of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] What are the distinct nominees of the musicals with the award that is not "Tony Award"? [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 nominee FROM musical WHERE award != "Tony Award";
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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Rent'] year, INT award, TEXT, Value Examples: ['Drama Desk Award', 'Tony Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Director of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] Return the different nominees of musicals that have an award that is not the Tony Award. [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 nominee FROM musical WHERE award != "Tony Award";
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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Ian Smith', 'Alan Fletcher', 'Kate Ritchie'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Sally Fletcher', 'Lou Carpenter'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1988, 1992—', '1995, 1996—'] age, INT - Table: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Actor in a Musical'] nominee, TEXT, Value Examples: ['Bob Fosse', 'Cleavant Derricks'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] actor(musical_id) references actor(actor_id) [Question] Show names of actors and names of musicals they are in. [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, t2.name FROM actor AS t1 JOIN musical AS t2 ON t1.musical_id = t2.musical_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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Ian Smith', 'Alan Fletcher'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Lou Carpenter', 'Sally Fletcher'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1988, 1992—', '1995, 1996—'] age, INT - Table: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'West Side Story'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Actor in a Musical'] nominee, TEXT, Value Examples: ['Bob Fosse', 'Cleavant Derricks'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] actor(musical_id) references actor(actor_id) [Question] What are the names of actors and the musicals that they are in? [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, t2.name FROM actor AS t1 JOIN musical AS t2 ON t1.musical_id = t2.musical_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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Alan Fletcher', 'Ryan Moloney'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Irene Roberts', 'Karl Kennedy'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1987–1991, 1996–2009, 2011', '1988–2008, 2013'] age, INT - Table: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'West Side Story'] year, INT award, TEXT, Value Examples: ['Drama Desk Award', 'Tony Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Performance by a Leading Actor in a Musical', 'Best Direction of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Won', 'Nominated'] [Foreign keys] actor(musical_id) references actor(actor_id) [Question] Show names of actors that have appeared in musical with name "The Phantom of the Opera". [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 FROM actor AS t1 JOIN musical AS t2 ON t1.musical_id = t2.musical_id WHERE t2.name = "The Phantom of the Opera";
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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Alan Fletcher', 'Kate Ritchie', 'Ryan Moloney'] musical_id, INT character, TEXT, Value Examples: ['Sally Fletcher', 'Irene Roberts', 'Karl Kennedy'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1987–1991, 1996–2009, 2011', '1988–2008, 2013'] age, INT - Table: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Rent'] year, INT award, TEXT, Value Examples: ['Drama Desk Award', 'Tony Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Performance by a Leading Actor in a Musical', 'Best Direction of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Won', 'Nominated'] [Foreign keys] actor(musical_id) references actor(actor_id) [Question] What are the names of actors who have been in the musical titled The Phantom of the Opera? [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 FROM actor AS t1 JOIN musical AS t2 ON t1.musical_id = t2.musical_id WHERE t2.name = "The Phantom of the Opera";
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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Ray Meagher', 'Stefan Dennis'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Sally Fletcher', 'Irene Roberts'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1987–1991, 1996–2009, 2011', '1988–2008, 2013'] age, INT - Table: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'West Side Story'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Performance by a Leading Actor in a Musical', 'Best Direction of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Won', 'Nominated'] [Foreign keys] actor(musical_id) references actor(actor_id) [Question] Show names of actors in descending order of the year their musical is awarded. [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 FROM actor AS t1 JOIN musical AS t2 ON t1.musical_id = t2.musical_id ORDER BY t2.year 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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Alan Fletcher', 'Jackie Woodburne'] musical_id, INT character, TEXT, Value Examples: ['Karl Kennedy', 'Lou Carpenter', 'Sally Fletcher'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1987–1991, 1996–2009, 2011', '1988–2008, 2013'] age, INT - Table: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'West Side Story'] year, INT award, TEXT, Value Examples: ['Drama Desk Award', 'Tony Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Performance by a Leading Actor in a Musical', 'Best Direction of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Won', 'Nominated'] [Foreign keys] actor(musical_id) references actor(actor_id) [Question] What are the names of actors ordered descending by the year in which their musical was awarded? [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 FROM actor AS t1 JOIN musical AS t2 ON t1.musical_id = t2.musical_id ORDER BY t2.year 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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Alan Fletcher', 'Kate Ritchie', 'Stefan Dennis'] musical_id, INT character, TEXT, Value Examples: ['Lou Carpenter', 'Sally Fletcher', 'Irene Roberts'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1987–1991, 1996–2009, 2011', '1988–2008, 2013'] age, INT - Table: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Drama Desk Award', 'Tony Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Performance by a Leading Actor in a Musical', 'Best Direction of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Won', 'Nominated'] [Foreign keys] actor(musical_id) references actor(actor_id) [Question] Show names of musicals and the number of actors who have appeared in the musicals. [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.name, count(*) FROM actor AS t1 JOIN musical AS t2 ON t1.musical_id = t2.musical_id GROUP BY t1.musical_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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Ian Smith', 'Tom Oliver', 'Kate Ritchie'] musical_id, INT character, TEXT, Value Examples: ['Susan Kennedy', 'Toadfish Rebecchi', 'Lou Carpenter'] duration, TEXT, Value Examples: ['1988, 1992—', '1995, 1996—', '1988–2008, 2013'] age, INT - Table: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['Chicago', 'The Phantom of the Opera', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Actor in a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] actor(musical_id) references actor(actor_id) [Question] How many actors have appeared in each musical? [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.name, count(*) FROM actor AS t1 JOIN musical AS t2 ON t1.musical_id = t2.musical_id GROUP BY t1.musical_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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Alan Fletcher', 'Kate Ritchie', 'Tom Oliver'] musical_id, INT character, TEXT, Value Examples: ['Irene Roberts', 'Sally Fletcher', 'Toadfish Rebecchi'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1988–2008, 2013', '1988, 1992—'] age, INT - Table: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Drama Desk Award', 'Tony Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Director of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] actor(musical_id) references actor(actor_id) [Question] Show names of musicals which have at least three actors. [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.name FROM actor AS t1 JOIN musical AS t2 ON t1.musical_id = t2.musical_id GROUP BY t1.musical_id 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: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Tom Oliver', 'Alan Fletcher'] musical_id, INT character, TEXT, Value Examples: ['Irene Roberts', 'Alf Stewart', 'Karl Kennedy'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1988–2008, 2013', '1993—'] age, INT - Table: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Director of a Musical'] nominee, TEXT, Value Examples: ['Bob Fosse', 'Cleavant Derricks'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] actor(musical_id) references actor(actor_id) [Question] What are the names of musicals who have at 3 or more actors? [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.name FROM actor AS t1 JOIN musical AS t2 ON t1.musical_id = t2.musical_id GROUP BY t1.musical_id 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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Rent'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Director of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] Show different nominees and the number of musicals they have been nominated. [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 nominee, count(*) FROM musical GROUP BY nominee;
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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'West Side Story'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Outstanding Actor in a Musical', 'Best Performance by a Leading Actor in a Musical'] nominee, TEXT, Value Examples: ['Bob Fosse', 'Cleavant Derricks'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] How many musicals has each nominee been nominated 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 nominee, count(*) FROM musical GROUP BY nominee;
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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'West Side Story'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Director of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] Please show the nominee who has been nominated the greatest number of times. [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 nominee FROM musical GROUP BY nominee 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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Outstanding Actor in a Musical', 'Best Performance by a Leading Actor in a Musical'] nominee, TEXT, Value Examples: ['Bob Fosse', 'Cleavant Derricks'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] Who is the nominee who has been nominated for the most musicals? [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 nominee FROM musical GROUP BY nominee 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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Director of a Musical'] nominee, TEXT, Value Examples: ['Bob Fosse', 'Cleavant Derricks'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] List the most common result of the musicals. [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 RESULT FROM musical GROUP BY RESULT 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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Direction of a Musical', 'Best Book of a Musical', 'Outstanding Actor in a Musical'] nominee, TEXT, Value Examples: ['Bob Fosse', 'Cleavant Derricks'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] Return the most frequent result across all musicals. [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 RESULT FROM musical GROUP BY RESULT 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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Actor in a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] List the nominees that have been nominated more than two musicals. [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 nominee FROM musical GROUP BY nominee HAVING count(*) > 2;
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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Rent'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Performance by a Leading Actor in a Musical', 'Outstanding Actor in a Musical', 'Best Direction of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] Who are the nominees who have been nominated more than two times? [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 nominee FROM musical GROUP BY nominee HAVING count(*) > 2;
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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Actor in a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Nominated', 'Won'] - Table: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Ian Smith', 'Alan Fletcher'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Irene Roberts', 'Lou Carpenter'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1987–1991, 1996–2009, 2011', '1988, 1992—'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] List the name of musicals that do not have actors. [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 musical WHERE musical_id NOT IN (SELECT musical_id FROM actor);
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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Actor in a Musical'] nominee, TEXT, Value Examples: ['Bob Fosse', 'Cleavant Derricks'] result, TEXT, Value Examples: ['Nominated', 'Won'] - Table: actor. Primary Key: (actor_id) actor_id, INT name, TEXT, Value Examples: ['Kate Ritchie', 'Alan Fletcher', 'Ray Meagher'] musical_id, INT character, TEXT, Value Examples: ['Alf Stewart', 'Irene Roberts', 'Karl Kennedy'] duration, TEXT, Value Examples: ['1985–1992, 1993, 2004—', '1987–1991, 1996–2009, 2011', '1988–2008, 2013'] age, INT [Foreign keys] actor(musical_id) references actor(actor_id) [Question] What are the names of musicals who have no actors? [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 musical WHERE musical_id NOT IN (SELECT musical_id FROM actor);
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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Les Misérables'] year, INT award, TEXT, Value Examples: ['Drama Desk Award', 'Tony Award'] category, TEXT, Value Examples: ['Outstanding Actor in a Musical', 'Best Book of a Musical', 'Best Direction of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] Show the nominees that have nominated musicals for both "Tony Award" and "Drama Desk Award". [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 nominee FROM musical WHERE award = "Tony Award" INTERSECT SELECT nominee FROM musical WHERE award = "Drama Desk Award";
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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'West Side Story'] year, INT award, TEXT, Value Examples: ['Drama Desk Award', 'Tony Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Performance by a Leading Actor in a Musical', 'Best Direction of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] Who are the nominees who have been nominated for both a Tony Award and a Drama Desk Award? [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 nominee FROM musical WHERE award = "Tony Award" INTERSECT SELECT nominee FROM musical WHERE award = "Drama Desk Award";
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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'West Side Story'] year, INT award, TEXT, Value Examples: ['Tony Award', 'Drama Desk Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Actor in a Musical'] nominee, TEXT, Value Examples: ['Bob Fosse', 'Cleavant Derricks'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] Show the musical nominee with award "Bob Fosse" or "Cleavant Derricks". [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 nominee FROM musical WHERE award = "Tony Award" OR award = "Cleavant Derricks";
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: musical. Primary Key: (musical_id) musical_id, INT name, TEXT, Value Examples: ['The Phantom of the Opera', 'The Book of Mormon', 'Rent'] year, INT award, TEXT, Value Examples: ['Drama Desk Award', 'Tony Award'] category, TEXT, Value Examples: ['Best Book of a Musical', 'Best Direction of a Musical', 'Outstanding Director of a Musical'] nominee, TEXT, Value Examples: ['Cleavant Derricks', 'Bob Fosse'] result, TEXT, Value Examples: ['Nominated', 'Won'] [Foreign keys] [Question] Who are the nominees who were nominated for either of the Bob Fosse or Cleavant Derricks awards? [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 nominee FROM musical WHERE award = "Tony Award" OR award = "Cleavant Derricks";
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Mary', 'Iron Man', 'Natalie Portman'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]\n', '[email protected]'] partitionid, INT(11) followers, INT(11) [Foreign keys] [Question] Find the emails of the user named "Mary". [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 email FROM user_profiles WHERE name = 'Mary';
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Iron Man', 'Celine Dion', 'Natalie Portman'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]', '[email protected]\n'] partitionid, INT(11) followers, INT(11) [Foreign keys] [Question] What is the partition id of the user named "Iron Man". [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 partitionid FROM user_profiles WHERE name = 'Iron Man';
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Mary', 'Iron Man', 'Natalie Portman'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]\n', '[email protected]'] partitionid, INT(11) followers, INT(11) [Foreign keys] [Question] How many users 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 user_profiles;
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: follows. Primary Key: (f1) f1, INT(11), Comment: 'user id' f2, INT(11), Comment: 'follower id' [Foreign keys] [Question] How many followers does each user 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(*) FROM follows;
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: follows. Primary Key: (f1) f1, INT(11), Comment: 'user id' f2, INT(11), Comment: 'follower id' [Foreign keys] [Question] Find the number of followers for each user. [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 follows GROUP BY f1;
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: tweets. Primary Key: (id) id, BIGINT(20) uid, INT(11), Comment: 'user id' text, CHAR(140), Value Examples: ['I had a pretty rough time during the last couple of weeks', 'I love my new boyfriend.', "I feel tired and don't want to write SQLs."] createdate, DATETIME [Foreign keys] [Question] Find the number of tweets in record. [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 tweets;
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: tweets. Primary Key: (id) id, BIGINT(20) uid, INT(11), Comment: 'user id' text, CHAR(140), Value Examples: ['I had a pretty rough time during the last couple of weeks', "I feel tired and don't want to write SQLs.", "Hello I'm Tony Stark."] createdate, DATETIME [Foreign keys] [Question] Find the number of users who posted some tweets. [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 UID) FROM tweets;
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Tyler Swift', 'Celine Dion', 'Natalie Portman'] email, VARCHAR(255), Value Examples: ['[email protected]\n', '[email protected]', '[email protected]'] partitionid, INT(11) followers, INT(11) [Foreign keys] [Question] Find the name and email of the user whose name contains the word ‘Swift’. [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, email FROM user_profiles WHERE name LIKE '%Swift%';
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Natalie Portman', 'Celine Dion', 'Tyler Swift'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]\n', '[email protected]'] partitionid, INT(11) followers, INT(11) [Foreign keys] [Question] Find the names of users whose emails contain ‘superstar’ or ‘edu’. [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 user_profiles WHERE email LIKE '%superstar%' OR email LIKE '%edu%';
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: tweets. Primary Key: (id) id, BIGINT(20) uid, INT(11), Comment: 'user id' text, CHAR(140), Value Examples: ['I had a pretty rough time during the last couple of weeks', 'My company is hiring interns.', 'Today I have went shopping at Laffayette.'] createdate, DATETIME [Foreign keys] [Question] Return the text of tweets about the topic 'intern'. [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 text FROM tweets WHERE text LIKE '%intern%';
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Natalie Portman', 'Celine Dion', 'Tyler Swift'] email, VARCHAR(255), Value Examples: ['[email protected]\n', '[email protected]', '[email protected]\n'] partitionid, INT(11) followers, INT(11) [Foreign keys] [Question] Find the name and email of the users who have more than 1000 followers. [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, email FROM user_profiles WHERE followers > 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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Tyler Swift', 'Natalie Portman', 'Iron Man'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]\n', '[email protected]'] partitionid, INT(11) followers, INT(11) - Table: follows. Primary Key: (f1) f1, INT(11), Comment: 'user id' f2, INT(11), Comment: 'follower id' [Foreign keys] follows(f2) references user_profiles(uid) follows(f1) references user_profiles(uid) [Question] Find the names of the users whose number of followers is greater than that of the user named "Tyler Swift". [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 FROM user_profiles AS t1 JOIN follows AS t2 ON t1.uid = t2.f1 GROUP BY t2.f1 HAVING count(*) > (SELECT count(*) FROM user_profiles AS t1 JOIN follows AS t2 ON t1.uid = t2.f1 WHERE t1.name = 'Tyler Swift');
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Natalie Portman', 'Celine Dion', 'Tyler Swift'] email, VARCHAR(255), Value Examples: ['[email protected]\n', '[email protected]', '[email protected]\n'] partitionid, INT(11) followers, INT(11) - Table: follows. Primary Key: (f1) f1, INT(11), Comment: 'user id' f2, INT(11), Comment: 'follower id' [Foreign keys] follows(f2) references user_profiles(uid) follows(f1) references user_profiles(uid) [Question] Find the name and email for the users who have more than one follower. [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.email FROM user_profiles AS t1 JOIN follows AS t2 ON t1.uid = t2.f1 GROUP BY t2.f1 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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Iron Man', 'Natalie Portman', 'Celine Dion'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]\n', '[email protected]'] partitionid, INT(11) followers, INT(11) - Table: tweets. Primary Key: (id) id, BIGINT(20) uid, INT(11), Comment: 'user id' text, CHAR(140), Value Examples: ['Oh, I only have a few fans.', 'I love my new boyfriend.', 'I had a pretty rough time during the last couple of weeks'] createdate, DATETIME [Foreign keys] tweets(uid) references user_profiles(uid) [Question] Find the names of users who have more than one tweet. [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 FROM user_profiles AS t1 JOIN tweets AS t2 ON t1.uid = t2.uid GROUP BY t2.uid 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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Mary', 'Susan', 'Iron Man'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]\n', '[email protected]\n'] partitionid, INT(11) followers, INT(11) - Table: follows. Primary Key: (f1) f1, INT(11), Comment: 'user id' f2, INT(11), Comment: 'follower id' [Foreign keys] follows(f2) references user_profiles(uid) follows(f1) references user_profiles(uid) [Question] Find the id of users who are followed by Mary and Susan. [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.f1 FROM user_profiles AS t1 JOIN follows AS t2 ON t1.uid = t2.f2 WHERE t1.name = "Mary" INTERSECT SELECT t2.f1 FROM user_profiles AS t1 JOIN follows AS t2 ON t1.uid = t2.f2 WHERE t1.name = "Susan";
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Mary', 'Susan', 'Iron Man'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]\n', '[email protected]\n'] partitionid, INT(11) followers, INT(11) - Table: follows. Primary Key: (f1) f1, INT(11), Comment: 'user id' f2, INT(11), Comment: 'follower id' [Foreign keys] follows(f2) references user_profiles(uid) follows(f1) references user_profiles(uid) [Question] Find the id of users who are followed by Mary or Susan. [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.f1 FROM user_profiles AS t1 JOIN follows AS t2 ON t1.uid = t2.f2 WHERE t1.name = "Mary" OR t1.name = "Susan";
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Celine Dion', 'Tyler Swift', 'Natalie Portman'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]', '[email protected]'] partitionid, INT(11) followers, INT(11) [Foreign keys] [Question] Find the name of the user who has the largest number of followers. [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 user_profiles ORDER BY followers 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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Celine Dion', 'Natalie Portman', 'Tyler Swift'] email, VARCHAR(255), Value Examples: ['[email protected]\n', '[email protected]', '[email protected]'] partitionid, INT(11) followers, INT(11) [Foreign keys] [Question] Find the name and email of the user followed by the least number 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 name, email FROM user_profiles ORDER BY followers 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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Susan', 'Celine Dion', 'Iron Man'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]\n', '[email protected]'] partitionid, INT(11) followers, INT(11) [Foreign keys] [Question] List the name and number of followers for each user, and sort the results by the number of followers in descending 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 name, followers FROM user_profiles ORDER BY followers 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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Tyler Swift', 'Celine Dion', 'Natalie Portman'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]', '[email protected]\n'] partitionid, INT(11) followers, INT(11) [Foreign keys] [Question] List the names of 5 users followed by the largest number of other users. [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 user_profiles ORDER BY followers DESC LIMIT 5;
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: tweets. Primary Key: (id) id, BIGINT(20) uid, INT(11), Comment: 'user id' text, CHAR(140), Value Examples: ['I had a pretty rough time during the last couple of weeks', "I feel tired and don't want to write SQLs.", 'Today I have went shopping at Laffayette.'] createdate, DATETIME [Foreign keys] [Question] List the text of all tweets in the order of date. [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 text FROM tweets ORDER BY createdate;
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Celine Dion', 'Black Widow\n', 'Tyler Swift'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]', '[email protected]'] partitionid, INT(11) followers, INT(11) - Table: tweets. Primary Key: (id) id, BIGINT(20) uid, INT(11), Comment: 'user id' text, CHAR(140), Value Examples: ["I feel tired and don't want to write SQLs.", 'I had a pretty rough time during the last couple of weeks', 'Let’s celebrate women, fight for equality and support each other, not just today, but everyday!'] createdate, DATETIME [Foreign keys] tweets(uid) references user_profiles(uid) [Question] Find the name of each user and number of tweets tweeted by each of them. [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, count(*) FROM user_profiles AS t1 JOIN tweets AS t2 ON t1.uid = t2.uid GROUP BY t2.uid;
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Natalie Portman', 'Celine Dion', 'Iron Man'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]\n', '[email protected]'] partitionid, INT(11) followers, INT(11) - Table: tweets. Primary Key: (id) id, BIGINT(20) uid, INT(11), Comment: 'user id' text, CHAR(140), Value Examples: ["I feel tired and don't want to write SQLs.", 'Oh, I only have a few fans.', 'I had a pretty rough time during the last couple of weeks'] createdate, DATETIME [Foreign keys] tweets(uid) references user_profiles(uid) [Question] Find the name and partition id for users who tweeted less than twice. [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.partitionid FROM user_profiles AS t1 JOIN tweets AS t2 ON t1.uid = t2.uid GROUP BY t2.uid HAVING count(*) < 2;
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Natalie Portman', 'Iron Man', 'Susan'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]', '[email protected]'] partitionid, INT(11) followers, INT(11) - Table: tweets. Primary Key: (id) id, BIGINT(20) uid, INT(11), Comment: 'user id' text, CHAR(140), Value Examples: ["I feel tired and don't want to write SQLs.", 'I had a pretty rough time during the last couple of weeks', 'I love my new boyfriend.'] createdate, DATETIME [Foreign keys] tweets(uid) references user_profiles(uid) [Question] Find the name of the user who tweeted more than once, and number of tweets tweeted by them. [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, count(*) FROM user_profiles AS t1 JOIN tweets AS t2 ON t1.uid = t2.uid GROUP BY t2.uid 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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Natalie Portman', 'Tyler Swift', 'Celine Dion'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]\n', '[email protected]'] partitionid, INT(11) followers, INT(11) - Table: tweets. Primary Key: (id) id, BIGINT(20) uid, INT(11), Comment: 'user id' text, CHAR(140), Value Examples: ['Today I have went shopping at Laffayette.', 'Oh, I only have a few fans.', 'I had a pretty rough time during the last couple of weeks'] createdate, DATETIME [Foreign keys] tweets(uid) references user_profiles(uid) [Question] Find the average number of followers for the users who do not have any tweet. [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(followers) FROM user_profiles WHERE UID NOT IN (SELECT UID FROM tweets);
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: user_profiles. Primary Key: (uid) uid, INT(11) name, VARCHAR(255), Value Examples: ['Tyler Swift', 'Celine Dion', 'Black Widow\n'] email, VARCHAR(255), Value Examples: ['[email protected]', '[email protected]', '[email protected]\n'] partitionid, INT(11) followers, INT(11) - Table: tweets. Primary Key: (id) id, BIGINT(20) uid, INT(11), Comment: 'user id' text, CHAR(140), Value Examples: ['I had a pretty rough time during the last couple of weeks', 'Oh, I only have a few fans.', 'Let’s celebrate women, fight for equality and support each other, not just today, but everyday!'] createdate, DATETIME [Foreign keys] tweets(uid) references user_profiles(uid) [Question] Find the average number of followers for the users who had some tweets. [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(followers) FROM user_profiles WHERE UID IN (SELECT UID FROM tweets);
You are an experienced and professional database administrator.