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: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] student_course_attendance(student_id) references student_course_registrations(student_id) student_course_attendance(course_id) references student_course_registrations(course_id) [Question] What are the ids of the students who either registered or attended a course? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] student_course_attendance(student_id) references student_course_registrations(student_id) student_course_attendance(course_id) references student_course_registrations(course_id) [Question] Find the id of courses which are registered or attended by student whose id is 121? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] student_course_attendance(student_id) references student_course_registrations(student_id) student_course_attendance(course_id) references student_course_registrations(course_id) [Question] What are the ids of the courses that are registered or attended by the student whose id is 121? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] student_course_attendance(student_id) references student_course_registrations(student_id) student_course_attendance(course_id) references student_course_registrations(course_id) [Question] What are all info of students who registered courses but not attended courses? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT * FROM student_course_registrations WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance);
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] student_course_attendance(student_id) references student_course_registrations(student_id) student_course_attendance(course_id) references student_course_registrations(course_id) [Question] What are all details of the students who registered but did not attend any course? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT * FROM student_course_registrations WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance);
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['statistics', 'data structure', 'database'] course_description, VARCHAR(255), Value Examples: ['statistics', 'data structure', 'database'] other_details, VARCHAR(255), Value Examples: ['None'] - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME [Foreign keys] student_course_registrations(course_id) references courses(course_id) [Question] List the id of students who registered course statistics in the order of registration 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 t2.student_id FROM courses AS t1 JOIN student_course_registrations AS t2 ON t1.course_id = t2.course_id WHERE t1.course_name = "statistics" ORDER BY t2.registration_date;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['statistics', 'data structure', 'database'] course_description, VARCHAR(255), Value Examples: ['statistics', 'data structure', 'database'] other_details, VARCHAR(255), Value Examples: ['None'] - Table: student_course_registrations. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER registration_date, DATETIME [Foreign keys] student_course_registrations(course_id) references courses(course_id) [Question] What are the ids of the students who registered course statistics by order of registration 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 t2.student_id FROM courses AS t1 JOIN student_course_registrations AS t2 ON t1.course_id = t2.course_id WHERE t1.course_name = "statistics" ORDER BY t2.registration_date;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['statistics', 'data structure', 'database'] course_description, VARCHAR(255), Value Examples: ['statistics', 'data structure', 'database'] other_details, VARCHAR(255), Value Examples: ['None'] - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] List the id of students who attended statistics courses in the order of attendance 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 t2.student_id FROM courses AS t1 JOIN student_course_attendance AS t2 ON t1.course_id = t2.course_id WHERE t1.course_name = "statistics" ORDER BY t2.date_of_attendance;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: courses. Primary Key: (course_id) course_id, VARCHAR(100), Value Examples: ['301', '302', '303'] course_name, VARCHAR(120), Value Examples: ['statistics', 'data structure', 'database'] course_description, VARCHAR(255), Value Examples: ['statistics', 'data structure', 'database'] other_details, VARCHAR(255), Value Examples: ['None'] - Table: student_course_attendance. Primary Key: (student_id) student_id, INTEGER course_id, INTEGER date_of_attendance, DATETIME [Foreign keys] [Question] What are the ids of the students who attended courses in the statistics department in order of attendance 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 t2.student_id FROM courses AS t1 JOIN student_course_attendance AS t2 ON t1.course_id = t2.course_id WHERE t1.course_name = "statistics" ORDER BY t2.date_of_attendance;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: weather. Primary Key: () date, TEXT, Value Examples: ['1/8/2015', '2/8/2015', '3/8/2015'] 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', 'Fog'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] Give me the dates when the max temperature was higher than 85. [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 max_temperature_f > 85;
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: ['1/8/2015', '2/8/2015', '3/8/2015'] 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', 'Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] What are the dates with a maximum temperature higher than 85? [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 max_temperature_f > 85;
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: ['5th at Howard', 'Townsend at 7th', 'St James Park'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Palo Alto', 'Mountain View', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/5/2013', '8/25/2013', '8/23/2013'] [Foreign keys] [Question] What are the names of stations that have latitude lower than 37.5? [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 lat < 37.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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', '5th at Howard', 'Market at 4th'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Palo Alto', 'Mountain View', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/5/2013', '8/25/2013', '8/23/2013'] [Foreign keys] [Question] What are the names of all stations with a latitude smaller than 37.5? [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 lat < 37.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: 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: ['Redwood City', 'Mountain View', 'San Jose'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] For each city, return the highest latitude among its stations. [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 city, max(lat) FROM station GROUP BY city;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: 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: ['Redwood City', 'Mountain View', 'San Jose'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] For each city, what is the highest latitude for its stations? [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 city, max(lat) FROM station GROUP BY city;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: 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)', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] Give me the start station and end station for the trips with the three oldest id. [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 start_station_name, end_station_name FROM trip ORDER BY id 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: 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)', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] What is the station station and end station for the trips with the three smallest ids? [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 start_station_name, end_station_name FROM trip ORDER BY id 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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center', 'San Pedro Square'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Redwood City', 'San Francisco', 'San Jose'] installation_date, TEXT, Value Examples: ['12/31/2013', '8/6/2013', '8/5/2013'] [Foreign keys] [Question] What is the average latitude and longitude of stations located in San Jose 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 avg(lat), avg(long) FROM station WHERE city = "San Jose";
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', 'San Jose Civic Center', 'San Pedro Square'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['San Jose', 'San Francisco', 'Mountain View'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] What is the average latitude and longitude in San Jose? [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(lat), avg(long) FROM station WHERE city = "San Jose";
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: 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: ['Japantown', '5th at Howard', 'Market at 4th'] 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: ['Japantown', 'Market at 4th', '5th at Howard'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Subscriber', 'Customer'] zip_code, INTEGER [Foreign keys] [Question] What is the id of the trip that has the shortest duration? [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 id FROM trip ORDER BY duration 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: 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)', 'Market at 4th', '5th at Howard'] 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)', 'Market at 4th', '5th at Howard'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] What is the id of the shortest trip? [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 id FROM trip ORDER BY duration 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: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/25/2015 6:36', '8/26/2015 6:36', '8/27/2015 6:36'] start_station_name, TEXT, Value Examples: ['University and Emerson', 'Castro Street and El Camino Real', 'Evelyn Park and Ride'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/31/2015 6:36', '8/26/2015 8:36', '8/23/2015 16:36'] end_station_name, TEXT, Value Examples: ['Castro Street and El Camino Real', 'University and Emerson', 'Evelyn Park and Ride'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Subscriber', 'Customer'] zip_code, INTEGER [Foreign keys] [Question] What is the total and maximum duration of trips with bike id 636? [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 sum(duration), max(duration) FROM trip WHERE bike_id = 636;
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: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/25/2015 6:36', '8/26/2015 6:36', '8/27/2015 6:36'] 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/31/2015 6:36', '8/26/2015 8:36', '8/23/2015 16:36'] 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 total and maximum duration for all trips with the bike id 636? [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 sum(duration), max(duration) FROM trip WHERE bike_id = 636;
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: ['8/29/2013', '8/30/2013', '8/31/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: ['Fog', 'Rain-Thunderstorm', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] For each zip code, return the average mean temperature of August 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 , avg(mean_temperature_f) FROM weather WHERE date LIKE "8/%" GROUP BY zip_code;
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: ['8/29/2013', '8/30/2013', '8/31/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: ['Fog', 'Rain-Thunderstorm', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] For each zip code, what is the average mean temperature for all dates that start with '8'? [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 , avg(mean_temperature_f) FROM weather WHERE date LIKE "8/%" GROUP BY zip_code;
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: 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', 'San Pedro Square', 'Yerba Buena Center of the Arts (3rd @ Howard)'] 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: ['Howard at 2nd', 'San Pedro Square', 'Yerba Buena Center of the Arts (3rd @ Howard)'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] From the trip record, find the number of unique bikes. [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 bike_id) FROM trip;
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: 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', 'Market at 4th', 'Yerba Buena Center of the Arts (3rd @ Howard)'] 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: ['Howard at 2nd', 'Market at 4th', 'Yerba Buena Center of the Arts (3rd @ Howard)'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] How many different bike ids are there? [Constraints] Your [SQL Query] should satisfy the following constraints: - In `SELECT <column>`, must only use the column given in the [Database Schema]. - In `FROM <table>` or `JOIN <table>`, must only use the table given in the [Database Schema]. - In `JOIN`, must only use the tables and columns in the [Foreign keys]. - Without any specific instructions, Use `ASC` for `ORDER BY` by default, - Consider use `DISTINCT` when you need to eliminate duplicates. - The content in quotes is case sensitive. - Prioritize column whose value are more relevant to the [Question]. [SQL Query]
SELECT count(DISTINCT bike_id) FROM trip;
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', 'SJSU 4th at San Carlos'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Palo Alto', 'Mountain View', 'Redwood City'] installation_date, TEXT, Value Examples: ['8/12/2013', '8/15/2013', '8/16/2013'] [Foreign keys] [Question] What is the number of distinct cities the stations are located at? [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 city) FROM station;
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: ['Howard at 2nd', 'California Ave Caltrain Station', '5th at Howard'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['San Jose', 'Redwood City', 'Mountain View'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] How many different cities have these stations? [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 city) FROM station;
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: ['Mountain View', 'Redwood City', 'San Jose'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] How many stations does Mountain View city has? [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 WHERE city = "Mountain View";
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', 'Mountain View City Hall', 'Mountain View Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'San Jose', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] How many stations are in Mountain View? [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 WHERE city = "Mountain View";
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: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Townsend at 7th', 'St James Park'] 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/7/2013', '12/31/2013', '8/6/2013'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 12:47:02', '2015-06-02 12:57:02', '2015-06-02 13:07:02'] [Foreign keys] status(station_id) references station(id) [Question] Return the unique name for stations that have ever had 7 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.name FROM station AS t1 JOIN status AS t2 ON t1.id = t2.station_id WHERE t2.bikes_available = 7;
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', 'Redwood City Caltrain Station', 'Mountain View Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['San Francisco', 'Mountain View', 'Redwood City'] installation_date, TEXT, Value Examples: ['8/7/2013', '8/6/2013', '8/5/2013'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 12:47:02', '2015-06-02 12:57:02', '2015-06-02 13:07:02'] [Foreign keys] status(station_id) references station(id) [Question] What are the different names for each station that has ever had 7 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.name FROM station AS t1 JOIN status AS t2 ON t1.id = t2.station_id WHERE t2.bikes_available = 7;
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: 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)', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] Which start station had the most trips starting from August? Give me the name and id of the station. [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 start_station_name, start_station_id FROM trip WHERE start_date LIKE "8/%" GROUP BY start_station_name 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: 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)', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] What are the start station's name and id for the one that had the most start trips in August? [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 start_station_name, start_station_id FROM trip WHERE start_date LIKE "8/%" GROUP BY start_station_name 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: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/24/2015 7:02', '8/24/2015 8:02', '8/24/2015 9:02'] start_station_name, TEXT, Value Examples: ['Stanford in Redwood City', '2nd at Folsom', 'Beale at Market'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/24/2015 0:02', '8/24/2015 0:21', '8/24/2015 7:02'] end_station_name, TEXT, Value Examples: ['Stanford in Redwood City', '2nd at Folsom', 'Beale at Market'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] Which bike traveled the most often in zip code 94002? [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 bike_id FROM trip WHERE zip_code = 94002 GROUP BY bike_id ORDER BY count(*) DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/24/2015 7:02', '8/24/2015 8:02', '8/24/2015 9:02'] start_station_name, TEXT, Value Examples: ['Stanford in Redwood City', 'Broadway St at Battery St', 'Park at Olive'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/24/2015 0:02', '8/24/2015 0:21', '8/24/2015 7:02'] end_station_name, TEXT, Value Examples: ['Stanford in Redwood City', 'Broadway St at Battery St', 'Market at 4th'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] What is the id of the bike that traveled the most in 94002? [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 bike_id FROM trip WHERE zip_code = 94002 GROUP BY bike_id ORDER BY count(*) DESC LIMIT 1;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: weather. Primary Key: () date, TEXT, Value Examples: ['8/29/2013', '8/30/2013', '8/31/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', 'Fog-Rain', 'Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] How many days had both mean humidity above 50 and mean visibility above 8? [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 weather WHERE mean_humidity > 50 AND mean_visibility_miles > 8;
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: ['8/29/2013', '8/30/2013', '8/31/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 is the number of days that had an average humity above 50 and an average visibility above 8? [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 weather WHERE mean_humidity > 50 AND mean_visibility_miles > 8;
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', 'San Jose City Hall', 'Redwood City Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Redwood City', 'San Francisco', 'Mountain View'] 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: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Mountain View City Hall', 'Mountain View Caltrain Station'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] What is the latitude, longitude, city of the station from which the shortest trip started? [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.lat, t1.long, t1.city FROM station AS t1 JOIN trip AS t2 ON t1.id = t2.start_station_id ORDER BY t2.duration 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: ['San Jose Diridon Caltrain Station', 'San Jose City Hall', 'Redwood City Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Redwood City', 'San Francisco', 'Palo Alto'] 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: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Mountain View City Hall', 'Mountain View Caltrain Station'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Subscriber', 'Customer'] zip_code, INTEGER [Foreign keys] [Question] What is the latitude, longitude, and city of the station from which the trip with smallest duration started? [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.lat, t1.long, t1.city FROM station AS t1 JOIN trip AS t2 ON t1.id = t2.start_station_id ORDER BY t2.duration 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: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center', 'San Pedro Square'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['San Francisco', 'San Jose', 'Palo Alto'] installation_date, TEXT, Value Examples: ['8/12/2013', '8/15/2013', '8/16/2013'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 13:10:02', '2015-06-02 14:10:02', '2015-06-02 14:01:02'] [Foreign keys] status(station_id) references station(id) [Question] What are the ids of stations that are located in San Francisco and have average bike availability above 10. [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 id FROM station WHERE city = "San Francisco" INTERSECT SELECT station_id FROM status GROUP BY station_id HAVING avg(bikes_available) > 10;
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', 'San Jose Civic Center', 'San Pedro Square'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['San Francisco', 'San Jose', 'Mountain View'] installation_date, TEXT, Value Examples: ['8/12/2013', '8/15/2013', '8/16/2013'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 13:10:02', '2015-06-02 14:10:02', '2015-06-02 14:01:02'] [Foreign keys] status(station_id) references station(id) [Question] What are the ids of the stations in San Francisco that normally have more than 10 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 id FROM station WHERE city = "San Francisco" INTERSECT SELECT station_id FROM status GROUP BY station_id HAVING avg(bikes_available) > 10;
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: ['Adobe on Almaden', 'Stanford in Redwood City', 'Evelyn Park and Ride'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['San Jose', 'Palo Alto', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/14/2013', '4/9/2014', '1/22/2014'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 13:14:03', '2015-06-02 14:00:02', '2015-06-02 14:01:02'] [Foreign keys] status(station_id) references station(id) [Question] What are the names and ids of stations that had more than 14 bikes available on average or were installed in December? [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.id FROM station AS t1 JOIN status AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id HAVING avg(t2.bikes_available) > 14 UNION SELECT name, id FROM station WHERE installation_date LIKE "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: ['Adobe on Almaden', 'Stanford in Redwood City', 'Evelyn Park and Ride'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['San Jose', 'Palo Alto', 'Mountain View'] installation_date, TEXT, Value Examples: ['8/14/2013', '4/9/2014', '1/22/2014'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 13:14:03', '2015-06-02 14:00:02', '2015-06-02 14:01:02'] [Foreign keys] status(station_id) references station(id) [Question] What are the names and ids of all stations that have more than 14 bikes available on average or had bikes installed in December? [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.id FROM station AS t1 JOIN status AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id HAVING avg(t2.bikes_available) > 14 UNION SELECT name, id FROM station WHERE installation_date LIKE "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: ['9/3/2013', '10/3/2013', '11/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] What is the 3 most common cloud cover rates in the region of zip code 94107? [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 cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT (*) DESC 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: weather. Primary Key: () date, TEXT, Value Examples: ['10/3/2013', '11/3/2013', '12/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', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] What are the 3 most common cloud covers in the zip code of 94107? [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 cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT (*) DESC 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: weather. Primary Key: () date, TEXT, Value Examples: ['10/10/2013', '10/11/2013', '10/12/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', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] What is the zip code in which the average mean sea level pressure is the lowest? [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 ORDER BY avg(mean_sea_level_pressure_inches) 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: ['10/10/2013', '10/11/2013', '10/12/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', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] What is the zip code that has the lowest average mean sea level pressure? [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 ORDER BY avg(mean_sea_level_pressure_inches) 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: 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'] - 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', 'Redwood City', 'Mountain View'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] status(station_id) references station(id) [Question] What is the average bike availability in stations that are not located 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 avg(bikes_available) FROM status WHERE station_id NOT IN (SELECT id FROM station WHERE 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: 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'] - 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', 'Mountain View', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/12/2013', '8/15/2013', '8/16/2013'] [Foreign keys] status(station_id) references station(id) [Question] What is the average bike availablility for stations not 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 avg(bikes_available) FROM status WHERE station_id NOT IN (SELECT id FROM station WHERE 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: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Market at 10th', '5th at Howard'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'Redwood City', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/12/2013', '8/15/2013', '8/16/2013'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 13:10:02', '2015-06-02 14:10:02', '2015-06-02 12:46:02'] [Foreign keys] status(station_id) references station(id) [Question] What is the average longitude of stations that never had bike availability more than 10? [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(long) FROM station WHERE id NOT IN (SELECT station_id FROM status GROUP BY station_id HAVING max(bikes_available) > 10);
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: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'San Antonio Caltrain Station', 'Beale at Market'] 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', '8/15/2013', '8/16/2013'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 13:10:02', '2015-06-02 14:10:02', '2015-06-02 14:01:02'] [Foreign keys] status(station_id) references station(id) [Question] What is the mean longitude for all stations that have never had more than 10 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 avg(long) FROM station WHERE id NOT IN (SELECT station_id FROM status GROUP BY station_id HAVING max(bikes_available) > 10);
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/8/2013', '1/8/2014', '2/8/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: ['Fog-Rain', 'Rain-Thunderstorm', 'Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] When and in what zip code did max temperature reach 80? [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 , zip_code FROM weather WHERE max_temperature_f >= 80;
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/18/2013', '3/18/2014', '4/18/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', 'Rain', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] What zip codes have a station with a max temperature greater than or equal to 80 and when did it reach that temperature? [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 , zip_code FROM weather WHERE max_temperature_f >= 80;
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: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/22/2015 16:22', '8/22/2015 22:16', '8/23/2015 16:16'] start_station_name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Stanford in Redwood City', 'Beale at Market'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/22/2015 16:16', '8/24/2015 8:16', '8/24/2015 16:16'] end_station_name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Stanford in Redwood City', 'Beale at Market'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER - Table: weather. Primary Key: () date, TEXT, Value Examples: ['9/6/2013', '1/6/2014', '2/6/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 [Foreign keys] [Question] Give me ids for all the trip that took place in a zip code area with average mean temperature above 60. [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.id FROM trip AS t1 JOIN weather AS t2 ON t1.zip_code = t2.zip_code GROUP BY t2.zip_code HAVING avg(t2.mean_temperature_f) > 60;
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: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/22/2015 16:22', '8/22/2015 22:16', '8/23/2015 16:16'] start_station_name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Post at Kearny', 'Beale at Market'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/22/2015 16:16', '8/24/2015 8:16', '8/24/2015 16:16'] end_station_name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Post at Kearny', 'Beale at Market'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER - Table: weather. Primary Key: () date, TEXT, Value Examples: ['9/6/2013', '1/6/2014', '2/6/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: ['Fog', 'Rain-Thunderstorm', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] For each zip code, find the ids of all trips that have a higher average mean temperature above 60? [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.id FROM trip AS t1 JOIN weather AS t2 ON t1.zip_code = t2.zip_code GROUP BY t2.zip_code HAVING avg(t2.mean_temperature_f) > 60;
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/25/2013', '10/25/2013', '11/25/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: ['Fog', 'Rain-Thunderstorm', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] For each zip code, return how many times max wind speed reached 25? [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, count(*) FROM weather WHERE max_wind_speed_mph >= 25 GROUP BY zip_code;
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/25/2013', '11/25/2013', '12/25/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: ['Fog', 'Rain-Thunderstorm', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] For each zip code, how many times has the maximum wind speed reached 25 mph? [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, count(*) FROM weather WHERE max_wind_speed_mph >= 25 GROUP BY zip_code;
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', '4/1/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 [Foreign keys] [Question] On which day and in which zip code was the min dew point lower than any day in zip code 94107? [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 , zip_code FROM weather WHERE min_dew_point_f < (SELECT min(min_dew_point_f) FROM weather WHERE zip_code = 94107);
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/17/2013', '10/17/2014', '9/10/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', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] Which days had a minimum dew point smaller than any day in zip code 94107, and in which zip codes were those measurements taken? [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 , zip_code FROM weather WHERE min_dew_point_f < (SELECT min(min_dew_point_f) FROM weather WHERE zip_code = 94107);
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: 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: ['Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station', 'Palo Alto Caltrain Station'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Subscriber', 'Customer'] zip_code, INTEGER - Table: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['San Jose Diridon Caltrain Station', 'Redwood City Caltrain Station', 'Mountain View Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Palo Alto', 'Mountain View', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] For each trip, return its ending station's installation 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 t1.id, t2.installation_date FROM trip AS t1 JOIN station AS t2 ON t1.end_station_id = t2.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: 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)', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Subscriber', 'Customer'] zip_code, INTEGER - Table: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['San Jose Diridon Caltrain Station', 'Adobe on Almaden', 'Redwood City Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Palo Alto', 'Mountain View', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/12/2013', '8/15/2013', '8/16/2013'] [Foreign keys] [Question] What is the installation date for each ending station on all 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 t1.id, t2.installation_date FROM trip AS t1 JOIN station AS t2 ON t1.end_station_id = t2.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: 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)', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER - Table: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['San Jose Diridon Caltrain Station', 'Redwood City Caltrain Station', 'Mountain View Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'Redwood City', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] Which trip started from the station with the largest dock count? Give me the trip id. [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.id FROM trip AS t1 JOIN station AS t2 ON t1.start_station_id = t2.id ORDER BY t2.dock_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: 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)', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER - Table: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['San Jose Diridon Caltrain Station', 'Redwood City Caltrain Station', 'Mountain View Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'Redwood City', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] What is the id of the trip that started from the station with the highest dock count? [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.id FROM trip AS t1 JOIN station AS t2 ON t1.start_station_id = t2.id ORDER BY t2.dock_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: 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: ['San Francisco Caltrain (Townsend at 4th)', 'Mountain View City Hall', 'San Francisco Caltrain 2 (330 Townsend)'] 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: ['San Francisco Caltrain 2 (330 Townsend)', 'San Francisco Caltrain (Townsend at 4th)', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Subscriber', 'Customer'] zip_code, INTEGER - Table: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['San Jose Diridon Caltrain Station', 'San Jose Civic Center', 'San Pedro Square'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['San Francisco', 'Redwood City', 'San Jose'] installation_date, TEXT, Value Examples: ['8/12/2013', '8/15/2013', '8/16/2013'] [Foreign keys] [Question] Count the number of trips that did not end in San Francisco 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 trip AS t1 JOIN station AS t2 ON t1.end_station_id = t2.id WHERE t2.city != "San Francisco";
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: 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: ['San Pedro Square', 'San Francisco City Hall', 'San Jose Civic Center'] 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: ['San Mateo County Center', 'Paseo de San Antonio', 'San Pedro Square'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER - Table: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['San Jose Civic Center', 'San Pedro Square', 'Paseo de San Antonio'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['San Francisco', 'San Jose', 'Mountain View'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] How many trips did not end in San Francisco? [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 trip AS t1 JOIN station AS t2 ON t1.end_station_id = t2.id WHERE t2.city != "San Francisco";
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/17/2013', '10/17/2014', '9/10/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', 'Fog', 'Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] In zip code 94107, on which day neither Fog nor Rain was not observed? [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 zip_code = 94107 AND EVENTS != "Fog" AND EVENTS != "Rain";
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/17/2013', '10/17/2014', '10/27/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: ['Fog', 'Rain', 'rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] On which day has it neither been foggy nor rained in the zip code of 94107? [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 zip_code = 94107 AND EVENTS != "Fog" AND EVENTS != "Rain";
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', 'San Jose'] installation_date, TEXT, Value Examples: ['8/7/2013', '4/9/2014', '8/6/2013'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 13:37:02', '2015-06-02 14:37:02', '2015-06-02 14:17:02'] [Foreign keys] status(station_id) references station(id) [Question] What are the ids of stations that have latitude above 37.4 and never had bike availability below 7? [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 id FROM station WHERE lat > 37.4 EXCEPT SELECT station_id FROM status GROUP BY station_id HAVING min(bikes_available) < 7;
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: ['San Jose', 'Palo Alto', 'Mountain View'] installation_date, TEXT, Value Examples: ['8/7/2013', '4/9/2014', '8/6/2013'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 13:37:02', '2015-06-02 14:37:02', '2015-06-02 14:17:02'] [Foreign keys] status(station_id) references station(id) [Question] What are the ids of all stations that have a latitude above 37.4 and have never had less than 7 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 id FROM station WHERE lat > 37.4 EXCEPT SELECT station_id FROM status GROUP BY station_id HAVING min(bikes_available) < 7;
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', 'San Jose Civic Center', 'San Pedro Square'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['San Jose', 'Redwood City', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/12/2013', '8/15/2013', '8/16/2013'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 13:10:02', '2015-06-02 14:10:02', '2015-06-02 14:01:02'] [Foreign keys] status(station_id) references station(id) [Question] What are names of stations that have average bike availability above 10 and are not located in San Jose 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 t1.name FROM station AS t1 JOIN status AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id HAVING avg(bikes_available) > 10 EXCEPT SELECT name FROM station WHERE city = "San Jose";
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', 'San Jose Civic Center', 'San Pedro Square'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['San Jose', 'San Francisco', 'Palo Alto'] installation_date, TEXT, Value Examples: ['8/12/2013', '8/15/2013', '8/16/2013'] - Table: status. Primary Key: () station_id, INTEGER bikes_available, INTEGER docks_available, INTEGER time, TEXT, Value Examples: ['2015-06-02 13:10:02', '2015-06-02 14:10:02', '2015-06-02 14:01:02'] [Foreign keys] status(station_id) references station(id) [Question] What are the names of all stations that have more than 10 bikes available and are not located in San Jose? [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 station AS t1 JOIN status AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id HAVING avg(bikes_available) > 10 EXCEPT SELECT name FROM station WHERE city = "San Jose";
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', 'San Jose City Hall', 'Redwood City Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Redwood City', 'Mountain View', 'San Francisco'] installation_date, TEXT, Value Examples: ['12/31/2013', '8/6/2013', '8/5/2013'] [Foreign keys] [Question] What are the name, latitude, and city of the station with the lowest latitude? [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, lat, city FROM station ORDER BY lat 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: ['San Jose Diridon Caltrain Station', 'San Jose City Hall', 'Redwood City Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Redwood City', 'Mountain View', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] What is the name, latitude, and city of the station that is located the furthest South? [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, lat, city FROM station ORDER BY lat 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/3/2013', '10/3/2013', '11/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', 'Fog', 'Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] What are the date, mean temperature and mean humidity for the top 3 days with the largest max gust speeds? [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 , mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC 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: weather. Primary Key: () date, TEXT, Value Examples: ['9/3/2013', '10/3/2013', '11/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', 'Fog', 'Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] What is the date, average temperature and mean humidity for the days with the 3 largest maximum gust speeds? [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 , mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC 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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['Santa Clara at Almaden', 'San Salvador at 1st', 'SJSU 4th at San Carlos'] 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/15/2013', '8/5/2013', '8/25/2013'] [Foreign keys] [Question] List the name and the number of stations for all the cities that have at least 15 stations. [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 city, count(*) FROM station GROUP BY city HAVING count(*) >= 15;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: 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: ['Redwood City', 'Mountain View', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/15/2013', '8/5/2013', '8/25/2013'] [Foreign keys] [Question] What is the name of every city that has at least 15 stations and how many stations does it 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 city, count(*) FROM station GROUP BY city HAVING count(*) >= 15;
You are an experienced and professional database administrator.
Given [Database Schema] and [Foreign Keys], your task is to write a [SQL Query] to answer the [Question]. [Database Schema] Every table consists of several columns. Each line describes the name, type of the column and optional value examples. In some cases, column name can be ambiguous, and extra comment is provided to assist in understanding. - Table: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/21/2015 20:21', '8/22/2015 8:20', '8/22/2015 8:40'] 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/21/2015 21:50', '8/23/2015 8:40', '8/23/2015 20:23'] 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] Find the ids and names of stations from which at least 200 trips started. [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 start_station_id, start_station_name FROM trip GROUP BY start_station_name HAVING count(*) >= 200;
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: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/21/2015 20:21', '8/22/2015 8:20', '8/22/2015 8:40'] 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/21/2015 21:50', '8/23/2015 8:40', '8/23/2015 20:23'] 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] What are the ids and names of all start stations that were the beginning of at least 200 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 start_station_id, start_station_name FROM trip GROUP BY start_station_name HAVING count(*) >= 200;
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/10/2013', '10/1/2013', '10/2/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 zip code in which the average mean visibility is lower than 10. [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_visibility_miles) < 10;
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/10/2013', '10/1/2013', '10/2/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: ['Fog', 'Rain-Thunderstorm', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] For each zip code, select all those that have an average mean visiblity below 10. [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_visibility_miles) < 10;
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: ['Redwood City', 'Mountain View', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] List all the cities in a decreasing order of each city's stations' highest latitude. [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 city FROM station GROUP BY city ORDER BY max(lat) 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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['San Jose Diridon Caltrain Station', 'San Jose City Hall', 'Redwood City Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Redwood City', 'Mountain View', 'San Francisco'] installation_date, TEXT, Value Examples: ['8/6/2013', '8/5/2013', '8/7/2013'] [Foreign keys] [Question] For each city, list their names in decreasing order by their highest station latitude. [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 city FROM station GROUP BY city ORDER BY max(lat) 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: weather. Primary Key: () date, TEXT, Value Examples: ['9/5/2013', '10/5/2013', '11/5/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', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] What are the dates that had the top 5 cloud cover rates? Also tell me the cloud cover rate. [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 , cloud_cover FROM weather ORDER BY cloud_cover 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: weather. Primary Key: () date, TEXT, Value Examples: ['9/5/2013', '10/5/2013', '11/5/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', 'Fog-Rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] What are the dates that have the 5 highest cloud cover rates and what are the rates? [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 , cloud_cover FROM weather ORDER BY cloud_cover 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: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/23/2015 3:23', '8/25/2015 3:35', '8/27/2015 3:46'] 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 3:03', '8/23/2015 3:38', '8/25/2015 3:53'] 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 are the ids and durations of the trips with the top 3 durations? [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 id, duration FROM trip ORDER BY duration DESC 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: 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: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] What are the ids of the trips that lasted the longest and how long did they last? [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 id, duration FROM trip ORDER BY duration DESC 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: station. Primary Key: (id) id, INTEGER name, TEXT, Value Examples: ['San Jose Diridon Caltrain Station', 'Redwood City Caltrain Station', 'Mountain View Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'San Francisco', 'Palo Alto'] 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: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] For each station, return its longitude and the average duration of trips that started from the station. [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.long, avg(t2.duration) FROM station AS t1 JOIN trip AS t2 ON t1.id = t2.start_station_id GROUP BY 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: ['San Jose Diridon Caltrain Station', 'Redwood City Caltrain Station', 'Mountain View Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'San Francisco', 'Palo Alto'] 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: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] For each start station id, what is its name, longitude and average duration of trips started 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 t1.name, t1.long, avg(t2.duration) FROM station AS t1 JOIN trip AS t2 ON t1.id = t2.start_station_id GROUP BY 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: ['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', '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/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] For each station, find its latitude and the minimum duration of trips that ended at the station. [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.lat, min(t2.duration) FROM station AS t1 JOIN trip AS t2 ON t1.id = t2.end_station_id GROUP BY t2.end_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: ['San Jose Diridon Caltrain Station', 'Redwood City Caltrain Station', 'Mountain View Caltrain Station'] lat, NUMERIC, Comment: 'latitude' long, NUMERIC, Comment: 'longitude' dock_count, INTEGER city, TEXT, Value Examples: ['Mountain View', 'Redwood City', '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: ['Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station', 'University and Emerson'] 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: ['Palo Alto Caltrain Station', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] For each end station id, what is its name, latitude, and minimum duration for trips ended 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 t1.name, t1.lat, min(t2.duration) FROM station AS t1 JOIN trip AS t2 ON t1.id = t2.end_station_id GROUP BY t2.end_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: 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)', 'Palo Alto Caltrain Station', 'San Jose Diridon Caltrain Station'] 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: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Palo Alto Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Subscriber', 'Customer'] zip_code, INTEGER [Foreign keys] [Question] List all the distinct stations from which a trip of duration below 100 started. [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 start_station_name FROM trip WHERE duration < 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: 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 Caltrain Station', 'San Jose Diridon Caltrain Station'] 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', 'Mountain View Caltrain Station', 'San Jose Diridon Caltrain Station'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Subscriber', 'Customer'] zip_code, INTEGER [Foreign keys] [Question] What are all the different start station names for a trip that lasted less than 100? [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 start_station_name FROM trip WHERE duration < 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: ['9/17/2013', '9/27/2013', '10/7/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 all the zip codes in which the max dew point have never reached 70. [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 zip_code FROM weather EXCEPT SELECT DISTINCT zip_code FROM weather WHERE max_dew_point_f >= 70;
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/7/2013', '1/7/2014', '2/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', 'Rain', 'rain'] wind_dir_degrees, INTEGER zip_code, INTEGER [Foreign keys] [Question] What are all the different zip codes that have a maximum dew point that was always below 70? [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 zip_code FROM weather EXCEPT SELECT DISTINCT zip_code FROM weather WHERE max_dew_point_f >= 70;
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: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/24/2015 1:03', '8/24/2015 8:03', '8/24/2015 9:03'] 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/24/2015 6:03', '8/24/2015 7:03', '8/24/2015 8:03'] 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] Find the id for the trips that lasted at least as long as the average duration of trips in zip code 94103. [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 id FROM trip WHERE duration >= (SELECT avg(duration) FROM trip WHERE zip_code = 94103);
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: trip. Primary Key: (id) id, INTEGER duration, INTEGER start_date, TEXT, Value Examples: ['8/24/2015 1:03', '8/24/2015 8:03', '8/24/2015 9:03'] start_station_name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Stanford in Redwood City', 'Beale at Market'] start_station_id, INTEGER end_date, TEXT, Value Examples: ['8/24/2015 6:03', '8/24/2015 7:03', '8/24/2015 8:03'] end_station_name, TEXT, Value Examples: ['Yerba Buena Center of the Arts (3rd @ Howard)', 'Stanford in Redwood City', 'Market at 10th'] end_station_id, INTEGER bike_id, INTEGER subscription_type, TEXT, Value Examples: ['Customer', 'Subscriber'] zip_code, INTEGER [Foreign keys] [Question] What are the ids of all trips that had a duration as long as the average trip duration in the zip code 94103? [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 id FROM trip WHERE duration >= (SELECT avg(duration) FROM trip WHERE zip_code = 94103);
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/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 in which the mean sea level pressure was 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.