text
stringlengths 432
6.49k
| target
stringlengths 2
4.44k
|
|---|---|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_31 (round INTEGER, pick INTEGER)
### Question ###
What is the highest round number of a Pick after 209.
### Accurate SQL ###
|
SELECT MAX(round) FROM table_name_31 WHERE pick > 209
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE restaurant ( id int, name varchar, food_type varchar, city_name varchar, rating "decimal )
TABLE: CREATE TABLE location ( restaurant_id int, house_number int, street_name varchar, city_name varchar )
TABLE: CREATE TABLE geographic ( city_name varchar, county varchar, region varchar )
### Question ###
where are some restaurants good for french food ?
### Accurate SQL ###
|
SELECT location.house_number, restaurant.name FROM location, restaurant WHERE restaurant.food_type = 'french' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_42 (episode__number INTEGER, airdate VARCHAR)
### Question ###
What is the lowest episode # with an air date of October 31, 2001?
### Accurate SQL ###
|
SELECT MIN(episode__number) FROM table_name_42 WHERE airdate = "october 31, 2001"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_23820 ( "County" text, "Obama%" text, "Obama#" real, "McCain%" text, "McCain#" real )
### Question ###
What is the maximum Obama supporters in Wayne county?
### Accurate SQL ###
|
SELECT MAX("Obama#") FROM table_23820 WHERE "County" = 'Wayne'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) )
TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) )
TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) )
TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) )
TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) )
TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) )
TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) )
### Question ###
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, and I want to show in asc by the X-axis.
### Accurate SQL ###
|
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_16156 ( "Model" real, "Introduction" text, "Discontinued" text, "CPU Speed" text, "Print resolution (DPI) Resolution is given in dots per inch (DPI)" text, "Print speed (PPM)" text, "Standard memory" text, "Maximum memory" text )
### Question ###
What is the print resolution (FPI) for December 2002?
### Accurate SQL ###
|
SELECT "Print resolution (DPI) Resolution is given in dots per inch (DPI)" FROM table_16156 WHERE "Introduction" = 'December 2002'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_40302 ( "Tournament" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text )
### Question ###
What was in 2007 that has a 3r of 1999?
### Accurate SQL ###
|
SELECT "2007" FROM table_40302 WHERE "1999" = '3r'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_78209 ( "Date(s) conducted" text, "Polling organisation/client" text, "Cons" text, "Plaid Cymru" text, "Lib Dem" text, "Others" text, "Lead" text )
### Question ###
Tell me the dates conducted for plaid cymru of 19%
### Accurate SQL ###
|
SELECT "Date(s) conducted" FROM table_78209 WHERE "Plaid Cymru" = '19%'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_9 ( home_team VARCHAR )
### Question ###
What was Geelong's score when they were the home team?
### Accurate SQL ###
|
SELECT home_team AS score FROM table_name_9 WHERE home_team = "geelong"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_47 ( competition VARCHAR, date VARCHAR )
### Question ###
Which competition was on 17/9/00?
### Accurate SQL ###
|
SELECT competition FROM table_name_47 WHERE date = "17/9/00"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_13762472_4 ( record VARCHAR, date VARCHAR )
### Question ###
what's the record with date being december 29
### Accurate SQL ###
|
SELECT record FROM table_13762472_4 WHERE date = "December 29"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1942683_1 (house_colour VARCHAR, house_name VARCHAR)
### Question ###
What is the house colour associated with the house name of Kupe?
### Accurate SQL ###
|
SELECT house_colour FROM table_1942683_1 WHERE house_name = "Kupe"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_67891 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Try BP" text, "Losing BP" text )
### Question ###
What is the try BP when the losing BP is 4 and the club is Bargoed RFC?
### Accurate SQL ###
|
SELECT "Try BP" FROM table_67891 WHERE "Losing BP" = '4' AND "Club" = 'bargoed rfc'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_25820584_7 (win_loss VARCHAR, year_s_ VARCHAR)
### Question ###
What was the win loss record the lady who appeard in 1969?
### Accurate SQL ###
|
SELECT win_loss FROM table_25820584_7 WHERE year_s_ = "1969"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_25369796_1 ( position VARCHAR, points VARCHAR )
### Question ###
How many team position scored 56 points?
### Accurate SQL ###
|
SELECT COUNT(position) FROM table_25369796_1 WHERE points = "56"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_51042 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "TV Time" text, "Attendance" text )
### Question ###
What was the result when the attendance was 47,971?
### Accurate SQL ###
|
SELECT "Result" FROM table_51042 WHERE "Attendance" = '47,971'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_12159115_2 (directed_by VARCHAR, us_viewers__millions_ VARCHAR)
### Question ###
What's the total number of directors who've directed episodes seen by 11.34 million US viewers?
### Accurate SQL ###
|
SELECT COUNT(directed_by) FROM table_12159115_2 WHERE us_viewers__millions_ = "11.34"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_18784280_3 (position_in_table VARCHAR, team VARCHAR)
### Question ###
Which position in the table is the team watford?
### Accurate SQL ###
|
SELECT position_in_table FROM table_18784280_3 WHERE team = "Watford"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_72 ( constituency VARCHAR, winning_party_2003 VARCHAR )
### Question ###
Which constituency had the conservative party win in 2003?
### Accurate SQL ###
|
SELECT constituency FROM table_name_72 WHERE winning_party_2003 = "conservative"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1973842_1 (type VARCHAR, nickname VARCHAR)
### Question ###
What's the type of the school whose students' name is spirits?
### Accurate SQL ###
|
SELECT type FROM table_1973842_1 WHERE nickname = "Spirits"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_13026799_1 (championship VARCHAR, margin VARCHAR)
### Question ###
What championship had a margin of playoff 2?
### Accurate SQL ###
|
SELECT championship FROM table_13026799_1 WHERE margin = "Playoff 2"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_6091 ( "Model Number" text, "Stepping" text, "Frequency" text, "L2 Cache" text, "Multi 1" text, "V Core" text, "Socket" text, "Release Date" text, "Part Number(s)" text )
### Question ###
What is the multi 1 for the Athlon x2 BE-2400?
### Accurate SQL ###
|
SELECT "Multi 1" FROM table_6091 WHERE "Model Number" = 'athlon x2 be-2400'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_13 (against INTEGER, venue VARCHAR)
### Question ###
What is the average against of Murrayfield, Edinburgh?
### Accurate SQL ###
|
SELECT AVG(against) FROM table_name_13 WHERE venue = "murrayfield, edinburgh"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_14 (afl_team VARCHAR, position VARCHAR, pick VARCHAR)
### Question ###
Which AFL team has a pick 4 for the offensive tackle position?
### Accurate SQL ###
|
SELECT afl_team FROM table_name_14 WHERE position = "offensive tackle" AND pick = 4
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_43959 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text )
### Question ###
Who was the home team against the Bolton Wanderers?
### Accurate SQL ###
|
SELECT "Home team" FROM table_43959 WHERE "Away team" = 'bolton wanderers'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar )
TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar )
TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar )
TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int )
TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int )
TABLE: CREATE TABLE area ( course_id int, area varchar )
TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar )
TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar )
TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar )
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int )
TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int )
TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
### Question ###
What 's the difference between courses RCNSCI 104 and RCNSCI 232 ?
### Accurate SQL ###
|
SELECT DISTINCT department, description, number FROM course WHERE (department = 'RCNSCI' AND number = 104) OR (department = 'RCNSCI' AND number = 232)
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_70 ( season_outcome VARCHAR, school VARCHAR )
### Question ###
What is the Season Outcome, when the School is Sussex Tech?
### Accurate SQL ###
|
SELECT season_outcome FROM table_name_70 WHERE school = "sussex tech"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_11677760_1 ( college VARCHAR, player VARCHAR )
### Question ###
what is the college for the player damon bailey?
### Accurate SQL ###
|
SELECT college FROM table_11677760_1 WHERE player = "Damon Bailey"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_27715173_2 ( game INTEGER )
### Question ###
What is the maximum basketball game?
### Accurate SQL ###
|
SELECT MAX(game) FROM table_27715173_2
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_70215 ( "Currency" text, "Code" text, "Entry ERM II" text, "Central rate" text, "Official target date" text )
### Question ###
Which currency has a central rate of 3.45280?
### Accurate SQL ###
|
SELECT "Currency" FROM table_70215 WHERE "Central rate" = '3.45280'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_72343 ( "Submitting country" text, "Film title used in nomination" text, "Original title" text, "Language(s)" text, "Director(s)" text, "Result" text )
### Question ###
What country submitted miehen ty ?
### Accurate SQL ###
|
SELECT "Submitting country" FROM table_72343 WHERE "Original title" = 'Miehen työ'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_7 (position VARCHAR, notes VARCHAR)
### Question ###
What position has notes of 2:12:53?
### Accurate SQL ###
|
SELECT position FROM table_name_7 WHERE notes = "2:12:53"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE product ( product_id int, product text, dimensions text, dpi real, pages_per_minute_color real, max_page_size text, interface text )
TABLE: CREATE TABLE store ( Store_ID int, Store_Name text, Type text, Area_size real, Number_of_product_category real, Ranking int )
TABLE: CREATE TABLE store_product ( Store_ID int, Product_ID int )
TABLE: CREATE TABLE store_district ( Store_ID int, District_ID int )
TABLE: CREATE TABLE district ( District_ID int, District_name text, Headquartered_City text, City_Population real, City_Area real )
### Question ###
Find the name and population of districts with population between 200000 and 200000. Show a bar chart.
### Accurate SQL ###
|
SELECT District_name, City_Population FROM district WHERE City_Population BETWEEN 200000 AND 2000000
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_67492 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Notes" text )
### Question ###
Name the venue for 2004 and position of 25th
### Accurate SQL ###
|
SELECT "Venue" FROM table_67492 WHERE "Position" = '25th' AND "Year" = '2004'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_48988 ( "Position" real, "Team" text, "Played" real, "Drawn" real, "Lost" real, "Goals For" real, "Goals Against" real, "Goal Difference" text, "Points 1" real )
### Question ###
What is the average goals for that has +40 as the goals difference, with points 1 greater than 55?
### Accurate SQL ###
|
SELECT AVG("Goals For") FROM table_48988 WHERE "Goal Difference" = '+40' AND "Points 1" > '55'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_29142 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Incoming manager" text, "Date of appointment" text, "Position in Table" text )
### Question ###
What is the team when the date of appointment is 23 march 2011?
### Accurate SQL ###
|
SELECT "Team" FROM table_29142 WHERE "Date of appointment" = '23 March 2011'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_53 ( object_type VARCHAR, ngc_number VARCHAR, declination___j2000__ VARCHAR )
### Question ###
Which object type had an NGC number greater than 6357 and a declination (J2000) of 45 34 ?
### Accurate SQL ###
|
SELECT object_type FROM table_name_53 WHERE ngc_number > 6357 AND declination___j2000__ = "°45′34″"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_71261 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
### Question ###
How many points are there for a Mclaren m23 chassis later than 1972?
### Accurate SQL ###
|
SELECT COUNT("Points") FROM table_71261 WHERE "Year" > '1972' AND "Chassis" = 'mclaren m23'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_36404 ( "Rank" real, "Name" text, "Nationality" text, "1st (m)" real, "2nd (m)" real, "Points" real, "Overall WC points (Rank)" text )
### Question ###
What is the total 2nd of Thomas Morgenstern, who has a 1st less than 132.5?
### Accurate SQL ###
|
SELECT COUNT("2nd (m)") FROM table_36404 WHERE "Name" = 'thomas morgenstern' AND "1st (m)" < '132.5'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE election ( election_id number, counties_represented text, district number, delegate text, party number, first_elected number, committee text )
TABLE: CREATE TABLE party ( party_id number, year number, party text, governor text, lieutenant_governor text, comptroller text, attorney_general text, us_senate text )
TABLE: CREATE TABLE county ( county_id number, county_name text, population number, zip_code text )
### Question ###
Which parties did not have any delegates in elections?
### Accurate SQL ###
|
SELECT party FROM party WHERE NOT party_id IN (SELECT party FROM election)
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
what is the number of patients whose admission type is urgent and procedure long title is cardiac mapping?
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.long_title = "Cardiac mapping"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text )
TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time )
TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text )
TABLE: CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time )
TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time )
TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number )
TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number )
### Question ###
had patient 67468 ever had some pericardial's in 12/2105?
### Accurate SQL ###
|
SELECT COUNT(*) > 0 FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 67468)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'pericardial' AND d_items.linksto = 'outputevents') AND STRFTIME('%y-%m', outputevents.charttime) = '2105-12'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_88 (opponent VARCHAR, date VARCHAR)
### Question ###
Who is the opponent on November 20, 1966?
### Accurate SQL ###
|
SELECT opponent FROM table_name_88 WHERE date = "november 20, 1966"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT )
TABLE: CREATE TABLE weather ( date TEXT, 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, wind_dir_degrees INTEGER, zip_code INTEGER )
TABLE: CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER )
TABLE: CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT )
### Question ###
Show me a bar chart for what are the different ids and names of the stations that have had more than 12 bikes available?, rank id in asc order.
### Accurate SQL ###
|
SELECT name, id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available > 12 ORDER BY id
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_16211 ( "Player" text, "Matches" real, "Inns" real, "N/O" real, "Runs" real, "High Score" real, "Average" text, "100" real, "50" real, "Catches" real, "Stump" real )
### Question ###
what's the player where 50 is 2 and n/o is 0
### Accurate SQL ###
|
SELECT "Player" FROM table_16211 WHERE "50" = '2' AND "N/O" = '0'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) )
TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) )
TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) )
TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) )
TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) )
TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) )
TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) )
### Question ###
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, give me the comparison about the average of department_id over the job_id , and group by attribute job_id.
### Accurate SQL ###
|
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_67 (name VARCHAR, took_office VARCHAR)
### Question ###
Who has Took Office of march 4, 1875?
### Accurate SQL ###
|
SELECT name FROM table_name_67 WHERE took_office = "march 4, 1875"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_9 ( original_title VARCHAR, english_title VARCHAR )
### Question ###
English title of mal na had what original title?
### Accurate SQL ###
|
SELECT original_title FROM table_name_9 WHERE english_title = "malèna"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_87 ( years VARCHAR, league VARCHAR )
### Question ###
The league of 400 (21) has what years listed?
### Accurate SQL ###
|
SELECT years FROM table_name_87 WHERE league = "400 (21)"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE host ( host_id number, name text, nationality text, age text )
TABLE: CREATE TABLE party_host ( party_id number, host_id number, is_main_in_charge others )
TABLE: CREATE TABLE party ( party_id number, party_theme text, location text, first_year text, last_year text, number_of_hosts number )
### Question ###
Count the number of parties.
### Accurate SQL ###
|
SELECT COUNT(*) FROM party
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_74319 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text )
### Question ###
What is the title of the episode Alex Reid directed?
### Accurate SQL ###
|
SELECT "Title" FROM table_74319 WHERE "Directed by" = 'Alex Reid'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_14836185_3 ( scoring_rank VARCHAR, year VARCHAR )
### Question ###
What was the scoring rank for Angela Stanford in 2009?
### Accurate SQL ###
|
SELECT scoring_rank FROM table_14836185_3 WHERE year = 2009
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_203_757 ( id number, "year" number, "award ceremony" text, "category" text, "film/show" text, "result" text )
### Question ###
which film/show only had two award ceremonies ?
### Accurate SQL ###
|
SELECT "film/show" FROM table_203_757 GROUP BY "film/show" HAVING COUNT("award ceremony") = 2
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_32162 ( "Region" text, "Date" real, "Label" text, "Format" text, "Catalog" text )
### Question ###
Tell me the catalog for date larger than 2004
### Accurate SQL ###
|
SELECT "Catalog" FROM table_32162 WHERE "Date" > '2004'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_34791 ( "Date" text, "Result" text, "Score" text, "Brazil scorers" text, "Competition" text )
### Question ###
Which Result has a Competition of world cup qualifying, and a Date of march 21, 1954?
### Accurate SQL ###
|
SELECT "Result" FROM table_34791 WHERE "Competition" = 'world cup qualifying' AND "Date" = 'march 21, 1954'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE ref_product_categories (product_category_description VARCHAR, product_category_code VARCHAR)
### Question ###
Find the product category description of the product category with code "Spices".
### Accurate SQL ###
|
SELECT product_category_description FROM ref_product_categories WHERE product_category_code = "Spices"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_29939 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
### Question ###
What is the record when the date is January 7?
### Accurate SQL ###
|
SELECT "Record" FROM table_29939 WHERE "Date" = 'January 7'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_62 ( opponents INTEGER, opponent VARCHAR, result VARCHAR, nuggets_points VARCHAR )
### Question ###
How many Opponents have a Result of win, and Nuggets points smaller than 115, and an Opponent of washington?
### Accurate SQL ###
|
SELECT SUM(opponents) FROM table_name_62 WHERE result = "win" AND nuggets_points < 115 AND opponent = "washington"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1341663_14 (first_elected INTEGER, incumbent VARCHAR)
### Question ###
What year was Frank Annunzio elected
### Accurate SQL ###
|
SELECT MIN(first_elected) FROM table_1341663_14 WHERE incumbent = "Frank Annunzio"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text )
TABLE: CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text )
### Question ###
Show me about the distribution of ACC_Road and School_ID , and group by attribute ACC_Home in a bar chart, and show Y-axis in descending order.
### Accurate SQL ###
|
SELECT ACC_Road, School_ID FROM basketball_match GROUP BY ACC_Home, ACC_Road ORDER BY School_ID DESC
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_17641206_6 ( original_title VARCHAR, written_by VARCHAR )
### Question ###
Name the total number of original titles written by john sullivan and keith lindsay
### Accurate SQL ###
|
SELECT COUNT(original_title) FROM table_17641206_6 WHERE written_by = "John Sullivan and Keith Lindsay"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
### Question ###
how many times has patient 015-56390 recieved a enteral tube intake: nasoduodenal nostril, r 10f intake in 12/last year?
### Accurate SQL ###
|
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-56390')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.celllabel = 'enteral tube intake: nasoduodenal nostril, r 10f' AND DATETIME(intakeoutput.intakeoutputtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', intakeoutput.intakeoutputtime) = '12'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_5226 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
### Question ###
What's the score of the game with a Loss of Glavine (12-5) that more than 29,007 people attended?
### Accurate SQL ###
|
SELECT "Score" FROM table_5226 WHERE "Attendance" > '29,007' AND "Loss" = 'glavine (12-5)'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_68558 ( "Season" text, "Competition" text, "Round" text, "Opponents" text, "Home leg" text, "Away leg" text, "Aggregate" text )
### Question ###
Name the competition for motherwell opponents
### Accurate SQL ###
|
SELECT "Competition" FROM table_68558 WHERE "Opponents" = 'motherwell'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_36 (work VARCHAR, result VARCHAR, year VARCHAR)
### Question ###
what is the work when the result is won and the year is before 2003?
### Accurate SQL ###
|
SELECT work FROM table_name_36 WHERE result = "won" AND year < 2003
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_26263322_1 ( result VARCHAR, background VARCHAR )
### Question ###
How many times was the background university student?
### Accurate SQL ###
|
SELECT COUNT(result) FROM table_26263322_1 WHERE background = "University Student"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_44097 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text )
### Question ###
Which Score has a To par of 1, and a Player of mick soli?
### Accurate SQL ###
|
SELECT "Score" FROM table_44097 WHERE "To par" = '–1' AND "Player" = 'mick soli'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_41 (stadium VARCHAR, date VARCHAR)
### Question ###
What is the Stadium held on november 29?
### Accurate SQL ###
|
SELECT stadium FROM table_name_41 WHERE date = "november 29"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_75 (name VARCHAR, builder VARCHAR, laid_down VARCHAR)
### Question ###
What is the name of the boat that was built by Chatham and Laid down of 25 april 1887?
### Accurate SQL ###
|
SELECT name FROM table_name_75 WHERE builder = "chatham" AND laid_down = "25 april 1887"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_29219286_1 (written_by VARCHAR, directed_by VARCHAR, no_in_season VARCHAR)
### Question ###
How many people wrote episode 9 in the season that was directed by Ernest Dickerson?
### Accurate SQL ###
|
SELECT COUNT(written_by) FROM table_29219286_1 WHERE directed_by = "Ernest Dickerson" AND no_in_season = 9
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int )
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar )
TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar )
TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar )
TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int )
TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar )
TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int )
TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar )
TABLE: CREATE TABLE area ( course_id int, area varchar )
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int )
TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar )
### Question ###
Is there a section of WOMENSTD 314 after 10:15 P.M. ?
### Accurate SQL ###
|
SELECT DISTINCT course_offering.end_time, course_offering.section_number, course_offering.start_time FROM course, course_offering, semester WHERE course_offering.start_time > '10:15' AND course.course_id = course_offering.course_id AND course.department = 'WOMENSTD' AND course.number = 314 AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_33466 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
### Question ###
What is richmond's score as the home team?
### Accurate SQL ###
|
SELECT "Home team score" FROM table_33466 WHERE "Home team" = 'richmond'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_34202 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
### Question ###
What date was the visitor chicago black hawks, and a Record of 1-1?
### Accurate SQL ###
|
SELECT "Date" FROM table_34202 WHERE "Visitor" = 'chicago black hawks' AND "Record" = '1-1'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_9 ( local_affairs VARCHAR, year VARCHAR )
### Question ###
Who was in local affairs in 2012-2013?
### Accurate SQL ###
|
SELECT local_affairs FROM table_name_9 WHERE year = "2012-2013"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_98 ( pocona_municipality VARCHAR, totora_municipality VARCHAR, pojo_municipality VARCHAR )
### Question ###
What is Pocona Municipalities with 72 Totora municipalities and more than 74 pojo municipalities?
### Accurate SQL ###
|
SELECT COUNT(pocona_municipality) FROM table_name_98 WHERE totora_municipality = 72 AND pojo_municipality > 74
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_58048 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
### Question ###
Where was the game with a crowd of 18,817 and an away team score of 11.14 (80) held?
### Accurate SQL ###
|
SELECT "Venue" FROM table_58048 WHERE "Crowd" > '18,817' AND "Away team score" = '11.14 (80)'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_98 (laps VARCHAR, driver VARCHAR)
### Question ###
Which lap number had Olivier Panis as a driver?
### Accurate SQL ###
|
SELECT laps FROM table_name_98 WHERE driver = "olivier panis"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_22825058_23 (partnering VARCHAR, round VARCHAR)
### Question ###
Name the partnering for round sf
### Accurate SQL ###
|
SELECT partnering FROM table_22825058_23 WHERE round = "SF"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_28493 ( "Week #" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text )
### Question ###
Who was the original artist of the First solo theme?
### Accurate SQL ###
|
SELECT "Original artist" FROM table_28493 WHERE "Theme" = 'First Solo'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE professor (emp_num VARCHAR, dept_code VARCHAR)
TABLE: CREATE TABLE department (dept_code VARCHAR, dept_name VARCHAR)
TABLE: CREATE TABLE CLASS (prof_num VARCHAR)
TABLE: CREATE TABLE employee (emp_fname VARCHAR, emp_num VARCHAR)
### Question ###
What is the first names of the professors from the history department who do not teach a class.
### Accurate SQL ###
|
SELECT T1.emp_fname FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' EXCEPT SELECT T4.emp_fname FROM employee AS T4 JOIN CLASS AS T5 ON T4.emp_num = T5.prof_num
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_61 (gold VARCHAR, nation VARCHAR, total VARCHAR, bronze VARCHAR)
### Question ###
What is the total number of golds having a total of 1, bronzes of 0, and from West Germany?
### Accurate SQL ###
|
SELECT COUNT(gold) FROM table_name_61 WHERE total = 1 AND bronze < 1 AND nation = "west germany"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_31013 ( "Rnd" text, "Circuit" text, "AP Winning Team" text, "BP Winning Team" text, "CM Winning Team" text, "CP Winning Team" text, "DM Winning Team" text, "DP Winning Team" text, "EM Winning Team" text, "EP Winning Team" text, "FM Winning Team" text, "FP Winning Team" text, "GM Winning Team" text, "GP Winning Team" text, "HM Winning Team" text, "HP Winning Team" text, "Results" text )
### Question ###
Who was the EP winning team when the FM winning team was Brabham - Ford and the HM winning team was Osca?
### Accurate SQL ###
|
SELECT "EP Winning Team" FROM table_31013 WHERE "FM Winning Team" = 'Brabham - Ford' AND "HM Winning Team" = 'Osca'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_10161 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
### Question ###
What was the home team's score when North Melbourne was the away team?
### Accurate SQL ###
|
SELECT "Home team score" FROM table_10161 WHERE "Away team" = 'north melbourne'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
### Question ###
How many of the patients with unspecified chronic obstructive asthma had a lab test for hematology?
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Chronic obstructive asthma, unspecified" AND lab."CATEGORY" = "Hematology"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_204_738 ( id number, "season" number, "level" text, "division" text, "section" text, "position" text, "movements" text )
### Question ###
in which years did they finish at least 3rd ?
### Accurate SQL ###
|
SELECT "season" FROM table_204_738 WHERE "position" <= 3
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_8866 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
### Question ###
What was the record for game 59?
### Accurate SQL ###
|
SELECT "Record" FROM table_8866 WHERE "Game" = '59'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_31 ( gold INTEGER, bronze INTEGER )
### Question ###
Tell me the sum of gold for bronze less than 0
### Accurate SQL ###
|
SELECT SUM(gold) FROM table_name_31 WHERE bronze < 0
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1341423_43 (incumbent VARCHAR, district VARCHAR)
### Question ###
Name the incumbent for texas 22 district
### Accurate SQL ###
|
SELECT incumbent FROM table_1341423_43 WHERE district = "Texas 22"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_1 ( record VARCHAR, score VARCHAR )
### Question ###
What is the record of the game with a 110-106 score?
### Accurate SQL ###
|
SELECT record FROM table_name_1 WHERE score = "110-106"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) )
TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) )
TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) )
TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) )
TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) )
TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) )
TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) )
### Question ###
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, a bar chart shows the distribution of job_id and the sum of salary , and group by attribute job_id, list Y-axis from low to high order.
### Accurate SQL ###
|
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY SUM(SALARY)
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
### Question ###
since 2102, what were the five most frequent medications prescribed to the motor neuropathy - multiple sclerosis male patients 50s during the same month after they were diagnosed with motor neuropathy - multiple sclerosis?
### Accurate SQL ###
|
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'motor neuropathy - multiple sclerosis' AND STRFTIME('%y', diagnosis.diagnosistime) >= '2102') AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.gender = 'male' AND patient.age BETWEEN 50 AND 59 AND STRFTIME('%y', medication.drugstarttime) >= '2102') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND DATETIME(t1.diagnosistime, 'start of month') = DATETIME(t2.drugstarttime, 'start of month') GROUP BY t2.drugname) AS t3 WHERE t3.c1 <= 5
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
### Question ###
how many days have passed since patient 027-203413 was admitted for to the hospital?
### Accurate SQL ###
|
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.hospitaladmittime)) FROM patient WHERE patient.uniquepid = '027-203413' AND patient.hospitaldischargetime IS NULL
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_2886617_3 (nhl_team VARCHAR, player VARCHAR)
### Question ###
Which nhl team has the player kevin mckay?
### Accurate SQL ###
|
SELECT nhl_team FROM table_2886617_3 WHERE player = "Kevin McKay"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_19834691_4 (timeslot VARCHAR, viewers__millions_ VARCHAR)
### Question ###
Name the timeslot for 6.51 viewers
### Accurate SQL ###
|
SELECT timeslot FROM table_19834691_4 WHERE viewers__millions_ = "6.51"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time )
TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text )
TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time )
TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number )
TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
TABLE: CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time )
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text )
TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text )
TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number )
TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text )
### Question ###
calculate the four year survival rate among the patients who were prescribed clopidogrel bisulfate after they were diagnosed with kidney laceration-open.
### Accurate SQL ###
|
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 4 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'kidney laceration-open') GROUP BY admissions.subject_id HAVING MIN(diagnoses_icd.charttime) = diagnoses_icd.charttime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.charttime) > 4 * 365) AS t2 JOIN (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'clopidogrel bisulfate') AS t3 ON t2.subject_id = t3.subject_id WHERE t2.charttime < t3.startdate) AS t4 JOIN patients ON t4.subject_id = patients.subject_id
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
### Question ###
count the numbers of people that have been admitted to the hospital since 4 years ago.
### Accurate SQL ###
|
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-4 year')
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1341843_15 (incumbent VARCHAR, district VARCHAR)
### Question ###
Who's the incumbent of Indiana 4 district?
### Accurate SQL ###
|
SELECT incumbent FROM table_1341843_15 WHERE district = "Indiana 4"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_203_517 ( id number, "#" number, "date" text, "visitor" text, "score" text, "home" text, "record" text, "pts" number )
### Question ###
what date was the first game played ?
### Accurate SQL ###
|
SELECT "date" FROM table_203_517 WHERE id = 1
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_1214 ( "Processor Speed (MHz)" real, "Input Clock (MHz)" text, "Voltage Center (V)" text, "Voltage Range (V)" text, "Part Number" text, "Clock Multiplier" text, "S-Spec Number" text )
### Question ###
What is the processor speed (mhz) for part number a80486dx4-75?
### Accurate SQL ###
|
SELECT COUNT("Processor Speed (MHz)") FROM table_1214 WHERE "Part Number" = 'A80486DX4-75'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_19 ( average INTEGER, rank VARCHAR, celebrity VARCHAR )
### Question ###
What is the highest average of celebrity Natalia Lesz, who is ranked greater than 4?
### Accurate SQL ###
|
SELECT MAX(average) FROM table_name_19 WHERE rank > 4 AND celebrity = "natalia lesz"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.