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 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 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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
Count the number of patients less than 47 years who had a urine fluid lab test.
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "47" AND lab.fluid = "Urine"
|
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_81 (venue VARCHAR, date VARCHAR)
### Question ###
What venue was on 27 May 2000?
### Accurate SQL ###
|
SELECT venue FROM table_name_81 WHERE date = "27 may 2000"
|
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_10647639_1 (record VARCHAR, date VARCHAR)
### Question ###
On december 16, 1985, all the records were what?
### Accurate SQL ###
|
SELECT record FROM table_10647639_1 WHERE date = "December 16, 1985"
|
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 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 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 allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime 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 ###
how much different is patient 006-195541's weight last measured on the last hospital visit compared to the value first measured on the last hospital visit?
### Accurate SQL ###
|
SELECT (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-195541' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1) AND NOT patient.admissionweight IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) - (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-195541' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1) AND NOT patient.admissionweight IS NULL ORDER BY patient.unitadmittime 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_73000 ( "Round" real, "Date" text, "Grand Prix" text, "Circuit" text, "Pole Position" text, "Fastest Lap" text, "Race Winner" text )
### Question ###
What grand prixs did Daijiro Hiura win?
### Accurate SQL ###
|
SELECT "Grand Prix" FROM table_73000 WHERE "Race Winner" = 'Daijiro Hiura'
|
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_66 (tournament VARCHAR)
### Question ###
what is 2012 when the tournament is cincinnati masters?
### Accurate SQL ###
|
SELECT 2012 FROM table_name_66 WHERE tournament = "cincinnati masters"
|
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 ###
provide the number of patients whose admission location is emergency room admit?
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT"
|
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 ( departure VARCHAR, station_name VARCHAR )
### Question ###
What is the Departure time at Kanpur Central Station?
### Accurate SQL ###
|
SELECT departure FROM table_name_67 WHERE station_name = "kanpur central"
|
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 ( id VARCHAR, dept_name VARCHAR )
TABLE: CREATE TABLE advisor ( s_id VARCHAR )
### Question ###
What is the id of the instructor who advises of all students from History department?
### Accurate SQL ###
|
SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id = T2.id WHERE T2.dept_name = '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_16441561_5 (position VARCHAR, player VARCHAR)
### Question ###
How many players named Jeff Brown were drafted
### Accurate SQL ###
|
SELECT COUNT(position) FROM table_16441561_5 WHERE player = "Jeff Brown"
|
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 ###
provide the drug route for the drug oxycodone sr (oxycon tin).
### Accurate SQL ###
|
SELECT prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Oxycodone SR (OxyconTIN)"
|
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 person ( name text, age number, city text, gender text, job text )
TABLE: CREATE TABLE personfriend ( name text, friend text, year number )
### Question ###
What are the names of everybody sorted by age in descending order?
### Accurate SQL ###
|
SELECT name FROM person ORDER BY age 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_1099080_1 (partial_thromboplastin_time VARCHAR, condition VARCHAR)
### Question ###
What was the partial thromboplastin time for factor x deficiency as seen in amyloid purpura
### Accurate SQL ###
|
SELECT partial_thromboplastin_time FROM table_1099080_1 WHERE condition = "Factor X deficiency as seen in amyloid purpura"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE 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 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 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 treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
### Question ###
what is the monthly average ldl value for patient 006-133605 since 2105?
### Accurate SQL ###
|
SELECT AVG(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-133605')) AND lab.labname = 'ldl' AND STRFTIME('%y', lab.labresulttime) >= '2105' GROUP BY STRFTIME('%y-%m', lab.labresulttime)
|
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 ( home_team VARCHAR, away_team VARCHAR )
### Question ###
What is the home team score when the away team was fitzroy?
### Accurate SQL ###
|
SELECT home_team AS score FROM table_name_93 WHERE away_team = "fitzroy"
|
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_4 ( team_2 VARCHAR, team_1 VARCHAR )
### Question ###
What is the name of Team 2 with a Team 1 of Al Qadsia?
### Accurate SQL ###
|
SELECT team_2 FROM table_name_4 WHERE team_1 = "al qadsia"
|
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 Orders ( order_id INTEGER, customer_id INTEGER, date_order_placed DATETIME, order_details VARCHAR(255) )
TABLE: CREATE TABLE Customers ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50) )
TABLE: CREATE TABLE Invoice_Line_Items ( order_item_id INTEGER, invoice_number INTEGER, product_id INTEGER, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19,4), derived_product_cost DECIMAL(19,4), derived_vat_payable DECIMAL(19,4), derived_total_cost DECIMAL(19,4) )
TABLE: CREATE TABLE Products ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15), unit_price DECIMAL(19,4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20) )
TABLE: CREATE TABLE Order_Items ( order_item_id INTEGER, order_id INTEGER, product_id INTEGER, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255) )
TABLE: CREATE TABLE Accounts ( account_id INTEGER, customer_id INTEGER, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255) )
TABLE: CREATE TABLE Financial_Transactions ( transaction_id INTEGER, account_id INTEGER, invoice_number INTEGER, transaction_type VARCHAR(15), transaction_date DATETIME, transaction_amount DECIMAL(19,4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255) )
TABLE: CREATE TABLE Product_Categories ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19,4) )
TABLE: CREATE TABLE Invoices ( invoice_number INTEGER, order_id INTEGER, invoice_date DATETIME )
### Question ###
A scatter chart about how many accounts does each customer have? List the number and customer id.
### Accurate SQL ###
|
SELECT COUNT(*), customer_id FROM Accounts GROUP BY customer_id
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_38 (state VARCHAR, major_series VARCHAR, city VARCHAR)
### Question ###
What is the State with the trans-am Major Series in Grand Rapids?
### Accurate SQL ###
|
SELECT state FROM table_name_38 WHERE major_series = "trans-am" AND city = "grand rapids"
|
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_73 (shot_volume__cm_3__ INTEGER, shot_diameter__cm_ INTEGER)
### Question ###
what is the average shot volume (cm 3) when the shot diameter (cm) is less than 6.04?
### Accurate SQL ###
|
SELECT AVG(shot_volume__cm_3__) FROM table_name_73 WHERE shot_diameter__cm_ < 6.04
|
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 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_labitems ( row_id number, itemid number, label 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 d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title 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 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 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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time )
TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number )
TABLE: CREATE TABLE 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_items ( row_id number, itemid number, label text, linksto text )
TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
### Question ###
what was the daily maximum intake of sterile water that patient 8562 had received in the last month?
### 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 = 8562)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sterile water' AND d_items.linksto = 'inputevents_cv') AND DATETIME(inputevents_cv.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 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 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 )
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 )
### Question ###
count the number of patients whose procedure long title is (aorto)coronary bypass of two coronary arteries and lab test fluid is urine?
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "(Aorto)coronary bypass of two coronary arteries" AND lab.fluid = "Urine"
|
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 Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number )
TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text )
TABLE: CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other )
TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE PostTags ( PostId number, TagId number )
TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE VoteTypes ( Id number, Name text )
TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number )
TABLE: CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number )
TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time )
TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number )
TABLE: CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number )
### Question ###
Locations of users asked about MongoDB.
### Accurate SQL ###
|
SELECT Users.Location, COUNT(1) FROM Posts INNER JOIN Users ON Posts.OwnerUserId = Users.Id WHERE Posts.Tags LIKE '%docker%' AND NOT Users.Location IS NULL AND RTRIM(Users.Location) > '' GROUP BY Users.Location ORDER BY 2 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_77223 ( "Date" text, "Home team" text, "Score" text, "Away team" text, "Venue" text, "Crowd" real, "Box Score" text, "Report" text )
### Question ###
What was the average crowd size for the game when the Gold Coast Blaze was the home team?
### Accurate SQL ###
|
SELECT AVG("Crowd") FROM table_77223 WHERE "Home team" = 'gold coast blaze'
|
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_75965 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
### Question ###
What is the name of Team 2 with a 2nd leg of 4-6?
### Accurate SQL ###
|
SELECT "Team 2" FROM table_75965 WHERE "2nd leg" = '4-6'
|
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_2233 ( "Pos" text, "No" text, "Driver" text, "Constructor" text, "Part 1" text, "Part 2" text, "Part 3" text, "Grid" text )
### Question ###
Who was the driver when the time in part 3 was 1:31.386?
### Accurate SQL ###
|
SELECT "Driver" FROM table_2233 WHERE "Part 1" = '1:31.386'
|
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_27705 ( "Date of Issue" text, "Theme" text, "Denomination" text, "Design" text, "Illustration" text, "Quantity" text, "Printing Process" text, "Paper Type" text, "First Day Cover Cancellation" text )
### Question ###
How many times is the theme roadside attractions: wawa goose?
### Accurate SQL ###
|
SELECT COUNT("Quantity") FROM table_27705 WHERE "Theme" = 'Roadside Attractions: Wawa Goose'
|
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_20206 ( "Ecosystem" text, "Date of issue" text, "Place of issue" text, "No. stamps in sheet" real, "Face Value" text, "Printer" text )
### Question ###
Who was the printer of Estes Park, Colorado?
### Accurate SQL ###
|
SELECT "Printer" FROM table_20206 WHERE "Place of issue" = 'Estes Park, Colorado'
|
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_8 ( ties VARCHAR, division VARCHAR )
### Question ###
What are the ties for division of bafl division two south?
### Accurate SQL ###
|
SELECT ties FROM table_name_8 WHERE division = "bafl division two south"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_2886617_6 ( nationality VARCHAR, player VARCHAR )
### Question ###
What nationality was peter slamiar?
### Accurate SQL ###
|
SELECT nationality FROM table_2886617_6 WHERE player = "Peter Slamiar"
|
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_2282444_1 (h_ci__ka_m_ VARCHAR, t_c__°c_ VARCHAR)
### Question ###
When 720 is the t c (°c) what is the h ci (ka/m)?
### Accurate SQL ###
|
SELECT h_ci__ka_m_ FROM table_2282444_1 WHERE t_c__°c_ = "720"
|
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_5 ( chassis VARCHAR, entrant VARCHAR )
### Question ###
What chassis had an entrant of G.A. Vandervell?
### Accurate SQL ###
|
SELECT chassis FROM table_name_5 WHERE entrant = "g.a. vandervell"
|
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_2933 ( "Player" text, "Position" text, "NASL years" text, "NASL club(s)" text, "Accolades (Pre-NASL)" text )
### Question ###
What years did Bobby Moore play?
### Accurate SQL ###
|
SELECT "NASL years" FROM table_2933 WHERE "Player" = 'Bobby Moore'
|
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_11317 ( "Missile" text, "Project" text, "Type" text, "Warhead" text, "Payload (kg)" text, "Range (km)" text, "Dimension (m)" text, "Fuel/Stages" text, "Weight (kg)" text, "In service" text )
### Question ###
Name the typ for project of igmdp and weight of 16,000
### Accurate SQL ###
|
SELECT "Type" FROM table_11317 WHERE "Project" = 'igmdp' AND "Weight (kg)" = '16,000'
|
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_40 ( gdp_per_capita__us$_ VARCHAR, gdp__billion_us$_ VARCHAR )
### Question ###
What is the per-capita GDP of the country with an overall GDP of 80.955?
### Accurate SQL ###
|
SELECT gdp_per_capita__us$_ FROM table_name_40 WHERE gdp__billion_us$_ = "80.955"
|
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_54955 ( "Rank" real, "Player" text, "Country" text, "Earnings( $ )" real, "Wins" real )
### Question ###
Which player has the lowest earnings and has at least 4 wins and is ranked higher than 4?
### Accurate SQL ###
|
SELECT MIN("Earnings( $ )") FROM table_54955 WHERE "Wins" = '4' AND "Rank" > '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_58598 ( "Mid Gippsland FL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
### Question ###
What's the lowest number of draws when the wins are less than 15, and against is 1228?
### Accurate SQL ###
|
SELECT MIN("Draws") FROM table_58598 WHERE "Wins" < '15' AND "Against" = '1228'
|
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_1099080_1 (bleeding_time VARCHAR, condition VARCHAR)
### Question ###
What was the bleeding time for factor xii deficiency
### Accurate SQL ###
|
SELECT bleeding_time FROM table_1099080_1 WHERE condition = "Factor XII deficiency"
|
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_39 (score VARCHAR, date VARCHAR)
### Question ###
What was the score on April 8?
### Accurate SQL ###
|
SELECT score FROM table_name_39 WHERE date = "april 8"
|
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_26 (year__ceremony_ VARCHAR, category VARCHAR, actor_actress VARCHAR)
### Question ###
What is the year when sigourney weaver was nominated for best actress?
### Accurate SQL ###
|
SELECT year__ceremony_ FROM table_name_26 WHERE category = "best actress" AND actor_actress = "sigourney weaver"
|
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_97 (callsign VARCHAR, brand VARCHAR, webcast VARCHAR, frequency VARCHAR)
### Question ###
Which Callsign includes a frequency under 1210, Newsradio 740 KTRH, and webcasts with listen live?
### Accurate SQL ###
|
SELECT callsign FROM table_name_97 WHERE webcast = "listen live" AND frequency < 1210 AND brand = "newsradio 740 ktrh"
|
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_78378 ( "Season" text, "1st Division" text, "Relegated" text, "2nd Division" text, "Promoted" text )
### Question ###
What was relegated in the 2006 season?
### Accurate SQL ###
|
SELECT "Relegated" FROM table_78378 WHERE "Season" = '2006'
|
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_26673 ( "Institution" text, "Nickname" text, "Location" text, "Founded" real, "Type" text, "Enrollment" real, "Joined" real, "Left" real )
### Question ###
What university team is referred to as the tigers?
### Accurate SQL ###
|
SELECT "Institution" FROM table_26673 WHERE "Nickname" = 'Tigers'
|
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_16699 ( "Year" real, "Winners" text, "Grand Finalist" text, "Scores" text, "Venue" text, "Crowd" real, "Margin" real, "Season Result" text )
### Question ###
who is the season result where margin is 51
### Accurate SQL ###
|
SELECT "Season Result" FROM table_16699 WHERE "Margin" = '51'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_29 (year VARCHAR)
### Question ###
What was the 2nd leg for 2004?
### Accurate SQL ###
|
SELECT 2 AS nd_leg FROM table_name_29 WHERE year = 2004
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_26808178_1 (us_viewers__millions_ VARCHAR, series__number VARCHAR)
### Question ###
How many million viewers watched episode 3 in the series?
### Accurate SQL ###
|
SELECT us_viewers__millions_ FROM table_26808178_1 WHERE series__number = 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 university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text )
TABLE: CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text )
### Question ###
Draw a bar chart about the distribution of All_Home and the sum of Team_ID , and group by attribute All_Home, list by the y-axis in ascending.
### Accurate SQL ###
|
SELECT All_Home, SUM(Team_ID) FROM basketball_match GROUP BY All_Home ORDER BY SUM(Team_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_49871 ( "Series Sorted" text, "Title" text, "Author" text, "Featuring" text, "Released" text )
### Question ###
who is featuring when the title is energy of the daleks?
### Accurate SQL ###
|
SELECT "Featuring" FROM table_49871 WHERE "Title" = 'energy of the daleks'
|
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_30537 ( "Season" text, "Sport" text, "Tournament Structure" text, "# of Divisions" real, "1st Tournament" real, "2011-2012 State Tournament Location" text )
### Question ###
How many first tournaments were winter sports with exactly 1 division?
### Accurate SQL ###
|
SELECT COUNT("1st Tournament") FROM table_30537 WHERE "Season" = 'Winter' AND "# of Divisions" = '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 party ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptroller text, Attorney_General text, US_Senate text )
TABLE: CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, First_Elected real, Committee text )
TABLE: CREATE TABLE county ( County_Id int, County_name text, Population real, Zip_code text )
### Question ###
For each party, use a bar chart to show the number of its delegates, and could you rank in descending by the Y-axis please?
### Accurate SQL ###
|
SELECT T2.Party, COUNT(T2.Party) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T2.Party ORDER BY COUNT(T2.Party) 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_66615 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
### Question ###
What is the total when the Yugoslavia number of silver won is more than 1?
### Accurate SQL ###
|
SELECT MAX("Total") FROM table_66615 WHERE "Silver" > '1' AND "Nation" = 'yugoslavia'
|
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 ( recipient VARCHAR, award VARCHAR, result VARCHAR )
### Question ###
Who won the 2010 Kids' Choice Awards?
### Accurate SQL ###
|
SELECT recipient FROM table_name_30 WHERE award = "2010 kids' choice awards" AND result = "won"
|
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
### Question ###
what is the number of patients under 45 years of age who had closure of skin and subcutaneous tissue of other sites?
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "45" AND procedures.long_title = "Closure of skin and subcutaneous tissue of other sites"
|
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_65602 ( "Player" text, "Test debut" text, "Year" real, "Cross-code debut" text, "Date" text, "Position" text )
### Question ###
What date has a Position of back, later than 1964, and a Test debut of 1st rl test v new zealand?
### Accurate SQL ###
|
SELECT "Date" FROM table_65602 WHERE "Position" = 'back' AND "Year" > '1964' AND "Test debut" = '1st rl test v new zealand'
|
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_22871239_5 ( score VARCHAR, team VARCHAR )
### Question ###
What was the score when the team was @ New Jersey?
### Accurate SQL ###
|
SELECT score FROM table_22871239_5 WHERE team = "@ New Jersey"
|
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_1218784_1 (goals VARCHAR, season VARCHAR)
### Question ###
How many goals were scored in the 2005-06 season?
### Accurate SQL ###
|
SELECT goals FROM table_1218784_1 WHERE season = "2005-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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
### Question ###
give me the number of patients whose diagnoses short title is encephalopathy nos and lab test abnormal status is abnormal?
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Encephalopathy NOS" AND lab.flag = "abnormal"
|
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_61108 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" text, "Finish" text )
### Question ###
Which Country has a Total smaller than 284?
### Accurate SQL ###
|
SELECT "Country" FROM table_61108 WHERE "Total" < '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_22011138_7 ( total_pts INTEGER, avg VARCHAR )
### Question ###
If the average is 1.2803, what is the total points maximum?
### Accurate SQL ###
|
SELECT MAX(total_pts) FROM table_22011138_7 WHERE avg = "1.2803"
|
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_23 (year INTEGER, moves VARCHAR)
### Question ###
What year had 32 moves?
### Accurate SQL ###
|
SELECT SUM(year) FROM table_name_23 WHERE moves = 32
|
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_38 ( l2_cache VARCHAR, release_price___usd__ VARCHAR )
### Question ###
What was the L2 Cache for the processor with a release price of $496?
### Accurate SQL ###
|
SELECT l2_cache FROM table_name_38 WHERE release_price___usd__ = "$496"
|
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_96 (athlete VARCHAR, place VARCHAR)
### Question ###
What athlete has a Grenoble place?
### Accurate SQL ###
|
SELECT athlete FROM table_name_96 WHERE place = "grenoble"
|
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_15830 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-25" real, "Events" real, "Cuts made" real )
### Question ###
what is the lowest top-25 when the events is less than 17 and top-5 is more than 0?
### Accurate SQL ###
|
SELECT MIN("Top-25") FROM table_15830 WHERE "Events" < '17' AND "Top-5" > '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_name_23 (score VARCHAR, home VARCHAR, visitor VARCHAR)
### Question ###
What was the score of the game that Washington played at home against Florida?
### Accurate SQL ###
|
SELECT score FROM table_name_23 WHERE home = "washington" AND visitor = "florida"
|
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_21 ( total INTEGER, nation VARCHAR, silver VARCHAR )
### Question ###
What's the total of Sweden (SWE) having less than 1 silver?
### Accurate SQL ###
|
SELECT MIN(total) FROM table_name_21 WHERE nation = "sweden (swe)" AND silver < 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_87 ( event VARCHAR, year VARCHAR, position VARCHAR )
### Question ###
Which event in 2007 had a position of 5th?
### Accurate SQL ###
|
SELECT event FROM table_name_87 WHERE year = 2007 AND position = "5th"
|
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 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 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 ###
how many patients are diagnosed with glucocorticoid deficiency and underwent lab test under the category hematology?
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Glucocorticoid deficient" AND lab."CATEGORY" = "Hematology"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_5494 ( "Date" text, "Tournament" text, "Winning score" text, "To par" text, "Margin of victory" text )
### Question ###
Which Winning score has a Tournament of walt disney world/oldsmobile classic?
### Accurate SQL ###
|
SELECT "Winning score" FROM table_5494 WHERE "Tournament" = 'walt disney world/oldsmobile classic'
|
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_29 (rank VARCHAR, length___m__ VARCHAR)
### Question ###
What is the rank of the arch with a length in meters of 75/55?
### Accurate SQL ###
|
SELECT rank FROM table_name_29 WHERE length___m__ = "75/55"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_26202847_6 (championship VARCHAR, score_in_the_final VARCHAR)
### Question ###
Where is the championship where 6–1, 3–6, 3–6 is the score in the final?
### Accurate SQL ###
|
SELECT championship FROM table_26202847_6 WHERE score_in_the_final = "6–1, 3–6, 3–6"
|
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 Timed_Locations_of_Things ( thing_id INTEGER, Date_and_Time DATETIME, Location_Code CHAR(15) )
TABLE: CREATE TABLE Organizations ( organization_id INTEGER, parent_organization_id INTEGER, organization_details VARCHAR(255) )
TABLE: CREATE TABLE Services ( service_id INTEGER, organization_id INTEGER, service_type_code CHAR(15), service_details VARCHAR(255) )
TABLE: CREATE TABLE Residents ( resident_id INTEGER, property_id INTEGER, date_moved_in DATETIME, date_moved_out DATETIME, other_details VARCHAR(255) )
TABLE: CREATE TABLE Things ( thing_id INTEGER, organization_id INTEGER, Type_of_Thing_Code CHAR(15), service_type_code CHAR(10), service_details VARCHAR(255) )
TABLE: CREATE TABLE Customer_Event_Notes ( Customer_Event_Note_ID INTEGER, Customer_Event_ID INTEGER, service_type_code CHAR(15), resident_id INTEGER, property_id INTEGER, date_moved_in DATETIME )
TABLE: CREATE TABLE Properties ( property_id INTEGER, property_type_code CHAR(15), property_address VARCHAR(255), other_details VARCHAR(255) )
TABLE: CREATE TABLE Customer_Events ( Customer_Event_ID INTEGER, customer_id INTEGER, date_moved_in DATETIME, property_id INTEGER, resident_id INTEGER, thing_id INTEGER )
TABLE: CREATE TABLE Customers ( customer_id INTEGER, customer_details VARCHAR(255) )
TABLE: CREATE TABLE Residents_Services ( resident_id INTEGER, service_id INTEGER, date_moved_in DATETIME, property_id INTEGER, date_requested DATETIME, date_provided DATETIME, other_details VARCHAR(255) )
TABLE: CREATE TABLE Timed_Status_of_Things ( thing_id INTEGER, Date_and_Date DATETIME, Status_of_Thing_Code CHAR(15) )
### Question ###
Give me a stacked bar chart to show how many things in different types of each thing, and the details of the organization that owns it, I want to show in descending by the Y-axis please.
### Accurate SQL ###
|
SELECT organization_details, COUNT(organization_details) FROM Things AS T1 JOIN Organizations AS T2 ON T1.organization_id = T2.organization_id GROUP BY Type_of_Thing_Code, organization_details ORDER BY COUNT(organization_details) 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_2668 ( "Event" text, "Season" text, "Compulsory Dance (CD)" text, "Original Dance (OD)" text, "Free Dance (FD)" text, "Combined Total Score" text )
### Question ###
What was the free dance score in the event where compulsory dance score was 15.99?
### Accurate SQL ###
|
SELECT "Free Dance (FD)" FROM table_2668 WHERE "Compulsory Dance (CD)" = '15.99'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE 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 microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
### Question ###
what is the drug that has been prescribed patient 002-76990 for two or more times since 37 months ago?
### Accurate SQL ###
|
SELECT t1.drugname FROM (SELECT medication.drugname, COUNT(medication.drugstarttime) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-76990')) AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-37 month') GROUP BY medication.drugname) AS t1 WHERE t1.c1 >= 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_name_60 (attendance VARCHAR, week VARCHAR)
### Question ###
How many people attended the game in week 13?
### Accurate SQL ###
|
SELECT attendance FROM table_name_60 WHERE week = 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 table_name_70 ( score VARCHAR, surface VARCHAR, rank VARCHAR )
### Question ###
What was the score of the match played on hard with a person ranked 10?
### Accurate SQL ###
|
SELECT score FROM table_name_70 WHERE surface = "hard" AND rank = 10
|
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 fielding_postseason ( player_id TEXT, year INTEGER, team_id TEXT, league_id TEXT, round TEXT, pos TEXT, g INTEGER, gs NUMERIC, inn_outs NUMERIC, po INTEGER, a INTEGER, e INTEGER, dp INTEGER, tp INTEGER, pb NUMERIC, sb NUMERIC, cs NUMERIC )
TABLE: CREATE TABLE player ( player_id TEXT, birth_year NUMERIC, birth_month NUMERIC, birth_day NUMERIC, birth_country TEXT, birth_state TEXT, birth_city TEXT, death_year NUMERIC, death_month NUMERIC, death_day NUMERIC, death_country TEXT, death_state TEXT, death_city TEXT, name_first TEXT, name_last TEXT, name_given TEXT, weight NUMERIC, height NUMERIC, bats TEXT, throws TEXT, debut TEXT, final_game TEXT, retro_id TEXT, bbref_id TEXT )
TABLE: CREATE TABLE batting_postseason ( year INTEGER, round TEXT, player_id TEXT, team_id TEXT, league_id TEXT, g INTEGER, ab INTEGER, r INTEGER, h INTEGER, double INTEGER, triple INTEGER, hr INTEGER, rbi INTEGER, sb INTEGER, cs NUMERIC, bb INTEGER, so INTEGER, ibb NUMERIC, hbp NUMERIC, sh NUMERIC, sf NUMERIC, g_idp NUMERIC )
TABLE: CREATE TABLE team_franchise ( franchise_id TEXT, franchise_name TEXT, active TEXT, na_assoc TEXT )
TABLE: CREATE TABLE fielding_outfield ( player_id TEXT, year INTEGER, stint INTEGER, glf NUMERIC, gcf NUMERIC, grf NUMERIC )
TABLE: CREATE TABLE hall_of_fame ( player_id TEXT, yearid INTEGER, votedby TEXT, ballots NUMERIC, needed NUMERIC, votes NUMERIC, inducted TEXT, category TEXT, needed_note TEXT )
TABLE: CREATE TABLE salary ( year INTEGER, team_id TEXT, league_id TEXT, player_id TEXT, salary INTEGER )
TABLE: CREATE TABLE manager ( player_id TEXT, year INTEGER, team_id TEXT, league_id TEXT, inseason INTEGER, g INTEGER, w INTEGER, l INTEGER, rank NUMERIC, plyr_mgr TEXT )
TABLE: CREATE TABLE park ( park_id TEXT, park_name TEXT, park_alias TEXT, city TEXT, state TEXT, country TEXT )
TABLE: CREATE TABLE player_college ( player_id TEXT, college_id TEXT, year INTEGER )
TABLE: CREATE TABLE postseason ( year INTEGER, round TEXT, team_id_winner TEXT, league_id_winner TEXT, team_id_loser TEXT, league_id_loser TEXT, wins INTEGER, losses INTEGER, ties INTEGER )
TABLE: CREATE TABLE team_half ( year INTEGER, league_id TEXT, team_id TEXT, half INTEGER, div_id TEXT, div_win TEXT, rank INTEGER, g INTEGER, w INTEGER, l INTEGER )
TABLE: CREATE TABLE fielding ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, pos TEXT, g INTEGER, gs NUMERIC, inn_outs NUMERIC, po NUMERIC, a NUMERIC, e NUMERIC, dp NUMERIC, pb NUMERIC, wp NUMERIC, sb NUMERIC, cs NUMERIC, zr NUMERIC )
TABLE: CREATE TABLE player_award_vote ( award_id TEXT, year INTEGER, league_id TEXT, player_id TEXT, points_won NUMERIC, points_max INTEGER, votes_first NUMERIC )
TABLE: CREATE TABLE player_award ( player_id TEXT, award_id TEXT, year INTEGER, league_id TEXT, tie TEXT, notes TEXT )
TABLE: CREATE TABLE manager_award ( player_id TEXT, award_id TEXT, year INTEGER, league_id TEXT, tie TEXT, notes NUMERIC )
TABLE: CREATE TABLE college ( college_id TEXT, name_full TEXT, city TEXT, state TEXT, country TEXT )
TABLE: CREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, ab NUMERIC, r NUMERIC, h NUMERIC, double NUMERIC, triple NUMERIC, hr NUMERIC, rbi NUMERIC, sb NUMERIC, cs NUMERIC, bb NUMERIC, so NUMERIC, ibb NUMERIC, hbp NUMERIC, sh NUMERIC, sf NUMERIC, g_idp NUMERIC )
TABLE: CREATE TABLE pitching_postseason ( player_id TEXT, year INTEGER, round TEXT, team_id TEXT, league_id TEXT, w INTEGER, l INTEGER, g INTEGER, gs INTEGER, cg INTEGER, sho INTEGER, sv INTEGER, ipouts INTEGER, h INTEGER, er INTEGER, hr INTEGER, bb INTEGER, so INTEGER, baopp TEXT, era NUMERIC, ibb NUMERIC, wp NUMERIC, hbp NUMERIC, bk NUMERIC, bfp NUMERIC, gf INTEGER, r INTEGER, sh NUMERIC, sf NUMERIC, g_idp NUMERIC )
TABLE: CREATE TABLE appearances ( year INTEGER, team_id TEXT, league_id TEXT, player_id TEXT, g_all NUMERIC, gs NUMERIC, g_batting INTEGER, g_defense NUMERIC, g_p INTEGER, g_c INTEGER, g_1b INTEGER, g_2b INTEGER, g_3b INTEGER, g_ss INTEGER, g_lf INTEGER, g_cf INTEGER, g_rf INTEGER, g_of INTEGER, g_dh NUMERIC, g_ph NUMERIC, g_pr NUMERIC )
TABLE: CREATE TABLE manager_half ( player_id TEXT, year INTEGER, team_id TEXT, league_id TEXT, inseason INTEGER, half INTEGER, g INTEGER, w INTEGER, l INTEGER, rank INTEGER )
TABLE: CREATE TABLE pitching ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, w INTEGER, l INTEGER, g INTEGER, gs INTEGER, cg INTEGER, sho INTEGER, sv INTEGER, ipouts NUMERIC, h INTEGER, er INTEGER, hr INTEGER, bb INTEGER, so INTEGER, baopp NUMERIC, era NUMERIC, ibb NUMERIC, wp NUMERIC, hbp NUMERIC, bk INTEGER, bfp NUMERIC, gf NUMERIC, r INTEGER, sh NUMERIC, sf NUMERIC, g_idp NUMERIC )
TABLE: CREATE TABLE team ( year INTEGER, league_id TEXT, team_id TEXT, franchise_id TEXT, div_id TEXT, rank INTEGER, g INTEGER, ghome NUMERIC, w INTEGER, l INTEGER, div_win TEXT, wc_win TEXT, lg_win TEXT, ws_win TEXT, r INTEGER, ab INTEGER, h INTEGER, double INTEGER, triple INTEGER, hr INTEGER, bb INTEGER, so NUMERIC, sb NUMERIC, cs NUMERIC, hbp NUMERIC, sf NUMERIC, ra INTEGER, er INTEGER, era NUMERIC, cg INTEGER, sho INTEGER, sv INTEGER, ipouts INTEGER, ha INTEGER, hra INTEGER, bba INTEGER, soa INTEGER, e INTEGER, dp NUMERIC, fp NUMERIC, name TEXT, park TEXT, attendance NUMERIC, bpf INTEGER, ppf INTEGER, team_id_br TEXT, team_id_lahman45 TEXT, team_id_retro TEXT )
TABLE: CREATE TABLE home_game ( year INTEGER, league_id TEXT, team_id TEXT, park_id TEXT, span_first TEXT, span_last TEXT, games INTEGER, openings INTEGER, attendance INTEGER )
TABLE: CREATE TABLE manager_award_vote ( award_id TEXT, year INTEGER, league_id TEXT, player_id TEXT, points_won INTEGER, points_max INTEGER, votes_first INTEGER )
TABLE: CREATE TABLE all_star ( player_id TEXT, year INTEGER, game_num INTEGER, game_id TEXT, team_id TEXT, league_id TEXT, gp NUMERIC, starting_pos NUMERIC )
### Question ###
I want to see trend of the number of yearid by yearid
### Accurate SQL ###
|
SELECT yearid, COUNT(yearid) FROM hall_of_fame
|
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_68305 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Round" real, "Time" text, "Location" text )
### Question ###
What's the method for a record of 4-2 and round smaller than 3?
### Accurate SQL ###
|
SELECT "Method" FROM table_68305 WHERE "Round" < '3' AND "Record" = '4-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_8621 ( "Round" real, "Pick" real, "Overall" real, "Name" text, "Position" text, "College" text )
### Question ###
What is the highest round that has an overall of 143 and a pick greater than 6?
### Accurate SQL ###
|
SELECT MAX("Round") FROM table_8621 WHERE "Overall" = '143' AND "Pick" > '6'
|
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 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 microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime 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 )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
### Question ###
what is the drug they has prescribed to patient 005-4471 two or more times?
### Accurate SQL ###
|
SELECT t1.drugname FROM (SELECT medication.drugname, COUNT(medication.drugstarttime) AS c1 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-4471')) GROUP BY medication.drugname) AS t1 WHERE t1.c1 >= 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_25042332_22 (region VARCHAR, primary__6_13_years_ VARCHAR)
### Question ###
In what region is the enrollment ratio in primary 94.40?
### Accurate SQL ###
|
SELECT region FROM table_25042332_22 WHERE primary__6_13_years_ = "94.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_name_28 ( nationality VARCHAR, player VARCHAR )
### Question ###
What was the nationality of the player Pat Garrity?
### Accurate SQL ###
|
SELECT nationality FROM table_name_28 WHERE player = "pat garrity"
|
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_1289762_1 (against___percentage_ VARCHAR, constituency VARCHAR)
### Question ###
What is the against percentage in the Vest-Agder constituency?
### Accurate SQL ###
|
SELECT against___percentage_ FROM table_1289762_1 WHERE constituency = "Vest-Agder"
|
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_8546 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text )
### Question ###
Which Points for has a Losing bonus of 2, and a Club of bridgend sports rfc?
### Accurate SQL ###
|
SELECT "Points for" FROM table_8546 WHERE "Losing bonus" = '2' AND "Club" = 'bridgend sports rfc'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text )
TABLE: CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text )
### Question ###
Visualize the relationship between Team_ID and ACC_Percent , and group by attribute Team_Name.
### Accurate SQL ###
|
SELECT Team_ID, ACC_Percent FROM basketball_match GROUP BY Team_Name
|
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_22542 ( "Rank" text, "Country" text, "Jerseys" real, "Vuelta Wins" real, "Points" real, "KoM" real, "Combo" real, "Most recent cyclist" text, "Most recent date" text, "Different holders" real )
### Question ###
When 3 is the rank what is the highest combo?
### Accurate SQL ###
|
SELECT MAX("Combo") FROM table_22542 WHERE "Rank" = '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_58 ( finish VARCHAR, year_s__won VARCHAR )
### Question ###
What is Finish, when Year(s) Won is '1962 , 1967'?
### Accurate SQL ###
|
SELECT finish FROM table_name_58 WHERE year_s__won = "1962 , 1967"
|
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_23799417_1 ( production_code VARCHAR, directed_by VARCHAR )
### Question ###
What is the production code directed by Matt Shakman?
### Accurate SQL ###
|
SELECT production_code FROM table_23799417_1 WHERE directed_by = "Matt Shakman"
|
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_74484 ( "Date" text, "Track" text, "Event Name" text, "Pole Winner" text, "Race Winner" text )
### Question ###
Tell me the pole winner of may 12
### Accurate SQL ###
|
SELECT "Pole Winner" FROM table_74484 WHERE "Date" = 'may 12'
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number )
TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text )
TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text )
TABLE: CREATE TABLE 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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name 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 patients ( row_id number, subject_id number, gender text, dob time, dod 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 d_items ( row_id number, itemid number, label text, linksto text )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost 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 )
### Question ###
what are patient 13703's arterial bp [diastolic] differences second measured on the first intensive care unit visit compared to the value first measured on the first intensive care unit visit?
### Accurate SQL ###
|
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13703) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [diastolic]' AND d_items.linksto = 'chartevents') ORDER BY chartevents.charttime LIMIT 1 OFFSET 1) - (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13703) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [diastolic]' AND d_items.linksto = 'chartevents') ORDER BY chartevents.charttime 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_24875 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text )
### Question ###
how many episodes has been directed by Mark K. Samuels ?
### Accurate SQL ###
|
SELECT COUNT("No. in series") FROM table_24875 WHERE "Directed by" = 'Mark K. Samuels'
|
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_1389609_3 (total_population INTEGER, region VARCHAR)
### Question ###
What is the entire inhabitants in Southeast Asia?
### Accurate SQL ###
|
SELECT MIN(total_population) FROM table_1389609_3 WHERE region = "Southeast Asia"
|
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_1341472_15 ( party VARCHAR, candidates VARCHAR )
### Question ###
what's the party with candidates jerry weller (r) 51.77% clem balanoff (d) 48.23%
### Accurate SQL ###
|
SELECT party FROM table_1341472_15 WHERE candidates = "Jerry Weller (R) 51.77% Clem Balanoff (D) 48.23%"
|
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_28204 ( "Date" text, "Tournament" text, "Location" text, "Purse ( $ )" real, "Winner" text, "Score" text, "1st Prize ( $ )" text )
### Question ###
Name the 1st prize for senior pga championship
### Accurate SQL ###
|
SELECT "1st Prize ( $ )" FROM table_28204 WHERE "Tournament" = 'Senior PGA Championship'
|
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_78 (country VARCHAR, year_s__won VARCHAR)
### Question ###
What is Country, when Year(s) Won is "1962"?
### Accurate SQL ###
|
SELECT country FROM table_name_78 WHERE year_s__won = "1962"
|
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 ( opponents_in_the_final VARCHAR, score_in_the_final VARCHAR )
### Question ###
Who were the Opponents in the final in the match with a Score in the final of 1 6, 6 3, 2 6?
### Accurate SQL ###
|
SELECT opponents_in_the_final FROM table_name_22 WHERE score_in_the_final = "1–6, 6–3, 2–6"
|
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 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 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 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 ###
what is the number of patients whose ethnicity is asian and drug type is base?
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "ASIAN" AND prescriptions.drug_type = "BASE"
|
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_13 ( period VARCHAR, built VARCHAR )
### Question ###
In what time period were 354 built?
### Accurate SQL ###
|
SELECT period FROM table_name_13 WHERE built = "354"
|
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_22460085_1 ( original_south_korean_performer VARCHAR, original_manchester_performer VARCHAR )
### Question ###
Who was the origianal south korean performer when Adebayo Bolaji performed in Manchester?
### Accurate SQL ###
|
SELECT original_south_korean_performer FROM table_22460085_1 WHERE original_manchester_performer = "Adebayo Bolaji"
|
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_5 (sanction VARCHAR, location VARCHAR)
### Question ###
What was the sanction of the event at Nashville, Illinois?
### Accurate SQL ###
|
SELECT sanction FROM table_name_5 WHERE location = "nashville, illinois"
|
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 ( score VARCHAR, date VARCHAR )
### Question ###
What score has october 16, 2000 as the date?
### Accurate SQL ###
|
SELECT score FROM table_name_71 WHERE date = "october 16, 2000"
|
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
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 )
### Question ###
Among patients who died in or before the year 2115, how many had congestive heart failure as primary disease?
### Accurate SQL ###
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CONGESTIVE HEART FAILURE" AND demographic.dod_year <= "2115.0"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.