instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
Find the name of customers who have more than one loan.
CREATE TABLE bank (branch_id number,bname text,no_of_customers number,city text,state text)CREATE TABLE loan (loan_id text,loan_type text,cust_id text,branch_id text,amount number)CREATE TABLE customer (cust_id text,cust_name text,acc_type text,acc_bal number,no_of_loans number,credit_score number,branch_id number,stat...
SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING COUNT(*) > 1
what is the Frequency that has a fairview City of license
CREATE TABLE table_name_32 (frequency VARCHAR,city_of_license VARCHAR)
SELECT frequency FROM table_name_32 WHERE city_of_license = "fairview"
Show the hometowns shared by people older than 23 and younger than 20.
CREATE TABLE people (people_id number,name text,age number,height number,hometown text)CREATE TABLE gymnast (gymnast_id number,floor_exercise_points number,pommel_horse_points number,rings_points number,vault_points number,parallel_bars_points number,horizontal_bar_points number,total_points number)
SELECT hometown FROM people WHERE age > 23 INTERSECT SELECT hometown FROM people WHERE age < 20
Find the number of different airports which are the destinations of the American Airlines.
CREATE TABLE airlines (alid number,name text,iata text,icao text,callsign text,country text,active text)CREATE TABLE airports (apid number,name text,city text,country text,x number,y number,elevation number,iata text,icao text)CREATE TABLE routes (rid number,dst_apid number,dst_ap text,src_apid number,src_ap text,alid ...
SELECT COUNT(DISTINCT dst_apid) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid WHERE T1.name = 'American Airlines'
Which Game has a Score of 4 0 and Points of 44?
CREATE TABLE table_34184 ("Game" real,"December" real,"Opponent" text,"Score" text,"Record" text,"Points" real)
SELECT "Game" FROM table_34184 WHERE "Score" = '4–0' AND "Points" = '44'
What away team has a Tie no of 5?
CREATE TABLE table_46989 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text)
SELECT "Away team" FROM table_46989 WHERE "Tie no" = '5'
What is the lowest Pick # with michael grabner and less than 20 Reg GP?
CREATE TABLE table_name_90 (pick__number INTEGER,player VARCHAR,reg_gp VARCHAR)
SELECT MIN(pick__number) FROM table_name_90 WHERE player = "michael grabner" AND reg_gp < 20
When the record was 2-29 who had the most assists?
CREATE TABLE table_22879323_6 (high_assists VARCHAR,record VARCHAR)
SELECT high_assists FROM table_22879323_6 WHERE record = "2-29"
What is the WPW freq with a day power of 250?
CREATE TABLE table_name_55 (freq INTEGER,owner VARCHAR,day_power___w__ VARCHAR)
SELECT SUM(freq) FROM table_name_55 WHERE owner = "wpw" AND day_power___w__ > 250
how many patients stayed in hospital for more than 16 days and were diagnosed with icd9 code v489?
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)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "16" AND diagnoses.icd9_code = "V489"
What is the total of Last title that has Wins smaller than 71 and a First title larger than 1968 and a Country of fiji?
CREATE TABLE table_name_79 (last_title VARCHAR,country VARCHAR,wins VARCHAR,first_title VARCHAR)
SELECT COUNT(last_title) FROM table_name_79 WHERE wins < 71 AND first_title > 1968 AND country = "fiji"
Questions with recent activity - including activity on answers.
CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Sco...
SELECT COALESCE(p.ParentId, p.Id) AS "post_link", MAX(p.LastActivityDate) FROM Posts AS p GROUP BY COALESCE(p.ParentId, p.Id) ORDER BY MAX(p.LastActivityDate) DESC LIMIT 100
What date did the Home team score 11.21 (87)?
CREATE TABLE table_10285 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Date" FROM table_10285 WHERE "Home team score" = '11.21 (87)'
Highest scoring answers with at least one image.
CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TA...
SELECT Id AS "post_link", Score, CreationDate, LENGTH(Body) FROM Posts WHERE PostTypeId = 2 AND Body LIKE '%<img%' ORDER BY Score DESC, LENGTH(Body)
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and the sum of code , and group by attribute name, and sort Y-axis in descending order.
CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Code DESC
What are the average ages for male and female students?
CREATE TABLE allergy_type (allergy text,allergytype text)CREATE TABLE has_allergy (stuid number,allergy text)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)
SELECT AVG(age), sex FROM student GROUP BY sex
what's the five most frequent input event since 2105?
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)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABL...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT inputevents_cv.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM inputevents_cv WHERE STRFTIME('%y', inputevents_cv.charttime) >= '2105' GROUP BY inputevents_cv.itemid) AS t1 WHERE t1.c1 <= 5)
Which network has a play-by-play announcer of John Wells?
CREATE TABLE table_55628 ("Year" real,"Network" text,"Play-by-play" text,"Colour commentator(s)" text,"Studio host" text)
SELECT "Network" FROM table_55628 WHERE "Play-by-play" = 'john wells'
what does fare code QO mean
CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,time_zone_code varchar)CREATE TABLE month (month_number int,month_name text)CREATE TABLE airline (airline_code varchar,airline_name text,no...
SELECT DISTINCT fare_basis_code FROM fare_basis WHERE fare_basis_code = 'QO'
What is the total number of Against, when Losses is less than 52, when Matches is greater than 4, and when Draw is less than 2?
CREATE TABLE table_12689 ("Matches" real,"Wins" real,"Draw" real,"Losses" real,"Against" real)
SELECT COUNT("Against") FROM table_12689 WHERE "Losses" < '52' AND "Matches" > '4' AND "Draw" < '2'
What is every date with a record of 30 34 12?
CREATE TABLE table_23486853_8 (date VARCHAR,record VARCHAR)
SELECT date FROM table_23486853_8 WHERE record = "30–34–12"
on the first icu visit the heartrate of patient 017-59454 had been normal?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname...
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-59454') AND NOT patient.unitdischargetime IS NULL ORDER BY patie...
find the maximum age of patients who had private insurance and their year of expiry is before 2126.
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 ...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.insurance = "Private" AND demographic.dod_year < "2126.0"
How many viewers (in millions) watched the episode written by deidre shaw?
CREATE TABLE table_22951088_3 (us_viewers__in_millions_ VARCHAR,written_by VARCHAR)
SELECT us_viewers__in_millions_ FROM table_22951088_3 WHERE written_by = "Deidre Shaw"
What's the transfer window that ends in 2012?
CREATE TABLE table_44656 ("Nat." text,"Name" text,"Moving from" text,"Type" text,"Transfer window" text,"Ends" text)
SELECT "Transfer window" FROM table_44656 WHERE "Ends" = '2012'
how many patients died in the same month after being diagnosed in 2105 with nutritional deficiency?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight nu...
SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'nutritional deficiency') AS t1 GROUP BY t1.uniquepid HAVING MIN(...
How many clubs does number 6 play for?
CREATE TABLE table_17892 ("No" real,"Player" text,"Height" text,"Position" text,"Year born" real,"Current Club" text)
SELECT COUNT("Current Club") FROM table_17892 WHERE "No" = '6'
count the number of patients whose days of hospital stay is greater than 15 and drug code is imdu30?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)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,ethni...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "15" AND prescriptions.formulary_drug_cd = "IMDU30"
show me the cheapest one way flights from ORLANDO to MONTREAL
CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)CREATE TABLE fare (fare_id int,from_airport varchar,to_airport varchar,fare_basis_code text,fare_airline text,restriction_code text,one_direction_cost int,round_trip_cost int,round_trip_required varchar)CREATE TABLE time_zone (time_zo...
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ORLANDO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city...
Find the department name and room of the course INTRODUCTION TO COMPUTER SCIENCE.
CREATE TABLE enrolled_in (stuid number,cid text,grade text)CREATE TABLE member_of (facid number,dno number,appt_type text)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE minor_in (stuid number,dno number)CREATE TABLE course (cid text,c...
SELECT T2.dname, T2.room FROM course AS T1 JOIN department AS T2 ON T1.dno = T2.dno WHERE T1.cname = "INTRODUCTION TO COMPUTER SCIENCE"
provide the number of patients whose primary disease is stemi and who have died before or in year 2183.
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "STEMI" AND demographic.dod_year <= "2183.0"
which prison is for former policemen , abovyan or vardashen ?
CREATE TABLE table_204_414 (id number,"name" text,"armenian" text,"location" text,"# of prisoners designed for" number,"notes" text)
SELECT "name" FROM table_204_414 WHERE "notes" = 'for former policemen and military officers' AND "name" IN ('abovyan', 'vardashen')
What was Melbourne's score as the away team?
CREATE TABLE table_name_17 (away_team VARCHAR)
SELECT away_team AS score FROM table_name_17 WHERE away_team = "melbourne"
What year was Bob Clement first elected?
CREATE TABLE table_18166 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Results" text,"Candidates" text)
SELECT MIN("First elected") FROM table_18166 WHERE "Incumbent" = 'Bob Clement'
Give me a histogram for what are the different parties of representative? Show the party name and the number of representatives in each party, and show total number in asc order please.
CREATE TABLE election (Election_ID int,Representative_ID int,Date text,Votes real,Vote_Percent real,Seats real,Place real)CREATE TABLE representative (Representative_ID int,Name text,State text,Party text,Lifespan text)
SELECT Party, COUNT(*) FROM representative GROUP BY Party ORDER BY COUNT(*)
tell me the last procedure patient 006-172277 had in their current hospital encounter?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE patient (...
SELECT treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-172277' AND patient.hospitaldischargetime IS NULL)) ORDER BY ...
who is the the incumbent with candidates being john m. vorys (r) 61.5% jacob f. myers (d) 38.5%
CREATE TABLE table_18483 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "Incumbent" FROM table_18483 WHERE "Candidates" = 'John M. Vorys (R) 61.5% Jacob F. Myers (D) 38.5%'
Give me the comparison about the sum of Height over the Sex , and group by attribute Sex by a bar chart, show sum height in descending order.
CREATE TABLE candidate (Candidate_ID int,People_ID int,Poll_Source text,Date text,Support_rate real,Consider_rate real,Oppose_rate real,Unsure_rate real)CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real)
SELECT Sex, SUM(Height) FROM people GROUP BY Sex ORDER BY SUM(Height) DESC
germany and the netherlands tied for what rank ?
CREATE TABLE table_203_374 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number)
SELECT "rank" FROM table_203_374 WHERE "nation" = 'germany'
What is the engine code of the xdrive23d model?
CREATE TABLE table_79391 ("Model" text,"Years" text,"Engine code" text,"Power" text,"Torque" text)
SELECT "Engine code" FROM table_79391 WHERE "Model" = 'xdrive23d'
A bunch of related tags - annual usage over time (union of all these tags).
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)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 t...
SELECT YEAR(p.CreationDate) AS "year", COUNT(DISTINCT p.Id) AS "##ColName##" FROM Posts AS p JOIN PostTags AS pTags ON p.Id = pTags.PostId JOIN Tags AS t ON t.Id = pTags.TagId WHERE p.PostTypeId = 1 AND t.TagName IN ('##Tags##') GROUP BY YEAR(p.CreationDate) ORDER BY YEAR(p.CreationDate)
who was next to be sent home after patrick ?
CREATE TABLE table_204_945 (id number,"episode" number,"name" text,"synopsis" text,"sent home" text,"highest seller" text)
SELECT "sent home" FROM table_204_945 WHERE "episode" = (SELECT "episode" FROM table_204_945 WHERE "sent home" = 'patrick') + 1
When was the earliest person elected?
CREATE TABLE table_2668420_17 (first_elected INTEGER)
SELECT MIN(first_elected) FROM table_2668420_17
What is the average week number of all the matches where less than 22,604 people attended?
CREATE TABLE table_74715 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT AVG("Week") FROM table_74715 WHERE "Attendance" < '22,604'
select * from Posts where Title like '%deeplearning%'.
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,DeactivationDat...
SELECT * FROM Posts WHERE Title LIKE '%learn%'
Rep loss if identification-request questions were to be deleted. Excludes rep changes resulting from suggested edits to identification-request questions.
CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE ReviewTasks (Id number,ReviewTaskTy...
SELECT u.Id AS "user_link", (CASE WHEN p.PostTypeId = 1 AND v.VoteTypeId = 2 THEN 5 WHEN p.PostTypeId = 2 AND v.VoteTypeId = 2 THEN 10 WHEN p.PostTypeId = 1 AND v.VoteTypeId = 3 THEN -1 WHEN p.PostTypeId = 2 AND v.VoteTypeId = 3 THEN -2 WHEN p.PostTypeId = 2 AND v.VoteTypeId = 1 THEN 15 END) AS "totalscore", p.PostType...
what number of enterostomy nec procedures have been performed since 6 years ago?
CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)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)CREATE TABLE patients (row_id number,subject_id number,...
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'enterostomy nec') AND DATETIME(procedures_icd.charttime) >= DATETIME(CURRENT_TIME(), '-6 year')
suspected infection
CREATE TABLE table_train_39 ("id" int,"active_infection" bool,"sepsis" bool,"organ_failure" bool,"septic_shock" bool,"age" float,"NOUSE" float)
SELECT * FROM table_train_39 WHERE active_infection = 1
What is the name of the airport located in Russia with an IATA of KRR?
CREATE TABLE table_42366 ("City" text,"Country" text,"IATA" text,"ICAO" text,"Airport" text)
SELECT "Airport" FROM table_42366 WHERE "Country" = 'russia' AND "IATA" = 'krr'
What points larger than 1950 has a maserati straight-6 engine?
CREATE TABLE table_70202 ("Year" real,"Entrant" text,"Chassis" text,"Engine" text,"Points" real)
SELECT "Points" FROM table_70202 WHERE "Year" > '1950' AND "Engine" = 'maserati straight-6'
what is the lowest year with the result is nominated for the work title is love bites?
CREATE TABLE table_51487 ("Year" real,"Organisation" text,"Award" text,"Nominated Work Title" text,"Result" text)
SELECT MIN("Year") FROM table_51487 WHERE "Result" = 'nominated' AND "Nominated Work Title" = 'love bites'
When olympikus is the main sponsor who is the secondary sponsor?
CREATE TABLE table_187239_1 (secondary_sponsor VARCHAR,main_sponsor VARCHAR)
SELECT secondary_sponsor FROM table_187239_1 WHERE main_sponsor = "Olympikus"
What is every CFL team from the Calgary college?
CREATE TABLE table_28059992_1 (cfl_team VARCHAR,college VARCHAR)
SELECT cfl_team FROM table_28059992_1 WHERE college = "Calgary"
Who was the partner for the jazz piece in the bottom three?
CREATE TABLE table_53706 ("Week" real,"Partner" text,"Style" text,"Choreographer(s)" text,"Results" text)
SELECT "Partner" FROM table_53706 WHERE "Style" = 'jazz' AND "Results" = 'bottom three'
Who is Team Suzuki's rider and ranks higher than 6?
CREATE TABLE table_32151 ("Rank" real,"Rider" text,"Team" text,"Speed" text,"Time" text)
SELECT "Rider" FROM table_32151 WHERE "Rank" > '6' AND "Team" = 'suzuki'
What is the free of Apolline Dreyfuss & Lila Meesseman-Bakir, when the total was larger than 90.333?
CREATE TABLE table_name_87 (free INTEGER,athlete VARCHAR,total VARCHAR)
SELECT MIN(free) FROM table_name_87 WHERE athlete = "apolline dreyfuss & lila meesseman-bakir" AND total > 90.333
What are the air dates of the show in ABS-CBN?
CREATE TABLE table_29549 ("Country" text,"Name" text,"Host(s)" text,"Judges" text,"Network" text,"Air dates" text)
SELECT "Air dates" FROM table_29549 WHERE "Network" = 'ABS-CBN'
Which Location has a Method of decision (unanimous), and Res of win x?
CREATE TABLE table_58819 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text)
SELECT "Location" FROM table_58819 WHERE "Method" = 'decision (unanimous)' AND "Res." = 'win x'
what are the three most common procedures given for patients who had previously been diagnosed with mycoses nec & nos within 2 months during a year before?
CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE admissions (row_id n...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissi...
What is the sum of average values for 23 yards?
CREATE TABLE table_37004 ("Player" text,"Sacks" real,"INT'S" real,"Yards" real,"Average" real,"Long" text)
SELECT SUM("Average") FROM table_37004 WHERE "Yards" = '23'
Tell me the venue of 29 april 2007
CREATE TABLE table_name_14 (venue VARCHAR,date VARCHAR)
SELECT venue FROM table_name_14 WHERE date = "29 april 2007"
Where did the Gould Rex Mays Classic 150 occur?
CREATE TABLE table_32856 ("Sanctioning" text,"Race Name" text,"Circuit" text,"City/Location" text,"Date" text)
SELECT "City/Location" FROM table_32856 WHERE "Race Name" = 'gould rex mays classic 150'
Who performed the song named 'Badlands'? Show the first name and the last name.
CREATE TABLE songs (songid number,title text)CREATE TABLE albums (aid number,title text,year number,label text,type text)CREATE TABLE band (id number,firstname text,lastname text)CREATE TABLE instruments (songid number,bandmateid number,instrument text)CREATE TABLE tracklists (albumid number,position number,songid numb...
SELECT T2.firstname, T2.lastname FROM performance AS T1 JOIN band AS T2 ON T1.bandmate = T2.id JOIN songs AS T3 ON T3.songid = T1.songid WHERE T3.title = "Badlands"
when did patient 58932 have a last procedure?
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)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icust...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 58932) ORDER BY procedures_icd.charttime DESC LIMIT 1
Display a bar chart for what is the name of each camera lens and the number of photos taken by it? Order the result by the count of photos.
CREATE TABLE photos (id int,camera_lens_id int,mountain_id int,color text,name text)CREATE TABLE camera_lens (id int,brand text,name text,focal_length_mm real,max_aperture real)CREATE TABLE mountain (id int,name text,Height real,Prominence real,Range text,Country text)
SELECT T1.name, COUNT(*) FROM camera_lens AS T1 JOIN photos AS T2 ON T1.id = T2.camera_lens_id GROUP BY T1.id ORDER BY COUNT(*)
which Player has a To par of 7, and a Country of spain?
CREATE TABLE table_61119 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Player" FROM table_61119 WHERE "To par" = '–7' AND "Country" = 'spain'
diagnosis of any of the following ocular conditions: active scleral disease, glaucoma, retinal disease potentially affecting central vision, macular disease or uveitis, severe dry eyes and dysthyroid eye disease
CREATE TABLE table_test_31 ("id" int,"ejection_fraction_ef" int,"macular_disease" bool,"systemic" bool,"alt" float,"iud" bool,"condom_with_spermicide" bool,"gender" string,"meropenem" bool,"non_q_wave_myocardial_infarction" bool,"hbcab" bool,"unstable_angina" bool,"birth_control_pills" bool,"cystic_fibrosis" bool,"hbv_...
SELECT * FROM table_test_31 WHERE ocular = 1 OR (active_scleral_disease = 1 OR glaucoma = 1 OR (retinal_disease = 1 AND central_vision = 1) OR macular_disease = 1 OR uveitis_disease = 1 OR severe_dry_eyes = 1 OR dysthyroid_eye_disease = 1)
what is the specimen test that patient 72032 was given for the last time?
CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE cost (row_id number,subject_id number,hadm_i...
SELECT microbiologyevents.spec_type_desc FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 72032) ORDER BY microbiologyevents.charttime DESC LIMIT 1
How many Touchdowns have Extra points larger than 0, and Points of 48?
CREATE TABLE table_name_84 (touchdowns VARCHAR,extra_points VARCHAR,points VARCHAR)
SELECT COUNT(touchdowns) FROM table_name_84 WHERE extra_points > 0 AND points = 48
For those records from the products and each product's manufacturer, return a bar chart about the distribution of name and code , and group by attribute name, order in ascending by the Y.
CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Code
Find dates and attendance for exhibitions that happened in 2004, show me the comparison of attendance by date, show by the Y-axis in ascending.
CREATE TABLE exhibition (Exhibition_ID int,Year int,Theme text,Artist_ID int,Ticket_Price real)CREATE TABLE artist (Artist_ID int,Name text,Country text,Year_Join int,Age int)CREATE TABLE exhibition_record (Exhibition_ID int,Date text,Attendance int)
SELECT T1.Date, T1.Attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.Exhibition_ID = T2.Exhibition_ID WHERE T2.Year = 2004 ORDER BY Attendance
how many networks does televisa own ?
CREATE TABLE table_204_779 (id number,"network name" text,"flagship" text,"programming type" text,"owner" text,"affiliates" number)
SELECT COUNT("network name") FROM table_204_779 WHERE "owner" = 'televisa'
did any organisms be found in the first peripheral blood lymphocytes microbiology test done on patient 10624 in 12/2105?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime t...
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10624) AND microbiologyevents.spec_type_desc = 'peripheral blood lymphocytes' AND NOT microbiologyevents.org_name IS NULL AND STRFTIME('%y-%m', microbiologyevents.char...
how many white-russian patients were given the drug metoprolol?
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 ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND prescriptions.drug = "Metoprolol"
has patient 95892 been diagnosed with a disease in their last hospital visit?
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title tex...
SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95892 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)
what is the sanskrit of western star name arcturus
CREATE TABLE table_23561 ("#" real,"Sanskrit" text,"Malayalam name \u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02" text,"Tamil name \u0ba4\u0bae\u0bbf\u0bb4\u0bcd" text,"Telugu name \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41" text,"Kannada name \u0c95\u0ca8\u0ccd\u0ca8\u0ca1" text,"Western star name" text)
SELECT "Sanskrit" FROM table_23561 WHERE "Western star name" = 'Arcturus'
What was the diameter of the feature found in 1997?
CREATE TABLE table_72806 ("Name" text,"Latitude" text,"Longitude" text,"Diameter (km)" text,"Year named" real,"Name origin" text)
SELECT "Diameter (km)" FROM table_72806 WHERE "Year named" = '1997'
What's the D 42 when D 43 is r 5?
CREATE TABLE table_name_13 (d_42_√ VARCHAR,d_43_√ VARCHAR)
SELECT d_42_√ FROM table_name_13 WHERE d_43_√ = "r 5"
Tell me the region for georgia
CREATE TABLE table_name_8 (region VARCHAR,state VARCHAR)
SELECT region FROM table_name_8 WHERE state = "georgia"
what is the maximum age of male patients admitted to emergency?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)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)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marita...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.admission_type = "EMERGENCY"
What was the date of birth of the member of the United States House of Representatives that began their term on April 24, 1902?
CREATE TABLE table_32058 ("Begin Date" text,"Representative" text,"Date of birth" text,"House term" text,"State served" text,"Party" text,"Age (years,days)" text)
SELECT "Date of birth" FROM table_32058 WHERE "Begin Date" = 'april 24, 1902'
Which Score has a Place of t6, and a Player of raymond floyd?
CREATE TABLE table_name_43 (score VARCHAR,place VARCHAR,player VARCHAR)
SELECT score FROM table_name_43 WHERE place = "t6" AND player = "raymond floyd"
What is the attendance for week 11?
CREATE TABLE table_33756 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Record" text,"Attendance" real)
SELECT "Attendance" FROM table_33756 WHERE "Week" = '11'
What years did the player play when he scored 78 points and 22 goals?
CREATE TABLE table_33866 ("Rank" text,"Player" text,"Goals" text,"Assists" text,"Points" text,"Years" text)
SELECT "Years" FROM table_33866 WHERE "Points" = '78' AND "Goals" = '22'
When the new orleans saints were visiting texas stadium, what was the final score?
CREATE TABLE table_51361 ("Date" text,"Visiting Team" text,"Final Score" text,"Host Team" text,"Stadium" text)
SELECT "Final Score" FROM table_51361 WHERE "Stadium" = 'texas stadium' AND "Visiting Team" = 'new orleans saints'
what score is it with tathiana garbin as partner?
CREATE TABLE table_69705 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Partner" text,"Score" text)
SELECT "Score" FROM table_69705 WHERE "Partner" = 'tathiana garbin'
When was there a team of Simon and the start was 3?
CREATE TABLE table_name_48 (year VARCHAR,team VARCHAR,start VARCHAR)
SELECT year FROM table_name_48 WHERE team = "simon" AND start = "3"
Whah are the name of each industry and the number of companies in that industry?
CREATE TABLE companies (id number,name text,headquarters text,industry text,sales_billion number,profits_billion number,assets_billion number,market_value_billion text)CREATE TABLE buildings (id number,name text,city text,height number,stories number,status text)CREATE TABLE office_locations (building_id number,company...
SELECT industry, COUNT(*) FROM companies GROUP BY industry
What is the name of the racer with a best time of 57.546?
CREATE TABLE table_44712 ("Name" text,"Team" text,"Qual 1" text,"Qual 2" text,"Best" text)
SELECT "Name" FROM table_44712 WHERE "Best" = '57.546'
With a FA Cup of 0 44 0 (0), the other [C] is listed as what?
CREATE TABLE table_name_46 (other_ VARCHAR,c_ VARCHAR,fa_cup VARCHAR)
SELECT other_ AS "c_" FROM table_name_46 WHERE fa_cup = "0 44 0 (0)"
what flights are there from PHOENIX to MILWAUKEE
CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion va...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHOENIX' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MILWAU...
Who won Funny Car in 2012?
CREATE TABLE table_45046 ("Year" real,"Top Fuel" text,"Funny Car" text,"Pro Stock" text,"Pro Stock Motorcycle" text)
SELECT "Funny Car" FROM table_45046 WHERE "Year" = '2012'
patient 11688 had received a rheumatoid arthritis diagnosis in the last year?
CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE d_icd_procedur...
SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'rheumatoid arthritis') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 11688) AND DATETIME(diagnoses_ic...
Which Line has a Stopping pattern of all stations, A, b, p?
CREATE TABLE table_45386 ("Stop no." text,"Platform" text,"Line" text,"Stopping pattern" text,"Destination" text)
SELECT "Line" FROM table_45386 WHERE "Stopping pattern" = 'all stations, a, b, p'
how many members of the canadian house of commons served in the militia ?
CREATE TABLE table_204_608 (id number,"name" text,"elected party" text,"constituency" text,"elected date" text,"military service" text)
SELECT COUNT("name") FROM table_204_608 WHERE "military service" = 'militia'
What is the Weight of the Spandau 04 Player with a Height of m (ft 5in)?
CREATE TABLE table_name_61 (weight VARCHAR,club VARCHAR,height VARCHAR)
SELECT weight FROM table_name_61 WHERE club = "spandau 04" AND height = "m (ft 5in)"
count of questions with an accepted answer which is outvoted and not authored by the OP.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostNoticeTypes ...
SELECT COUNT(q.Id) FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id WHERE q.PostTypeId = 1 AND q.Score > 10 AND (SELECT MAX(Score) FROM Posts AS q2 WHERE q.Id = q2.ParentId) > a.Score AND q.OwnerUserId != a.OwnerUserId
during the last hospital encounter, was there any microbiological test record for patient 20165's tissue?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE prescriptions (row_id number,subject_id n...
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 20165 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND microbiologyevents.spec_type_desc = 'tissue'
Who was the visiting team at the Chicago home game?
CREATE TABLE table_name_30 (visitor VARCHAR,home VARCHAR)
SELECT visitor FROM table_name_30 WHERE home = "chicago"
What is the Hanyu Pinyin with a density of 39.63?
CREATE TABLE table_53433 ("Name" text,"Hanzi" text,"Hanyu Pinyin" text,"Uyghur (UEY)" text,"Uyghur Latin (ULY)" text,"Population (2010 Census)" text,"Area (km\u00b2)" text,"Density (/km\u00b2)" text)
SELECT "Hanyu Pinyin" FROM table_53433 WHERE "Density (/km\u00b2)" = '39.63'