text
stringlengths
432
6.49k
target
stringlengths
2
4.44k
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_74 (conference VARCHAR, city VARCHAR, school VARCHAR) ### Question ### Which Conference has a City of boca raton, and a School of florida atlantic university? ### Accurate SQL ###
SELECT conference FROM table_name_74 WHERE city = "boca raton" AND school = "florida atlantic university"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 ( storage_stability INTEGER, field_stability VARCHAR, toxicity_as_blood_agent VARCHAR, agent VARCHAR ) ### Question ### What is the storage stability of Arsine with a toxicity of 8, and field stability less than 5? ### Accurate SQL ###
SELECT MIN(storage_stability) FROM table_name_30 WHERE toxicity_as_blood_agent > 8 AND agent = "arsine" AND field_stability < 5
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_42 ( score_points VARCHAR, rank_points VARCHAR, event VARCHAR ) ### Question ### which Score points has a Rank points of 10, and an Event of wc milan? ### Accurate SQL ###
SELECT score_points FROM table_name_42 WHERE rank_points = "10" AND event = "wc milan"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_25 ( method VARCHAR, round VARCHAR, location VARCHAR ) ### Question ### What method was there in round 1 when the location was Aruba? ### Accurate SQL ###
SELECT method FROM table_name_25 WHERE round = "1" AND location = "aruba"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) TABLE: CREATE TABLE 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 vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) ### Question ### in 2102 how many patients have undergone neurosurgery - therapeutic craniotomy in the same hospital encounter after the diagnosis of pleural effusion - right? ### Accurate SQL ###
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'pleural effusion - right' AND STRFTIME('%y', diagnosis.diagnosistime) = '2102') AS t1 JOIN (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'neurosurgery - therapeutic craniotomy' AND STRFTIME('%y', treatment.treatmenttime) = '2102') AS t2 WHERE t1.diagnosistime < t2.treatmenttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_70889 ( "Auckland" text, "Gold Coast" text, "Sydney" text, "Melbourne" text, "Adelaide" text, "Perth" text ) ### Question ### Which Gold Coast has Melbourne yes, and Auckland yes? ### Accurate SQL ###
SELECT "Gold Coast" FROM table_70889 WHERE "Melbourne" = 'yes' AND "Auckland" = 'yes'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_28745 ( "Year" real, "Races" real, "Wins" real, "Poles" real, "Top 5" real, "Top 10" real, "DNF" real, "Finish" text, "Start" text, "Winnings" text, "Season Rank" text, "Team(s)" text ) ### Question ### Where did he finish when he started at 21.6? ### Accurate SQL ###
SELECT COUNT("Finish") FROM table_28745 WHERE "Start" = '21.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_name_33 ( tries INTEGER, goals INTEGER ) ### Question ### How many tries have goals greater than 0? ### Accurate SQL ###
SELECT SUM(tries) FROM table_name_33 WHERE goals > 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_20319085_2 (season INTEGER, conference_record VARCHAR) ### Question ### In what season was the conference record 4-3? ### Accurate SQL ###
SELECT MIN(season) FROM table_20319085_2 WHERE conference_record = "4-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_1429629_1 ( run_time VARCHAR, viewers__in_millions_ VARCHAR ) ### Question ### What are all the run times with 8.2 million viewers? ### Accurate SQL ###
SELECT run_time FROM table_1429629_1 WHERE viewers__in_millions_ = "8.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 ship ( name VARCHAR, built_year VARCHAR, CLASS VARCHAR ) ### Question ### List all ship names in the order of built year and class. ### Accurate SQL ###
SELECT name FROM ship ORDER BY built_year, CLASS
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) TABLE: CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) TABLE: CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) TABLE: CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) TABLE: CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) ### Question ### How many students are living in a dorm with a TV Lounge? Show a bar chart grouping by first name, and rank by the Y in ascending. ### Accurate SQL ###
SELECT Fname, COUNT(Fname) FROM Student AS T1 JOIN Lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM Has_amenity AS T3 JOIN Dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') GROUP BY Fname ORDER BY COUNT(Fname)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_203_446 ( id number, "name" text, "gender" text, "age" number, "from" text, "occupation" text, "prize money (usd)" text, "status" text ) ### Question ### who was the top prize winner in cha $ e ? ### Accurate SQL ###
SELECT "name" FROM table_203_446 ORDER BY "prize money (usd)" DESC LIMIT 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_72 (rank VARCHAR, start VARCHAR) ### Question ### What ranking that had a start of 19? ### Accurate SQL ###
SELECT rank FROM table_name_72 WHERE start = "19"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE 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 chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod 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 procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) TABLE: CREATE TABLE d_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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) ### Question ### calculate the number of patients who are admitted into hospital in 2100. ### Accurate SQL ###
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE STRFTIME('%y', admissions.admittime) = '2100'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) ) ### Question ### For those employees who did not have any job in the past, a bar chart shows the distribution of hire_date and the sum of manager_id bin hire_date by weekday, and sort from high to low by the y axis please. ### Accurate SQL ###
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(MANAGER_ID) DESC
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE 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 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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) ### Question ### what is maximum age of patients whose language is engl and primary disease is morbid obesity/sda? ### Accurate SQL ###
SELECT MAX(demographic.age) FROM demographic WHERE demographic.language = "ENGL" AND demographic.diagnosis = "MORBID OBESITY/SDA"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE weekly_weather (day_of_week VARCHAR, high_temperature INTEGER) ### Question ### What is the average high temperature for each day of week? ### Accurate SQL ###
SELECT AVG(high_temperature), day_of_week FROM weekly_weather GROUP BY day_of_week
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_94 ( position VARCHAR, player VARCHAR ) ### Question ### What position does Mario Kasun play? ### Accurate SQL ###
SELECT position FROM table_name_94 WHERE player = "mario kasun"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 (elevation_ VARCHAR, _height VARCHAR, delivery VARCHAR, location VARCHAR) ### Question ### Which Elevation + Height has a Delivery of barge and a Location of bikini, yurochi aka irioj (dog)? ### Accurate SQL ###
SELECT elevation_ + _height FROM table_name_96 WHERE delivery = "barge" AND location = "bikini, yurochi aka irioj (dog)"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) ### Question ### what is the number of patients whose ethnicity is american indian/alaska native and procedure icd9 code is 7761? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND procedures.icd9_code = "7761"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE music_festival ( ID int, Music_Festival text, Date_of_ceremony text, Category text, Volume int, Result text ) TABLE: CREATE TABLE volume ( Volume_ID int, Volume_Issue text, Issue_Date text, Weeks_on_Top real, Song text, Artist_ID int ) TABLE: CREATE TABLE artist ( Artist_ID int, Artist text, Age int, Famous_Title text, Famous_Release_date text ) ### Question ### Return the results of all music festivals using a bar chart, I want to sort Y in ascending order. ### Accurate SQL ###
SELECT Result, COUNT(Result) FROM music_festival GROUP BY Result ORDER BY COUNT(Result)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId 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 ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress 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 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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE PostTypes ( 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 PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) 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 VoteTypes ( Id number, Name text ) 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 PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) 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 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 ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) TABLE: CREATE TABLE CloseReasonTypes ( 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 ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) ### Question ### Questions Per Tag (Top Five) (By Month). ### Accurate SQL ###
SELECT t.TagName FROM Tags AS t /* *, COUNT(*) AS Count FROM ( SELECT CAST( CAST(DATEPART(YYYY, CreationDate) AS varchar) + '-' + CAST(DATEPART(MM, CreationDate) AS varchar) + '-01' AS DATETIME) 'month', t.TagName FROM Posts p JOIN PostTags pt ON pt.PostId = p.Id JOIN Tags t ON t.Id = pt.TagId WHERE TagId IN ( SELECT TOP 5 Id FROM Tags ORDER BY Count DESC ) ) AS X WHERE 'month' >= CAST('2012-04-01' as datetime) AND 'month' < CAST('2012-07-01' as datetime) GROUP BY TagName, 'month' ORDER BY 'month' ASC, TagName ASC */ WHERE t.Id IN (SELECT Id FROM Tags ORDER BY Count DESC LIMIT 5)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_5585 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text ) ### Question ### Which Pick # is the highest one that has a Name of lawrence sidbury, and a Round smaller than 4? ### Accurate SQL ###
SELECT MAX("Pick #") FROM table_5585 WHERE "Name" = 'lawrence sidbury' AND "Round" < '4'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_203_406 ( id number, "entrant" text, "constructor" text, "chassis" text, "engine" text, "tyre" text, "driver" text, "rounds" text ) ### Question ### what brand has been constructor the most ? ### Accurate SQL ###
SELECT "constructor" FROM table_203_406 GROUP BY "constructor" ORDER BY COUNT(*) DESC 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_59868 ( "Atomic property" text, "Helium" text, "Neon" text, "Argon" text, "Krypton" text, "Xenon" text, "Radon" text ) ### Question ### Which Xenon has Neon of 20.1797(6)? ### Accurate SQL ###
SELECT "Xenon" FROM table_59868 WHERE "Neon" = '20.1797(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_22905641_2 ( race_1_winner VARCHAR, circuit VARCHAR ) ### Question ### Who was the race 1 winner at the race held at Winton Motor Raceway? ### Accurate SQL ###
SELECT race_1_winner FROM table_22905641_2 WHERE circuit = "Winton Motor Raceway"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_42312 ( "Country" text, "Automobile Name" text, "Manufacturer" text, "Engine Make/Capacity" text, "Year" text ) ### Question ### What country had the car with the Jawa 350cc engine? ### Accurate SQL ###
SELECT "Country" FROM table_42312 WHERE "Engine Make/Capacity" = 'jawa 350cc'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_11545282_5 ( no VARCHAR, player VARCHAR ) ### Question ### How many players were names Howard Eisley? ### Accurate SQL ###
SELECT COUNT(no) FROM table_11545282_5 WHERE player = "Howard Eisley"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 date of birth of Jane Dillard? ### Accurate SQL ###
SELECT demographic.dob FROM demographic WHERE demographic.name = "Jane Dillard"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_1590652_4 (no INTEGER, tournament VARCHAR) ### Question ### Name the most number when tournament is madrid masters ### Accurate SQL ###
SELECT MAX(no) FROM table_1590652_4 WHERE tournament = "Madrid 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 table_50377 ( "Name" text, "Date" text, "Goals" real, "Assists" real, "Team" text, "Venue" text, "Opponent" text, "Competition" text, "Total Gs" real, "Total As" real ) ### Question ### What is the sum of the assists kang jae-soon had in the k-league competition in ulsan? ### Accurate SQL ###
SELECT SUM("Assists") FROM table_50377 WHERE "Venue" = 'ulsan' AND "Competition" = 'k-league' AND "Name" = 'kang jae-soon'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 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 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 ### count the number of patients admitted before the year 2139 for whom indirect bilirubin lab test order was placed. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2139" AND lab.label = "Bilirubin, Indirect"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 ( cultural_and_educational_panel INTEGER, agricultural_panel VARCHAR, university_of_dublin VARCHAR, industrial_and_commercial_panel VARCHAR ) ### Question ### What is the lowest number of members on the Cultural and Educational Panel, when the University of Dublin had 3 members, when the Industrial and Commercial Panel had more than 0 members, and when the Agricultural Panel had more than 4 members? ### Accurate SQL ###
SELECT MIN(cultural_and_educational_panel) FROM table_name_28 WHERE university_of_dublin < 3 AND industrial_and_commercial_panel > 0 AND agricultural_panel > 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_47493 ( "Rank" real, "Club" text, "Points" real, "Played" real, "Victories" real, "Draws" real, "Defeats" real, "Goals for" real, "Goals against" real, "Goal average" real ) ### Question ### What is the highest amount of points with a goal average larger than 4, less than 12 draws, and a goal of 63? ### Accurate SQL ###
SELECT MAX("Points") FROM table_47493 WHERE "Goal average" > '4' AND "Draws" < '12' AND "Goals for" = '63'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_11695 ( "Round" text, "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" text ) ### Question ### Which venue has 13,634 people in attendance? ### Accurate SQL ###
SELECT "Venue" FROM table_11695 WHERE "Attendance" = '13,634'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_2056 ( "Index" real, "Ozone, Running 8 hourly mean (\u03bcg/m 3 )" text, "Nitrogen Dioxide, Hourly mean (\u03bcg/m 3 )" text, "Sulphur Dioxide, 15 minute mean (\u03bcg/m 3 )" text, "PM10 Particles, 24 hour mean (\u03bcg/m 3 )" text, "PM2.5 Particles, 24 hour mean (\u03bcg/m 3 )" text ) ### Question ### What's the nitrogen dioxide count where the sulphur dioxide is at 0-88? ### Accurate SQL ###
SELECT "Nitrogen Dioxide, Hourly mean (\u03bcg/m 3 )" FROM table_2056 WHERE "Sulphur Dioxide, 15 minute mean (\u03bcg/m 3 )" = '0-88'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_55 ( chassis VARCHAR, points VARCHAR ) ### Question ### Which chassis scored 52 points? ### Accurate SQL ###
SELECT chassis FROM table_name_55 WHERE points = 52
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE technician ( technician_id real, Name text, Team text, Starting_Year real, Age int ) TABLE: CREATE TABLE repair ( repair_ID int, name text, Launch_Date text, Notes text ) TABLE: CREATE TABLE machine ( Machine_ID int, Making_Year int, Class text, Team text, Machine_series text, value_points real, quality_rank int ) TABLE: CREATE TABLE repair_assignment ( technician_id int, repair_ID int, Machine_ID int ) ### Question ### What are the names of the technicians by ascending order of quality rank for the machine they are assigned, and count them by a bar chart ### Accurate SQL ###
SELECT Name, COUNT(Name) FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.Machine_ID = T2.Machine_ID JOIN technician AS T3 ON T1.technician_id = T3.technician_id GROUP BY Name ORDER BY T2.quality_rank
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_66702 ( "Name" text, "Gender" text, "Area" text, "Authority" text, "Decile" real ) ### Question ### What is the smallest decile with a Name of st mary's catholic school? ### Accurate SQL ###
SELECT MIN("Decile") FROM table_66702 WHERE "Name" = 'st mary''s catholic school'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_6 ( silver INTEGER, gold VARCHAR, rank VARCHAR ) ### Question ### what is the amount of silver when gold is 2 and the rank is more than 1? ### Accurate SQL ###
SELECT AVG(silver) FROM table_name_6 WHERE gold = 2 AND rank > 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 nomination ( artwork_id number, festival_id number, result text ) TABLE: CREATE TABLE festival_detail ( festival_id number, festival_name text, chair_name text, location text, year number, num_of_audience number ) TABLE: CREATE TABLE artwork ( artwork_id number, type text, name text ) ### Question ### List the name of artworks that are not nominated. ### Accurate SQL ###
SELECT name FROM artwork WHERE NOT artwork_id IN (SELECT artwork_id FROM nomination)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_70166 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" text ) ### Question ### Name the to par for gene kunes ### Accurate SQL ###
SELECT "To par" FROM table_70166 WHERE "Player" = 'gene kunes'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_29087004_2 ( written_by VARCHAR, united_states_original_airdate VARCHAR, directed_by VARCHAR, canada_original_airdate VARCHAR ) ### Question ### Who wrote the episode directed by Jos Humphrey that had an original Canadian air date that was unknown and a United States original air date of August 27, 2011? ### Accurate SQL ###
SELECT written_by FROM table_29087004_2 WHERE directed_by = "Jos Humphrey" AND canada_original_airdate = "Unknown" AND united_states_original_airdate = "August 27, 2011"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE 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 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 ) ### Question ### Calculate the total number of patients with int infection clostrdium dificile who were born before 2065. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2065" AND diagnoses.short_title = "Int inf clstrdium dfcile"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_75221 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text ) ### Question ### What is the record of the game with 28,135 people in attendance? ### Accurate SQL ###
SELECT "Record" FROM table_75221 WHERE "Attendance" = '28,135'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_56 (ties INTEGER, losses VARCHAR, goals_against VARCHAR) ### Question ### Which team has the most ties with fewer than 4 losses and GA smaller than 20? ### Accurate SQL ###
SELECT MAX(ties) FROM table_name_56 WHERE losses < 4 AND goals_against < 20
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_66614 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) ### Question ### What is the number of silver medals when there are more than 1 gold, and more than 6 bronze? ### Accurate SQL ###
SELECT MIN("Silver") FROM table_66614 WHERE "Gold" > '1' AND "Bronze" > '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_13196 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" real, "Money ( $ )" text ) ### Question ### What country has a 14 to par? ### Accurate SQL ###
SELECT "Country" FROM table_13196 WHERE "To par" = '14'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_14 (date VARCHAR, album VARCHAR) ### Question ### When has an Album of l'un n'empêche pas l'autre? ### Accurate SQL ###
SELECT date FROM table_name_14 WHERE album = "l'un n'empêche pas l'autre"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_34737 ( "Game" real, "December" real, "Opponent" text, "Score" text, "Record" text, "Points" real ) ### Question ### Which Record has a Game larger than 32, and a December smaller than 21? ### Accurate SQL ###
SELECT "Record" FROM table_34737 WHERE "Game" > '32' AND "December" < '21'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE CloseReasonTypes ( 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 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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) 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 PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE PostTypes ( Id number, Name text ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId 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 PostHistoryTypes ( Id number, Name text ) 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 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 Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) 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 Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) 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 PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) ### Question ### Java Questions from Recent times. ### Accurate SQL ###
SELECT Id, Score, AcceptedAnswerId, Title, Body FROM Posts WHERE Tags LIKE '%<java>%' AND AcceptedAnswerId > 0 AND Id < 584234 ORDER BY Id DESC
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_204_600 ( id number, "name" text, "status" text, "population" number, "district" text, "former local authority" text ) ### Question ### tell me the number of residents in formby . ### Accurate SQL ###
SELECT "population" FROM table_204_600 WHERE "name" = 'formby'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_6679 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Venue" text, "Attendance" real ) ### Question ### Who was the opponent at the game with a result of w 20-17? ### Accurate SQL ###
SELECT "Opponent" FROM table_6679 WHERE "Result" = 'w 20-17'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_17 (goals INTEGER, player VARCHAR, rank VARCHAR) ### Question ### What was Thierry Henry's average goal when his rank was higher than 7? ### Accurate SQL ###
SELECT AVG(goals) FROM table_name_17 WHERE player = "thierry henry" AND rank > 7
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE 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 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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### provide the number of patients whose admission type is urgent and diagnoses short title is acute uri nos? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.short_title = "Acute uri NOS"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_20910 ( "No. in series" text, "No. in season" text, "Title" text, "Directed by" text, "Written by" text, "Original airdate" text, "Production code" text ) ### Question ### What is the series episode number of the episode with production code 303? ### Accurate SQL ###
SELECT "No. in series" FROM table_20910 WHERE "Production code" = '303'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_64 (romaji_title VARCHAR, japanese_title VARCHAR) ### Question ### Which Romaji Title has a Japanese Title of 女王の教室? ### Accurate SQL ###
SELECT romaji_title FROM table_name_64 WHERE japanese_title = "女王の教室"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_21781578_2 (original_air_date VARCHAR, season_no VARCHAR) ### Question ### What was the original air date for season number 2? ### Accurate SQL ###
SELECT original_air_date FROM table_21781578_2 WHERE season_no = 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_5 (gold INTEGER, total VARCHAR, silver VARCHAR, bronze VARCHAR) ### Question ### What is the average Gold award that has a Silver award greater than 2, and a Bronze award less than 13, and a Total greater than 24? ### Accurate SQL ###
SELECT AVG(gold) FROM table_name_5 WHERE silver > 2 AND bronze < 13 AND total > 24
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_59791 ( "Year" real, "Country/Territory" text, "Miss International" text, "National title" text, "Location" text ) ### Question ### What's the national title of miss international ikumi yoshimatsu? ### Accurate SQL ###
SELECT "National title" FROM table_59791 WHERE "Miss International" = 'ikumi yoshimatsu'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) ### Question ### what was the first time patient 006-157753 was prescribed a medication using an nd route on the current hospital visit? ### Accurate SQL ###
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-157753' AND patient.hospitaldischargetime IS NULL)) AND medication.routeadmin = 'nd' ORDER BY medication.drugstarttime LIMIT 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_52 ( points INTEGER, scored VARCHAR, wins VARCHAR ) ### Question ### What is the sum of points for teams with 10 goals scored and under 3 wins? ### Accurate SQL ###
SELECT SUM(points) FROM table_name_52 WHERE scored = 10 AND wins < 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 engineer_visits ( engineer_visit_id number, contact_staff_id number, engineer_id number, fault_log_entry_id number, fault_status text, visit_start_datetime time, visit_end_datetime time, other_visit_details text ) TABLE: CREATE TABLE staff ( staff_id number, staff_name text, gender text, other_staff_details text ) TABLE: CREATE TABLE maintenance_contracts ( maintenance_contract_id number, maintenance_contract_company_id number, contract_start_date time, contract_end_date time, other_contract_details text ) TABLE: CREATE TABLE engineer_skills ( engineer_id number, skill_id number ) TABLE: CREATE TABLE fault_log ( fault_log_entry_id number, asset_id number, recorded_by_staff_id number, fault_log_entry_datetime time, fault_description text, other_fault_details text ) TABLE: CREATE TABLE third_party_companies ( company_id number, company_type text, company_name text, company_address text, other_company_details text ) TABLE: CREATE TABLE parts ( part_id number, part_name text, chargeable_yn text, chargeable_amount text, other_part_details text ) TABLE: CREATE TABLE maintenance_engineers ( engineer_id number, company_id number, first_name text, last_name text, other_details text ) TABLE: CREATE TABLE assets ( asset_id number, maintenance_contract_id number, supplier_company_id number, asset_details text, asset_make text, asset_model text, asset_acquired_date time, asset_disposed_date time, other_asset_details text ) TABLE: CREATE TABLE fault_log_parts ( fault_log_entry_id number, part_fault_id number, fault_status text ) TABLE: CREATE TABLE skills_required_to_fix ( part_fault_id number, skill_id number ) TABLE: CREATE TABLE skills ( skill_id number, skill_code text, skill_description text ) TABLE: CREATE TABLE part_faults ( part_fault_id number, part_id number, fault_short_name text, fault_description text, other_fault_details text ) TABLE: CREATE TABLE asset_parts ( asset_id number, part_id number ) ### Question ### How many assets does each maintenance contract contain? List the number and the contract id. ### Accurate SQL ###
SELECT COUNT(*), T1.maintenance_contract_id FROM maintenance_contracts AS T1 JOIN assets AS T2 ON T1.maintenance_contract_id = T2.maintenance_contract_id GROUP BY T1.maintenance_contract_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 CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int ) TABLE: CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) TABLE: CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) TABLE: CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) TABLE: CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) TABLE: CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) TABLE: CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) ### Question ### Return a bar chart on how many classes are held in each department?, and list names in ascending order. ### Accurate SQL ###
SELECT DEPT_CODE, COUNT(*) FROM CLASS AS T1 JOIN COURSE AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY DEPT_CODE ORDER BY DEPT_CODE
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_79 ( away_team VARCHAR, venue VARCHAR ) ### Question ### At the match which took place in arden street oval, how much did the away team score? ### Accurate SQL ###
SELECT away_team AS score FROM table_name_79 WHERE venue = "arden street oval"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 ( championships__years_ VARCHAR, league VARCHAR, venue VARCHAR ) ### Question ### Which Championships (Years) have a League of milb, florida state league, and a Venue of ed smith stadium? ### Accurate SQL ###
SELECT championships__years_ FROM table_name_96 WHERE league = "milb, florida state league" AND venue = "ed smith stadium"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) ### Question ### For those employees who do not work in departments with managers that have ids between 100 and 200, find last_name and department_id , and visualize them by a bar chart. ### Accurate SQL ###
SELECT LAST_NAME, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value 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 icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) ### Question ### when was patient 27362 first prescribed the medication via the irr route in the last hospital visit? ### Accurate SQL ###
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27362 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND prescriptions.route = 'irr' ORDER BY prescriptions.startdate 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 course_prerequisite ( pre_course_id int, course_id int ) TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) TABLE: CREATE TABLE area ( course_id int, area varchar ) TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int ) TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar ) TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int ) TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int ) TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar ) TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int ) ### Question ### Next Fall what upper level electives will be available after 15:45 A.M. ? ### Accurate SQL ###
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course_offering.start_time > '15:45' AND course.course_id = course_offering.course_id AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Fall' AND semester.semester_id = course_offering.semester AND semester.year = 2017
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_37 ( to_par VARCHAR, total INTEGER ) ### Question ### What was the score to par for 156 strokes? ### Accurate SQL ###
SELECT COUNT(to_par) FROM table_name_37 WHERE total > 156
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 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 ) 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 vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE 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 ) ### Question ### count the number of patients who are dead after having been diagnosed with acute coronary syndrome - acute myocardial infarction (no st elevation) within the same hospital visit since 2102. ### Accurate SQL ###
SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime, t1.patienthealthsystemstayid FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'acute coronary syndrome - acute myocardial infarction (no st elevation)') AS t1 GROUP BY t1.uniquepid HAVING MIN(t1.diagnosistime) = t1.diagnosistime AND STRFTIME('%y', t1.diagnosistime) >= '2102') AS t2 JOIN (SELECT patient.uniquepid, patient.patienthealthsystemstayid, patient.hospitaldischargetime FROM patient WHERE patient.hospitaldischargestatus = 'expired') AS t3 ON t2.uniquepid = t3.uniquepid WHERE t2.patienthealthsystemstayid = t3.patienthealthsystemstayid
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_25 ( rank INTEGER, total VARCHAR, jianshu VARCHAR, athlete VARCHAR ) ### Question ### What is the lowest rank when Jianshu is smaller than 9.66, for Richard Devine ( gbr ), with a total smaller than 19.02? ### Accurate SQL ###
SELECT MIN(rank) FROM table_name_25 WHERE jianshu < 9.66 AND athlete = "richard devine ( gbr )" AND total < 19.02
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_24149 ( "Season" text, "Games" real, "Won" real, "Lost" real, "Tied" real, "Points" real, "Pct %" text, "Goals For" real, "Goals Against" real, "Standing" text ) ### Question ### In what season was the pct % 0.552? ### Accurate SQL ###
SELECT "Season" FROM table_24149 WHERE "Pct %" = '0.552'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_27 (speed VARCHAR, team VARCHAR, rank VARCHAR) ### Question ### What was #7 BMW's speed? ### Accurate SQL ###
SELECT speed FROM table_name_27 WHERE team = "bmw" AND rank = 7
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_64 (venue VARCHAR, round VARCHAR) ### Question ### What is the venue when the Round shows after extra time, chelsea won on 4-1 on penalties? ### Accurate SQL ###
SELECT venue FROM table_name_64 WHERE round = "after extra time, chelsea won on 4-1 on penalties"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE tasks ( task_id number, project_id number, task_details text, eg agree objectives text ) TABLE: CREATE TABLE organisations ( organisation_id number, organisation_type text, organisation_details text ) TABLE: CREATE TABLE documents ( document_id number, document_type_code text, grant_id number, sent_date time, response_received_date time, other_details text ) TABLE: CREATE TABLE staff_roles ( role_code text, role_description text ) TABLE: CREATE TABLE project_staff ( staff_id number, project_id number, role_code text, date_from time, date_to time, other_details text ) TABLE: CREATE TABLE research_staff ( staff_id number, employer_organisation_id number, staff_details text ) TABLE: CREATE TABLE grants ( grant_id number, organisation_id number, grant_amount number, grant_start_date time, grant_end_date time, other_details text ) TABLE: CREATE TABLE organisation_types ( organisation_type text, organisation_type_description text ) TABLE: CREATE TABLE research_outcomes ( outcome_code text, outcome_description text ) TABLE: CREATE TABLE projects ( project_id number, organisation_id number, project_details text ) TABLE: CREATE TABLE document_types ( document_type_code text, document_description text ) TABLE: CREATE TABLE project_outcomes ( project_id number, outcome_code text, outcome_details text ) ### Question ### What roles did staff members play between '2003-04-19 15:06:20' and '2016-03-15 00:33:18'? ### Accurate SQL ###
SELECT role_code FROM project_staff WHERE date_from > '2003-04-19 15:06:20' AND date_to < '2016-03-15 00:33:18'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_12 ( group VARCHAR, race VARCHAR ) ### Question ### with race of ranvet stakes what is the group? ### Accurate SQL ###
SELECT group FROM table_name_12 WHERE race = "ranvet stakes"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_24027047_1 (area__km²__2011 VARCHAR, administrative_division VARCHAR) ### Question ### What was the area in km2 in 2011 for the Narsingdi District? ### Accurate SQL ###
SELECT area__km²__2011 * * FROM table_24027047_1 WHERE administrative_division = "Narsingdi District"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_75 (tie_no VARCHAR, score VARCHAR, away_team VARCHAR) ### Question ### What is the Tie no when Swansea City is the Away team with a Score of 2–2? ### Accurate SQL ###
SELECT tie_no FROM table_name_75 WHERE score = "2–2" AND away_team = "swansea city"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE transactions ( transaction_id number, investor_id number, transaction_type_code text, date_of_transaction time, amount_of_transaction number, share_count text, other_details text ) TABLE: CREATE TABLE sales ( sales_transaction_id number, sales_details text ) TABLE: CREATE TABLE investors ( investor_id number, investor_details text ) TABLE: CREATE TABLE purchases ( purchase_transaction_id number, purchase_details text ) TABLE: CREATE TABLE transactions_lots ( transaction_id number, lot_id number ) TABLE: CREATE TABLE lots ( lot_id number, investor_id number, lot_details text ) TABLE: CREATE TABLE ref_transaction_types ( transaction_type_code text, transaction_type_description text ) ### Question ### What are the details of all sales and purchases? ### Accurate SQL ###
SELECT sales_details FROM sales UNION SELECT purchase_details FROM purchases
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_77110 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" text, "Finish" text ) ### Question ### What is Year(s) Won, when Total is less than 285? ### Accurate SQL ###
SELECT "Year(s) won" FROM table_77110 WHERE "Total" < '285'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_train_260 ( "id" int, "leukocyte_deficiencies" bool, "bleeding" int, "hemoglobin_a1c_hba1c" float, "leukocyte_dysfunction" bool, "renal_disease" bool, "hba1c" float, "serum_creatinine" float, "NOUSE" float ) ### Question ### history of bleeding disorders ### Accurate SQL ###
SELECT * FROM table_train_260 WHERE bleeding = 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 CLASS (crs_code VARCHAR) TABLE: CREATE TABLE course (dept_code VARCHAR, crs_credit INTEGER, crs_code VARCHAR) ### Question ### Find the total credits of all classes offered by each department. ### Accurate SQL ###
SELECT SUM(T1.crs_credit), T1.dept_code FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code GROUP BY T1.dept_code
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_dev_19 ( "id" int, "glucagon_stimulated_c_peptide" float, "c_peptide_level" float, "hemoglobin_a1c_hba1c" float, "diabetic" string, "hyperlipidemia" bool, "creatinine_clearance_cl" float, "total_cholesterol" int, "stimulated_c_peptide" float, "smoking" bool, "insulin_requirement" float, "diabetes" bool, "albumin_excretion" int, "ldl" int, "treatment" bool, "serum_creatinine" float, "alcohol_abuse" bool, "renal_transplantation" bool, "triglyceride_tg" float, "negative_basal" bool, "NOUSE" float ) ### Question ### type i diabetes mellitus. documentation of negative basal and stimulated c _ peptide ( a basal level of < / = 0.2 ng / ml before iv administration of 1 mg of glucagon, and a glucagon stimulated c _ peptide < / = 0.8 ng / ml ) and diagnosis of diabetes for at least 5 years. ### Accurate SQL ###
SELECT * FROM table_dev_19 WHERE diabetic = 'i' AND negative_basal = 1 AND stimulated_c_peptide = 1 OR (c_peptide_level < 0.2 AND glucagon_stimulated_c_peptide <= 0.8) AND diabetes = 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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange 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 ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId 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 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 ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description 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 ReviewTaskStates ( Id number, Name text, Description text ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId 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 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 PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) 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 FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) 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 PostHistoryTypes ( Id number, Name text ) ### Question ### Days with at least one comment by MathOverflow moderators. ### Accurate SQL ###
SELECT DATE(c.CreationDate) FROM Users AS u INNER JOIN Comments AS c ON c.UserId = u.Id WHERE u.Id IN (2, 3, 66, 121, 1409, 2000, 2926) GROUP BY DATE(c.CreationDate) ORDER BY DATE(c.CreationDate) 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_name_30 ( name VARCHAR, county VARCHAR, built VARCHAR ) ### Question ### What bridge in Sheridan county was built in 1915? ### Accurate SQL ###
SELECT name FROM table_name_30 WHERE county = "sheridan" AND built = "1915"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_72858 ( "1st throw" real, "2nd throw" real, "3rd throw" text, "Equation" text, "Result" real ) ### Question ### If the equation is (10 times 8) + 4, what would be the 2nd throw? ### Accurate SQL ###
SELECT MAX("2nd throw") FROM table_72858 WHERE "Equation" = '(10 times 8) + 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_name_23 (rider VARCHAR, manufacturer VARCHAR, time_retired VARCHAR) ### Question ### Which rider has a Manufacturer of honda with a time of +44.814? ### Accurate SQL ###
SELECT rider FROM table_name_23 WHERE manufacturer = "honda" AND time_retired = "+44.814"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId 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 PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment 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 PostTypes ( Id number, Name text ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTaskResultTypes ( 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 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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) 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 ReviewTaskTypes ( Id number, Name text, Description text ) 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 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 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 PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text ) 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 ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) ### Question ### Posts and Votes per Month. ### Accurate SQL ###
SELECT YEAR(CreationDate) AS "Year", MONTH(CreationDate) AS "Month", PostTypeId AS "Post Type", COUNT(Id) AS "Post Count" FROM Posts WHERE PostTypeId < 3 AND ClosedDate IS NULL GROUP BY YEAR(CreationDate), MONTH(CreationDate), PostTypeId ORDER BY Year, Month, 'Post Type'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_82 (candidate VARCHAR, share_of_votes VARCHAR) ### Question ### Which candidate won 61.47% of the votes? ### Accurate SQL ###
SELECT candidate FROM table_name_82 WHERE share_of_votes = "61.47%"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_65818 ( "Part Number" text, "Pins" text, "Body Width/mm" real, "Body Length/mm" real, "Lead Pitch/mm" real ) ### Question ### Which Body Width/mm has a Lead Pitch/mm smaller than 0.55, and a Body Length/mm larger than 18.4? ### Accurate SQL ###
SELECT MIN("Body Width/mm") FROM table_65818 WHERE "Lead Pitch/mm" < '0.55' AND "Body Length/mm" > '18.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_2213 ( "Poll source" text, "Dates administered" text, "Tom Emmer (R)" text, "Matt Entenza (DFL)" text, "Tom Horner (I)" text, "Undecided" text, "Sampling error" text ) ### Question ### What percentage voted for Tom Horner according to the poll source with sampling error of 2.5%? ### Accurate SQL ###
SELECT "Tom Horner (I)" FROM table_2213 WHERE "Sampling error" = '2.5%'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_54944 ( "Year" real, "Artist" text, "Composition" text, "Mintage" real, "Issue Price" text ) ### Question ### What is the sum of Artist Steve Hepburn's Mintage? ### Accurate SQL ###
SELECT SUM("Mintage") FROM table_54944 WHERE "Artist" = 'steve hepburn'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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 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 ### tell me the number of patients who were diagnosed with long-term use of steroids. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Long-term use steroids"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_20 (wins VARCHAR, class VARCHAR, year VARCHAR) ### Question ### How many wins did the 500cc class have in 1979? ### Accurate SQL ###
SELECT wins FROM table_name_20 WHERE class = "500cc" AND year = 1979
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_203_788 ( id number, "year" number, "author" text, "illustrator" text, "title" text, "publisher" text ) ### Question ### what is the only title listed for 1999 ? ### Accurate SQL ###
SELECT "title" FROM table_203_788 WHERE "year" = 1999
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_45 (goals INTEGER, leading_scorer VARCHAR) ### Question ### Leading Scorer of Ian rush is what lowest # of goals? ### Accurate SQL ###
SELECT MIN(goals) FROM table_name_45 WHERE leading_scorer = "ian rush"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only 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_23670057_1 ( position VARCHAR, height__m_ VARCHAR ) ### Question ### Name the position for 2.16 ### Accurate SQL ###
SELECT position FROM table_23670057_1 WHERE height__m_ = "2.16"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adults INTEGER, Kids INTEGER ) TABLE: CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, basePrice INTEGER, decor TEXT ) ### Question ### how many rooms have king beds? Report the number for each decor type, and could you order by the y-axis from high to low please? ### Accurate SQL ###
SELECT decor, COUNT(*) FROM Rooms WHERE bedType = "King" GROUP BY decor ORDER BY COUNT(*) DESC