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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,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) ) 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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,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) ) ### Question ### For those employees who did not have any job in the past, visualize the relationship between commission_pct and manager_id . ### Accurate SQL ###
SELECT COMMISSION_PCT, MANAGER_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
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_75393 ( "Game" real, "March" real, "Opponent" text, "Score" text, "Record" text, "Points" real ) ### Question ### Which Score has a March larger than 15, and Points larger than 96, and a Game smaller than 76, and an Opponent of @ washington capitals? ### Accurate SQL ###
SELECT "Score" FROM table_75393 WHERE "March" > '15' AND "Points" > '96' AND "Game" < '76' AND "Opponent" = '@ washington capitals'
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_19034 ( "Rank" real, "Islands Name" text, "Area (sqmi)" real, "Area (km 2 )" real, "Location" text, "Population (2000)" text ) ### Question ### What's the name is the island with a population of just 64? ### Accurate SQL ###
SELECT "Islands Name" FROM table_19034 WHERE "Population (2000)" = '64'
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_7968 ( "Player" text, "League" real, "Scottish Cup" real, "League Cup" real, "Challenge Cup" real, "Total" real ) ### Question ### What was the average league with Kris Doolan and a total less than 5? ### Accurate SQL ###
SELECT AVG("League") FROM table_7968 WHERE "Player" = 'kris doolan' AND "Total" < '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_55 (score VARCHAR, date VARCHAR) ### Question ### What was the score on October 24, 2005? ### Accurate SQL ###
SELECT score FROM table_name_55 WHERE date = "october 24, 2005"
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_42971 ( "City of License /Market" text, "Station" text, "Channel TV ( DT )" text, "Years owned" text, "Current affiliation" text ) ### Question ### What is the current affiliation when the years owned is between 1955 1995? ### Accurate SQL ###
SELECT "Current affiliation" FROM table_42971 WHERE "Years owned" = '1955–1995'
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_22 ( silver VARCHAR, total VARCHAR, gold VARCHAR ) ### Question ### What is the total number of silver medals for nations with 5 total medals and more than 3 gold medals? ### Accurate SQL ###
SELECT COUNT(silver) FROM table_name_22 WHERE total = 5 AND gold > 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_name_15 (rounds VARCHAR, chassis VARCHAR, driver VARCHAR) ### Question ### How many rounds did geoff lees drive with chassis of n180? ### Accurate SQL ###
SELECT rounds FROM table_name_15 WHERE chassis = "n180" AND driver = "geoff lees"
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 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 medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime 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 cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime 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 diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) ### Question ### when patient 006-83902 has left the hospital the first time in 2102? ### Accurate SQL ###
SELECT patient.hospitaldischargetime FROM patient WHERE patient.uniquepid = '006-83902' AND STRFTIME('%y', patient.hospitaldischargetime) = '2102' ORDER BY patient.hospitaldischargetime LIMIT 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_71 (place VARCHAR, country VARCHAR, money___$__ VARCHAR, score VARCHAR) ### Question ### Where did the player place who is from the United States, who made more than $216, and whose score was 74-70-71-69=284? ### Accurate SQL ###
SELECT place FROM table_name_71 WHERE country = "united states" AND money___$__ > 216 AND score = 74 - 70 - 71 - 69 = 284
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_54 (home_team VARCHAR) ### Question ### What was Collingwood's score as the home team? ### Accurate SQL ###
SELECT home_team AS score FROM table_name_54 WHERE home_team = "collingwood"
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_7623 ( "Sign" text, "Element" text, "Qualities" text, "Season: North" text, "Season: South" text ) ### Question ### What is the south season with cold & dry qualities and a cold & wet (winter/water) north season? ### Accurate SQL ###
SELECT "Season: South" FROM table_7623 WHERE "Qualities" = 'cold & dry' AND "Season: North" = 'cold & wet (winter/water)'
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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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 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 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) ) ### Question ### For those employees who did not have any job in the past, give me the trend about commission_pct over hire_date , and I want to display by the x axis from low to high. ### Accurate SQL ###
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_DATE
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 employees ( employee_id number, role_code text, employee_name text, gender_mfu text, date_of_birth time, other_details text ) TABLE: CREATE TABLE roles ( role_code text, role_name text, role_description text ) TABLE: CREATE TABLE ref_document_types ( document_type_code text, document_type_name text, document_type_description text ) TABLE: CREATE TABLE all_documents ( document_id number, date_stored time, document_type_code text, document_name text, document_description text, other_details text ) TABLE: CREATE TABLE ref_locations ( location_code text, location_name text, location_description text ) TABLE: CREATE TABLE documents_to_be_destroyed ( document_id number, destruction_authorised_by_employee_id number, destroyed_by_employee_id number, planned_destruction_date time, actual_destruction_date time, other_details text ) TABLE: CREATE TABLE document_locations ( document_id number, location_code text, date_in_location_from time, date_in_locaton_to time ) TABLE: CREATE TABLE ref_calendar ( calendar_date time, day_number number ) ### Question ### Show the name and description of the role played by the employee named Ebba. ### Accurate SQL ###
SELECT T2.role_name, T2.role_description FROM employees AS T1 JOIN roles AS T2 ON T1.role_code = T2.role_code WHERE T1.employee_name = "Ebba"
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 (date VARCHAR, away_team VARCHAR) ### Question ### When did essendon play away? ### Accurate SQL ###
SELECT date FROM table_name_53 WHERE away_team = "essendon"
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_93 ( away VARCHAR, competition VARCHAR, opponent VARCHAR ) ### Question ### Which Away has a Competition of uefa cup, and an Opponent of anderlecht? ### Accurate SQL ###
SELECT away FROM table_name_93 WHERE competition = "uefa cup" AND opponent = "anderlecht"
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_29885 ( "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 final score of the game where josh powell (13) scored the most points? ### Accurate SQL ###
SELECT "Score" FROM table_29885 WHERE "High points" = 'Josh Powell (13)'
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 club ( club_id number, club_name text, region text, start_year number ) TABLE: CREATE TABLE match_result ( rank number, club_id number, gold number, big_silver number, small_silver number, bronze number, points number ) TABLE: CREATE TABLE player_coach ( player_id number, coach_id number, starting_year number ) TABLE: CREATE TABLE coach ( coach_id number, coach_name text, gender text, club_id number, rank number ) TABLE: CREATE TABLE player ( player_id number, sponsor_name text, player_name text, gender text, residence text, occupation text, votes number, rank text ) ### Question ### Show the names of sponsors of players whose residence is either 'Brandon' or 'Birtle'. ### Accurate SQL ###
SELECT sponsor_name FROM player WHERE residence = "Brandon" OR residence = "Birtle"
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 cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) 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 microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) 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 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 treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) ### Question ### tell me the price of a cpk lab test? ### Accurate SQL ###
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'lab' AND cost.eventid IN (SELECT lab.labid FROM lab WHERE lab.labname = 'cpk')
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_77 (recorded VARCHAR, track VARCHAR, time VARCHAR) ### Question ### What is the recorder has a Track more than 11 with a time 3:06 ### Accurate SQL ###
SELECT recorded FROM table_name_77 WHERE track > 11 AND time = "3:06"
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_18 ( score VARCHAR, home_team VARCHAR, venue VARCHAR ) ### Question ### What was the score at Spartan Stadium when San Jose was the Home team? ### Accurate SQL ###
SELECT score FROM table_name_18 WHERE home_team = "san jose" AND venue = "spartan stadium"
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 appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) TABLE: CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases INTEGER, Drink TEXT ) TABLE: CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) ### Question ### What is the correlation between the average price and the score of wines of each appellation? ### Accurate SQL ###
SELECT AVG(Price), AVG(Score) FROM wine GROUP BY AVG(Price)
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_34715 ( "Year" text, "National Champion" text, "Runner-Up" text, "Location" text, "Host" text ) ### Question ### What was the Runner-up with Ohio as the National Champion in Tucson, AZ? ### Accurate SQL ###
SELECT "Runner-Up" FROM table_34715 WHERE "National Champion" = 'ohio' AND "Location" = 'tucson, az'
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 All_Documents ( Document_ID INTEGER, Date_Stored DATETIME, Document_Type_Code CHAR(15), Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255) ) TABLE: CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), Document_Type_Description VARCHAR(255) ) TABLE: CREATE TABLE Document_Locations ( Document_ID INTEGER, Location_Code CHAR(15), Date_in_Location_From DATETIME, Date_in_Locaton_To DATETIME ) TABLE: CREATE TABLE Employees ( Employee_ID INTEGER, Role_Code CHAR(15), Employee_Name VARCHAR(255), Gender_MFU CHAR(1), Date_of_Birth DATETIME, Other_Details VARCHAR(255) ) TABLE: CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255) ) TABLE: CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Description VARCHAR(255) ) TABLE: CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME, Day_Number INTEGER ) TABLE: CREATE TABLE Roles ( Role_Code CHAR(15), Role_Name VARCHAR(255), Role_Description VARCHAR(255) ) ### Question ### Show me the trend about what are all the calendar dates and day Numbers?, rank in descending by the x-axis please. ### Accurate SQL ###
SELECT Calendar_Date, Day_Number FROM Ref_Calendar ORDER BY Calendar_Date 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_39009 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text ) ### Question ### Name the score for venue of jalan besar, singapore ### Accurate SQL ###
SELECT "Score" FROM table_39009 WHERE "Venue" = 'jalan besar, singapore'
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 requirement ( requirement_id int, requirement varchar, college varchar ) TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) TABLE: CREATE TABLE gsi ( course_offering_id int, student_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 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 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 offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) TABLE: CREATE TABLE area ( course_id int, area 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 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 instructor ( instructor_id int, name varchar, uniqname varchar ) TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year 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 comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) ### Question ### Before taking COMP 433 , which courses do I need ? ### Accurate SQL ###
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT_RECORDalias0.student_id = 1) AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'COMP' AND COURSE_1.number = 433
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_93 ( record VARCHAR, score VARCHAR ) ### Question ### Score of 3 - 2 had what record? ### Accurate SQL ###
SELECT record FROM table_name_93 WHERE score = "3 - 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_54340 ( "Driver" text, "Team" text, "Laps" real, "Time/Retired" text, "Grid" text, "Points" real ) ### Question ### What is the average point count for tristan gommendy? ### Accurate SQL ###
SELECT AVG("Points") FROM table_54340 WHERE "Driver" = 'tristan gommendy'
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_27721131_10 ( high_rebounds VARCHAR, high_points VARCHAR ) ### Question ### Who got high rebounds when Jordan Crawford (27) got high points? ### Accurate SQL ###
SELECT high_rebounds FROM table_27721131_10 WHERE high_points = "Jordan Crawford (27)"
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_21074 ( "Name" text, "Latitude" text, "Longitude" text, "Diameter (km)" text, "Year named" real, "Name origin" text ) ### Question ### At what latitude can the name origin of yuzut-arkh fossae be found? ### Accurate SQL ###
SELECT "Latitude" FROM table_21074 WHERE "Name" = 'Yuzut-Arkh Fossae'
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_86 ( championship VARCHAR, opponent_in_the_final VARCHAR, score_in_the_final VARCHAR ) ### Question ### What Championship has an Opponent in the final of aaron krickstein, and a Score in the final of 7 5, 6 2? ### Accurate SQL ###
SELECT championship FROM table_name_86 WHERE opponent_in_the_final = "aaron krickstein" AND score_in_the_final = "7–5, 6–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_64026 ( "Class to 1928" text, "Class from 1928" text, "Seats" text, "Quantity" real, "Year(s) of Manufacture" text, "Remarks" text ) ### Question ### What is the average quantity for coaches manufactured in 1921/23, and had 40 seats? ### Accurate SQL ###
SELECT AVG("Quantity") FROM table_64026 WHERE "Year(s) of Manufacture" = '1921/23' AND "Seats" = '40'
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_21977704_1 (no VARCHAR, entrant VARCHAR, driver VARCHAR) ### Question ### Name the number for automóvil club argentino for juan manuel fangio ### Accurate SQL ###
SELECT no FROM table_21977704_1 WHERE entrant = "Automóvil Club Argentino" AND driver = "Juan Manuel Fangio"
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_43 ( rider VARCHAR, time VARCHAR, bike VARCHAR, laps VARCHAR ) ### Question ### Who rode a Honda CBR1000rr, had fewer than 22 laps, and a time of +2 laps? ### Accurate SQL ###
SELECT rider FROM table_name_43 WHERE bike = "honda cbr1000rr" AND laps < 22 AND time = "+2 laps"
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 manager ( Manager_ID int, Name text, Country text, Working_year_starts text, Age int, Level int ) TABLE: CREATE TABLE train ( Train_ID int, Train_Num text, Name text, From text, Arrival text, Railway_ID int ) TABLE: CREATE TABLE railway ( Railway_ID int, Railway text, Builder text, Built text, Wheels text, Location text, ObjectNumber text ) TABLE: CREATE TABLE railway_manage ( Railway_ID int, Manager_ID int, From_Year text ) ### Question ### Show the countries that have managers of age above 50 or below 46, and count them by a bar chart, order by the y axis from low to high. ### Accurate SQL ###
SELECT Country, COUNT(Country) FROM manager WHERE Age > 50 OR Age < 46 GROUP BY Country ORDER BY COUNT(Country)
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_39202 ( "Week" text, "Date" text, "Opponent" text, "Result" text, "Record" text ) ### Question ### Name the date with record of 3-1 ### Accurate SQL ###
SELECT "Date" FROM table_39202 WHERE "Record" = '3-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 dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) TABLE: CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int ) TABLE: CREATE TABLE month ( month_number int, month_name text ) TABLE: CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) TABLE: CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) TABLE: CREATE TABLE days ( days_code varchar, day_name varchar ) TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) TABLE: CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int ) TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text ) TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) TABLE: CREATE TABLE code_description ( code varchar, description text ) TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar ) TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar ) TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) ### Question ### what are the early weekday flights from SAN FRANCISCO to PITTSBURGH ### Accurate SQL ###
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days AS DAYS_0, days AS DAYS_1, days AS DAYS_2, days AS DAYS_3, days AS DAYS_4, flight WHERE ((((((DAYS_3.day_name = 'THURSDAY' AND DAYS_4.day_name = 'FRIDAY' AND flight.flight_days = DAYS_3.days_code AND flight.flight_days = DAYS_4.days_code) AND DAYS_2.day_name = 'WEDNESDAY' AND flight.flight_days = DAYS_2.days_code) AND DAYS_1.day_name = 'TUESDAY' AND flight.flight_days = DAYS_1.days_code) AND DAYS_0.day_name = 'MONDAY' AND flight.flight_days = DAYS_0.days_code) AND flight.departure_time < 1000) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
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_42829 ( "Spoofed Title" text, "Actual Title" text, "Writer" text, "Artist" text, "Issue" real, "Date" text ) ### Question ### What is the Date for the actual title archie bunker's place? ### Accurate SQL ###
SELECT "Date" FROM table_42829 WHERE "Actual Title" = 'archie bunker''s place'
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_16951593_1 ( title VARCHAR, production_code VARCHAR ) ### Question ### Namee the title for production code for 4014 ### Accurate SQL ###
SELECT title FROM table_16951593_1 WHERE production_code = "4014"
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_1342256_5 ( first_elected VARCHAR, candidates VARCHAR ) ### Question ### How many candidates were in the election featuring brooks hays (d) unopposed? ### Accurate SQL ###
SELECT COUNT(first_elected) FROM table_1342256_5 WHERE candidates = "Brooks Hays (D) Unopposed"
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 allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime 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 microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime 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 lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) ### Question ### what is the name of the drug prescribed for patient 030-52395 in the same hospital visit after they has been diagnosed with gi obstruction / ileus - gastric obstruction until 6 months ago? ### Accurate SQL ###
SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-52395') AND diagnosis.diagnosisname = 'gi obstruction / ileus - gastric obstruction' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-6 month')) AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-52395') AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-6 month')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid
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 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 gsi ( course_offering_id int, student_id int ) TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) 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 program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) TABLE: CREATE TABLE area ( course_id int, area varchar ) TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location 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 offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) 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 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 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 ### Does Educ Multicult Soc have a class ? ### Accurate SQL ###
SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%Educ Multicult Soc%' OR name LIKE '%Educ Multicult Soc%') AND department = 'EECS'
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 list ( lastname text, firstname text, grade number, classroom number ) TABLE: CREATE TABLE teachers ( lastname text, firstname text, classroom number ) ### Question ### Find all students taught by MARROTTE KIRK. Output first and last names of students. ### Accurate SQL ###
SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "MARROTTE" AND T2.lastname = "KIRK"
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_2 (second VARCHAR, fourth VARCHAR, fifth VARCHAR, sixth VARCHAR) ### Question ### What team placed second during the season where Western Australia placed fifth, South Australia placed sixth, and Tasmania placed fourth? ### Accurate SQL ###
SELECT second FROM table_name_2 WHERE fifth = "western australia" AND sixth = "south australia" AND fourth = "tasmania"
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_71 (report VARCHAR, circuit VARCHAR) ### Question ### Which report includes a Circuit of Tripoli? ### Accurate SQL ###
SELECT report FROM table_name_71 WHERE circuit = "tripoli"
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_30 ( location VARCHAR, competition VARCHAR ) ### Question ### What is the location of the gold medal match? ### Accurate SQL ###
SELECT location FROM table_name_30 WHERE competition = "gold medal match"
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 company ( company_id number, rank number, company text, headquarters text, main_industry text, sales_billion number, profits_billion number, assets_billion number, market_value number ) TABLE: CREATE TABLE station_company ( station_id number, company_id number, rank_of_the_year number ) TABLE: CREATE TABLE gas_station ( station_id number, open_year number, location text, manager_name text, vice_manager_name text, representative_name text ) ### Question ### What are the names and headquarters of all companies ordered by descending market value? ### Accurate SQL ###
SELECT company, headquarters FROM company ORDER BY market_value 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 time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text ) TABLE: CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int ) TABLE: CREATE TABLE days ( days_code varchar, day_name varchar ) TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) TABLE: CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int ) TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) TABLE: CREATE TABLE month ( month_number int, month_name text ) TABLE: CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) TABLE: CREATE TABLE code_description ( code varchar, description text ) TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar ) TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) TABLE: CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar ) TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) ### Question ### i want to fly from PHILADELPHIA to DALLAS with a stop in ATLANTA on a BREAKFAST flight ### Accurate SQL ###
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop, food_service WHERE ((CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'ATLANTA' AND flight_stop.stop_airport = AIRPORT_SERVICE_2.airport_code AND flight.flight_id = flight_stop.flight_id AND food_service.meal_code = flight.meal_code AND food_service.meal_description = 'BREAKFAST') AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
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_3 ( date VARCHAR, visitor VARCHAR ) ### Question ### What is the date of the game with the Rockets as the visitor team? ### Accurate SQL ###
SELECT date FROM table_name_3 WHERE visitor = "rockets"
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_73413 ( "Season no." real, "Series no." real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real, "U.S. Viewers (millions)" text ) ### Question ### which is the maximun serie episode number when the millions of North American spectators is 3.14? ### Accurate SQL ###
SELECT MAX("Series no.") FROM table_73413 WHERE "U.S. Viewers (millions)" = '3.14'
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 region ( Region_id int, Region_code text, Region_name text ) TABLE: CREATE TABLE affected_region ( Region_id int, Storm_ID int, Number_city_affected real ) TABLE: CREATE TABLE storm ( Storm_ID int, Name text, Dates_active text, Max_speed int, Damage_millions_USD real, Number_Deaths int ) ### Question ### For all storms with at least 1 death, show me the dates active and the total number of deaths with a bar chart, and rank by the total number in desc. ### Accurate SQL ###
SELECT Dates_active, Number_Deaths FROM storm WHERE Number_Deaths >= 1 ORDER BY Number_Deaths 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_57434 ( "Tournament" text, "1984" text, "1985" text, "1986" text, "1987" text, "1988" text, "1989" text, "1990" text, "1991" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text ) ### Question ### What is the 1989 result of the tournament in which Katerina Maleeva finished 4r in 1991? ### Accurate SQL ###
SELECT "1989" FROM table_57434 WHERE "1991" = '4r'
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_79 (winning_team VARCHAR, date VARCHAR) ### Question ### What Winning team has 22 July as a Date? ### Accurate SQL ###
SELECT winning_team FROM table_name_79 WHERE date = "22 july"
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_1341865_37 (party VARCHAR, incumbent VARCHAR) ### Question ### To which party does Frank T. Bow belong? ### Accurate SQL ###
SELECT party FROM table_1341865_37 WHERE incumbent = "Frank T. Bow"
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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) 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 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 chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) 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_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) 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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) 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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) 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 cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto 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 ) ### Question ### what is the total number of hours since patient 97395 was admitted to the hospital? ### Accurate SQL ###
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 97395 AND admissions.dischtime 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_name_19 (team VARCHAR, completions VARCHAR) ### Question ### What was the team Vanderberg belonged to when there was 42 completions? ### Accurate SQL ###
SELECT team FROM table_name_19 WHERE completions = "42"
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 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 number of female patients had diagnoses icd9 code 2273? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.icd9_code = "2273"
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_99 (Id VARCHAR) ### Question ### Who came in 3rd at Venue? ### Accurate SQL ###
SELECT 3 AS rd_place FROM table_name_99 WHERE "venue" = "venue"
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_48274 ( "Tournament" text, "1984" text, "1985" text, "1986" text, "1987" text, "1988" text, "1989" text, "1990" text, "1991" text, "1992" text, "1993" text, "1994" text, "1995" text, "1996" text, "Career SR" text ) ### Question ### What is the 1991 when 1990 is ATP Masters Series? ### Accurate SQL ###
SELECT "1991" FROM table_48274 WHERE "1990" = 'atp masters series'
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_120778_2 (jurisdiction VARCHAR, percent_yes VARCHAR) ### Question ### what's the jurisdiction where percent yes is 43.4 ### Accurate SQL ###
SELECT jurisdiction FROM table_120778_2 WHERE percent_yes = "43.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_35997 ( "Code" text, "Vehicle" text, "Year" text, "Displacement" text, "Bore" text, "Stroke" text, "C.R." text, "Max. Power" text ) ### Question ### What displacement has the code yd22ddt? ### Accurate SQL ###
SELECT "Displacement" FROM table_35997 WHERE "Code" = 'yd22ddt'
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_47742 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Attendance" real, "Record" text, "Points" real ) ### Question ### What home is dated march 19? ### Accurate SQL ###
SELECT "Home" FROM table_47742 WHERE "Date" = 'march 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_17822401_1 (callsign VARCHAR, location VARCHAR) ### Question ### What is the callsign for the Cebu station? ### Accurate SQL ###
SELECT callsign FROM table_17822401_1 WHERE location = "Cebu"
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_34 ( position VARCHAR, school_club_team VARCHAR ) ### Question ### What is Position, when School/Club Team is McMaster? ### Accurate SQL ###
SELECT position FROM table_name_34 WHERE school_club_team = "mcmaster"
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 architect ( id text, name text, nationality text, gender text ) TABLE: CREATE TABLE mill ( architect_id int, id int, location text, name text, type text, built_year int, notes text ) TABLE: CREATE TABLE bridge ( architect_id int, id int, name text, location text, length_meters real, length_feet real ) ### Question ### What are the ids and names of the architects who built at least 3 bridges , and I want to show by the total number in asc. ### Accurate SQL ###
SELECT T1.name, T1.id FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id ORDER BY T1.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_train_77 ( "id" int, "gender" string, "pregnancy_or_lactation" bool, "language" string, "hiv_aids" bool, "age" float, "NOUSE" float ) ### Question ### written and oral fluency in english or spanish . ### Accurate SQL ###
SELECT * FROM table_train_77 WHERE language = 'english' OR language = 'spanish'
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_43431 ( "Year" text, "Award" text, "Production" text, "Role" text, "Result" text ) ### Question ### What was the result for the role of Ellie Greenwich in 2005? ### Accurate SQL ###
SELECT "Result" FROM table_43431 WHERE "Role" = 'ellie greenwich' AND "Year" = '2005'
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 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 ) 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 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 medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) 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 ) ### Question ### tell me the name of the drug that patient 022-187132 had been allergic to on this hospital visit? ### Accurate SQL ###
SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-187132' 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 Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) TABLE: CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) ### Question ### Select the name of each manufacturer along with the price of its most expensive product using a bar chart, and list by the Name from high to low. ### Accurate SQL ###
SELECT T2.Name, MAX(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY Name 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_15625 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text ) ### Question ### When was there a score of 7-1? ### Accurate SQL ###
SELECT "Date" FROM table_15625 WHERE "Score" = '7-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 Participates_in ( stuid INTEGER, actid INTEGER ) TABLE: CREATE TABLE Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) TABLE: CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) TABLE: CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ) TABLE: CREATE TABLE Activity ( actid INTEGER, activity_name varchar(25) ) ### Question ### How many faculty members participate in each activity? Return the activity names and the number of faculty members Show bar chart, and display x-axis from high to low order. ### Accurate SQL ###
SELECT activity_name, COUNT(*) FROM Activity AS T1 JOIN Faculty_Participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid ORDER BY activity_name 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 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 ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title 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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ### Question ### how many patients aged below 27 years had the diagnosis long title tietze's disease? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "27" AND diagnoses.long_title = "Tietze's disease"
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 ( program_id int, name varchar, college varchar, introduction 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 area ( course_id int, area varchar ) TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year 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 program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname 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 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 ta ( campus_job_id int, student_id int, location 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 jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id 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 comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) ### Question ### For the courses taught by Prof. Alston , what did I score ? ### Accurate SQL ###
SELECT DISTINCT student_record.grade FROM student_record INNER JOIN offering_instructor ON student_record.offering_id = offering_instructor.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE LOWER(instructor.name) LIKE '%Alston%' AND student_record.student_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_14342210_13 (games_started VARCHAR, player VARCHAR) ### Question ### How many Games Started are there for Hugh White ? ### Accurate SQL ###
SELECT games_started FROM table_14342210_13 WHERE player = "Hugh White"
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid 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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title 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 ) ### Question ### how many patients born before the year 2110 were diagnosed with dehydration? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2110" AND diagnoses.short_title = "Dehydration"
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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) 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 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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto 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 chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE d_icd_procedures ( 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 diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label 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 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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) 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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) ### Question ### calculate the number of times patient 21074 received the vitamin b12 test test until 6 months ago. ### Accurate SQL ###
SELECT COUNT(*) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'vitamin b12') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 21074) AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-6 month')
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_72809 ( "Name" text, "Latitude" text, "Longitude" text, "Diameter (km)" text, "Year named" real, "Name origin" text ) ### Question ### At a latitude of 71.1e, what is the feature's name origin? ### Accurate SQL ###
SELECT "Name origin" FROM table_72809 WHERE "Longitude" = '71.1E'
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_74548 ( "Division" text, "League Apps" real, "League Goals" real, "FA Cup Apps" real, "FA Cup Goals" real, "Total Apps" real, "Total Goals" real ) ### Question ### The total goals have a FA Cup Apps larger than 1, and a Total Apps of 37, and a League Apps smaller than 30?, what is the total number? ### Accurate SQL ###
SELECT COUNT("Total Goals") FROM table_74548 WHERE "FA Cup Apps" > '1' AND "Total Apps" = '37' AND "League Apps" < '30'
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_1133844_4 ( senator VARCHAR, state__linked_to_summaries_below_ VARCHAR ) ### Question ### who won the senate seat in arkansas ### Accurate SQL ###
SELECT senator FROM table_1133844_4 WHERE state__linked_to_summaries_below_ = "Arkansas"
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_71267 ( "Year" real, "Venue" text, "Winner" text, "Country" text, "Score" real ) ### Question ### What was France's highest score when the venue was Bokskogens? ### Accurate SQL ###
SELECT MAX("Score") FROM table_71267 WHERE "Country" = 'france' AND "Venue" = 'bokskogens'
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_71689 ( "Player" text, "Wkts" real, "Runs" real, "Econ" real, "Ovrs" real ) ### Question ### Name the least ovrs for wkts of 0 ### Accurate SQL ###
SELECT MIN("Ovrs") FROM table_71689 WHERE "Wkts" = '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_28424 ( "No." real, "Title" text, "Directed by" text, "Written by" text, "U.S. viewers (million)" text, "Rank (week)" real, "Original air date" text, "Production code" text ) ### Question ### Who wrote the episode with 18.07 million viewers? ### Accurate SQL ###
SELECT "Written by" FROM table_28424 WHERE "U.S. viewers (million)" = '18.07'
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 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 ) 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 ) ### Question ### calculate the number of patients with personal history of urinary (tract) infection who belonged to catholic belief. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.religion = "CATHOLIC" AND diagnoses.long_title = "Personal history, urinary (tract) infection"
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_17 (laps VARCHAR, time VARCHAR, grid VARCHAR, bike VARCHAR) ### Question ### How many laps did the rider with a grid larger than 11, a Honda cbr1000rr bike, and a time of +42.633? ### Accurate SQL ###
SELECT laps FROM table_name_17 WHERE grid > 11 AND bike = "honda cbr1000rr" AND time = "+42.633"
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_25736 ( "Rank" real, "Team" text, "Total Points" real, "2008-09 Points" real, "2007-08 Points" real, "2006-07 Points" real, "2005-06 Points" real ) ### Question ### If the points is 1, what is the total points minimum? ### Accurate SQL ###
SELECT MIN("Total Points") FROM table_25736 WHERE "2005-06 Points" = '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_22334183_3 (date VARCHAR, circuit VARCHAR) ### Question ### When was the circuit Donington Park? ### Accurate SQL ###
SELECT date FROM table_22334183_3 WHERE circuit = "Donington Park"
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_60367 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" real ) ### Question ### What was sweden's score in T9 place? ### Accurate SQL ###
SELECT "Score" FROM table_60367 WHERE "Place" = 't9' AND "Country" = 'sweden'
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_70197 ( "Call sign" text, "Frequency MHz" real, "City of license" text, "ERP W" real, "Class" text, "FCC info" text ) ### Question ### Which class has a city of Richmond, Virginia? ### Accurate SQL ###
SELECT "Class" FROM table_70197 WHERE "City of license" = 'richmond, virginia'
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_51 ( runs VARCHAR, average VARCHAR, innings VARCHAR ) ### Question ### What is the total number of runs when the average was less than 31.25 and there were fewer than 24 innings? ### Accurate SQL ###
SELECT COUNT(runs) FROM table_name_51 WHERE average > 31.25 AND innings < 24
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_45824 ( "Season" real, "Series" text, "Points" text, "Position" text, "Driver" text ) ### Question ### What is Points, when Series is Queensland Formula Ford Championship, and when Position is 1st? ### Accurate SQL ###
SELECT "Points" FROM table_45824 WHERE "Series" = 'queensland formula ford championship' AND "Position" = '1st'
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_56595 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real ) ### Question ### what's the average grid that has a time/retired piston and laps smaller than 15? ### Accurate SQL ###
SELECT AVG("Grid") FROM table_56595 WHERE "Time/Retired" = 'piston' AND "Laps" < '15'
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_63099 ( "Draw" real, "Singer" text, "Song" text, "Points" real, "Place" real ) ### Question ### Which Place is the highest one that has a Draw larger than 1, and 49 Points? ### Accurate SQL ###
SELECT MAX("Place") FROM table_63099 WHERE "Draw" > '1' AND "Points" = '49'
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 cite ( citingpaperid int, citedpaperid int ) TABLE: CREATE TABLE paperfield ( fieldid int, paperid int ) TABLE: CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) TABLE: CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) TABLE: CREATE TABLE writes ( paperid int, authorid int ) TABLE: CREATE TABLE dataset ( datasetid int, datasetname varchar ) TABLE: CREATE TABLE venue ( venueid int, venuename varchar ) TABLE: CREATE TABLE author ( authorid int, authorname varchar ) TABLE: CREATE TABLE paperdataset ( paperid int, datasetid int ) TABLE: CREATE TABLE journal ( journalid int, journalname varchar ) TABLE: CREATE TABLE field ( fieldid int ) TABLE: CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) ### Question ### Who has more papers : Frank Keller or Mirella Lapata ? ### Accurate SQL ###
SELECT DISTINCT author.authorname, COUNT(writes.paperid) FROM author, writes WHERE author.authorname IN ('Frank Keller', 'Mirella Lapata') AND writes.authorid = author.authorid GROUP BY author.authorname ORDER BY COUNT(writes.paperid) 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_1341843_19 ( first_elected VARCHAR, incumbent VARCHAR ) ### Question ### What's the year of the first election of the district whose incumbent is Edwin E. Willis? ### Accurate SQL ###
SELECT first_elected FROM table_1341843_19 WHERE incumbent = "Edwin E. Willis"
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_2385460_1 ( lines VARCHAR, route VARCHAR ) ### Question ### Name the number of lines for porta nolana - ottaviano- sarno ### Accurate SQL ###
SELECT COUNT(lines) FROM table_2385460_1 WHERE route = "Porta Nolana - Ottaviano- Sarno"
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_14966667_19 (hometown VARCHAR, position VARCHAR) ### Question ### how many hometowns use the position of fs? ### Accurate SQL ###
SELECT COUNT(hometown) FROM table_14966667_19 WHERE position = "FS"
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 cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) 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 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_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) 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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) 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 d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title 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 labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) 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 ) 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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) ### Question ### i would like to know the daily maximum amount of .9% normal saline that patient 25493 has received since 38 months ago. ### Accurate SQL ###
SELECT MAX(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25493)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = '.9% normal saline' AND d_items.linksto = 'inputevents_cv') AND DATETIME(inputevents_cv.charttime) >= DATETIME(CURRENT_TIME(), '-38 month') GROUP BY STRFTIME('%y-%m-%d', inputevents_cv.charttime)
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_83 (height VARCHAR, player VARCHAR) ### Question ### What's the heigh of nolan smith? ### Accurate SQL ###
SELECT height FROM table_name_83 WHERE player = "nolan smith"
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_60 ( game VARCHAR, score VARCHAR ) ### Question ### What game was the final score 82-79? ### Accurate SQL ###
SELECT game FROM table_name_60 WHERE score = "82-79"
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 ( constructor VARCHAR, time_retired VARCHAR, grid VARCHAR ) ### Question ### What constructor is grid 1 with a time/retired of engine? ### Accurate SQL ###
SELECT constructor FROM table_name_67 WHERE time_retired = "engine" AND grid = 1