instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
I want to know the final score for december 27
CREATE TABLE table_name_74 (final_score VARCHAR,date VARCHAR)
SELECT final_score FROM table_name_74 WHERE date = "december 27"
When the away team was geelong, what was the away team score?
CREATE TABLE table_name_7 (away_team VARCHAR)
SELECT away_team AS score FROM table_name_7 WHERE away_team = "geelong"
Name the tries that has a points of 008 8 and games of 27 27
CREATE TABLE table_69714 ("Player" text,"Games" text,"Tries" text,"Goals" text,"F. Goals" text,"Points" text)
SELECT "Tries" FROM table_69714 WHERE "Points" = '008 8' AND "Games" = '27 27'
What is the highest Amerindian (Hispanic/Non-Hispanic) value having a Black (Hispanic/Non-Hispanic) of 15.7 and White (Hispanic/Non-Hispanic) over 69.5?
CREATE TABLE table_name_67 (amerindian__both_hispanic_and_non_hispanic_ INTEGER,black__both_hispanic_and_non_hispanic_ VARCHAR,white__both_hispanic_and_non_hispanic_ VARCHAR)
SELECT MAX(amerindian__both_hispanic_and_non_hispanic_) FROM table_name_67 WHERE black__both_hispanic_and_non_hispanic_ = 15.7 AND white__both_hispanic_and_non_hispanic_ > 69.5
Which Venue has a crowd larger than 25,000?
CREATE TABLE table_name_83 (away_team VARCHAR,crowd INTEGER)
SELECT away_team FROM table_name_83 WHERE crowd > 25 OFFSET 000
Who is the winner of the H.E.B. Texas open?
CREATE TABLE table_name_76 (winner VARCHAR,tournament VARCHAR)
SELECT winner FROM table_name_76 WHERE tournament = "h.e.b. texas open"
WHAT IS THE RESULT FOR best urban/alternative performance, IN 2003 OR GREATER?
CREATE TABLE table_name_1 (result VARCHAR,category VARCHAR,year VARCHAR)
SELECT result FROM table_name_1 WHERE category = "best urban/alternative performance" AND year > 2003
What was the score for the game with a record of 11-22 and a H/A/N of A?
CREATE TABLE table_name_60 (score VARCHAR,h_a_n VARCHAR,record VARCHAR)
SELECT score FROM table_name_60 WHERE h_a_n = "a" AND record = "11-22"
What is the average goals against for teams with more than 56 goals for and exactly 50 points?
CREATE TABLE table_name_20 (goals_against INTEGER,points_1 VARCHAR,goals_for VARCHAR)
SELECT AVG(goals_against) FROM table_name_20 WHERE points_1 = "50" AND goals_for > 56
tell me the top five of the most common intakes in 2101?
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 chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom 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) = '2101' GROUP BY inputevents_cv.itemid) AS t1 WHERE t1.c1 <= 5)
What is the score from the winner Keith Clearwater (1)?
CREATE TABLE table_name_60 (score VARCHAR,winner VARCHAR)
SELECT score FROM table_name_60 WHERE winner = "keith clearwater (1)"
what is age of subject id 3343?
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 demographic.age FROM demographic WHERE demographic.subject_id = "3343"
What rank has less than 16 gold, more than 2 bronze and silver, and a total of 14?
CREATE TABLE table_name_44 (rank VARCHAR,total VARCHAR,silver VARCHAR,gold VARCHAR,bronze VARCHAR)
SELECT rank FROM table_name_44 WHERE gold < 16 AND bronze > 2 AND silver > 2 AND total = 14
what are the four most frequently prescribed drugs for patients also prescribed with amlodipine besylate at the same time, in 2105?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)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 t...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'amlodipine besylate' AND STRFTIME('%y', prescriptions.startdate) ...
Who directed an episode with 1.19 million?
CREATE TABLE table_31042 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (million)" text)
SELECT "Directed by" FROM table_31042 WHERE "U.S. viewers (million)" = '1.19'
What is Howard Payne University's total enrollment?
CREATE TABLE table_42726 ("Institution name" text,"City/ town" text,"State/ province" text,"Total enrollment" text,"Year founded" real)
SELECT "Total enrollment" FROM table_42726 WHERE "Institution name" = 'howard payne university'
How many races were in fukuoka, japan?
CREATE TABLE table_28361 ("Road race" text,"Distance" text,"Location" text,"Country" text,"Month held" text)
SELECT COUNT("Road race") FROM table_28361 WHERE "Country" = 'Japan' AND "Location" = 'Fukuoka'
Which Altitude (mslm) is the highest one that has an Area (km 2) smaller than 13.01, and a Population of 74536, and a Density (inhabitants/km 2) larger than 5869?
CREATE TABLE table_75419 ("Rank" text,"City" text,"Population" real,"Area (km 2)" real,"Density (inhabitants/km 2)" real,"Altitude (mslm)" real)
SELECT MAX("Altitude (mslm)") FROM table_75419 WHERE "Area (km 2 )" < '13.01' AND "Population" = '74536' AND "Density (inhabitants/km 2 )" > '5869'
What is the lowest Division, when Goals are less than 10, when Team is Dalian Shide, when Apps are less than 17, and when Season is 2007?
CREATE TABLE table_42661 ("Season" text,"Team" text,"Country" text,"Division" real,"Apps" real,"Goals" real)
SELECT MIN("Division") FROM table_42661 WHERE "Goals" < '10' AND "Team" = 'dalian shide' AND "Apps" < '17' AND "Season" = '2007'
Which 2006 Tournament has a 2004, and a 2002 of not tier i?
CREATE TABLE table_37735 ("Tournament" text,"1999" text,"2000" text,"2001" text,"2002" text,"2003" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text)
SELECT "2006" FROM table_37735 WHERE "2004" = 'a' AND "2002" = 'not tier i'
Who is in the south-west next to Vishnu on the east, Durga on the west, and in the center of Ganapati?
CREATE TABLE table_50646 ("Center" text,"North East" text,"South East" text,"South West" text,"North West" text)
SELECT "South West" FROM table_50646 WHERE "North East" = 'vishnu' AND "North West" = 'durga' AND "Center" = 'ganapati'
What song is done by Terence Trent D'Arby?
CREATE TABLE table_39521 ("Volume:Issue" text,"Issue Date(s)" text,"Weeks on Top" real,"Song" text,"Artist" text)
SELECT "Song" FROM table_39521 WHERE "Artist" = 'terence trent d''arby'
What is the Place of the Player with a +3 To par?
CREATE TABLE table_name_19 (place VARCHAR,to_par VARCHAR)
SELECT place FROM table_name_19 WHERE to_par = "+3"
What is Tournament, when Result is 18th?
CREATE TABLE table_name_50 (tournament VARCHAR,result VARCHAR)
SELECT tournament FROM table_name_50 WHERE result = "18th"
What is the Year for fleet number 5000?
CREATE TABLE table_66251 ("Class" text,"Wheel arrangement" text,"Fleet number(s)" text,"Manufacturer" text,"Serial numbers" text,"Year made" text,"Quantity made" text,"Quantity preserved" text)
SELECT "Year made" FROM table_66251 WHERE "Fleet number(s)" = '5000'
Posts and Votes of a user.
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,Ans...
SELECT p.Id AS postid, p.CreationDate, p.Title, p.Body, v.Id AS voteid, t.Name AS votetype, v.UserId, u.DisplayName, v.CreationDate FROM Posts AS p LEFT JOIN Votes AS v ON p.Id = v.PostId LEFT JOIN VoteTypes AS t ON v.VoteTypeId = t.Id LEFT JOIN Users AS u ON v.UserId = u.Id WHERE p.OwnerUserId = '##UserId##' ORDER BY ...
Users with the highest total comment score.
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE Posts (Id number,...
SELECT SUM(Score), UserId AS "user_link", UserDisplayName FROM Comments GROUP BY UserId, UserDisplayName ORDER BY SUM(Score) DESC LIMIT 100
what year has general nominated in the category or choice breakthrough artist?
CREATE TABLE table_name_77 (year VARCHAR,nominated_work VARCHAR,category VARCHAR)
SELECT COUNT(year) FROM table_name_77 WHERE nominated_work = "general" AND category = "choice breakthrough artist"
Name the incelandic of the glossary for 218
CREATE TABLE table_608 ("Word number" text,"The Basque of the glossary" text,"Modern Basque" text,"The Icelandic of the glossary" text,"English translation" text)
SELECT "The Icelandic of the glossary" FROM table_608 WHERE "Word number" = '218'
What is the height with more than 2 HC climbs more recent than 2012, less than 48 times visited, and a first HC climb in 1989?
CREATE TABLE table_name_69 (height__m_ VARCHAR,first_time_as_hc_climb VARCHAR,no_of_times_visited VARCHAR,no_of_hc_climbs VARCHAR,most_recent VARCHAR)
SELECT height__m_ FROM table_name_69 WHERE no_of_hc_climbs > 2 AND most_recent = 2012 AND no_of_times_visited < 48 AND first_time_as_hc_climb = 1989
What argon has a neon of 10.5?
CREATE TABLE table_name_51 (argon VARCHAR,neon VARCHAR)
SELECT argon FROM table_name_51 WHERE neon = "10.5"
What is the average number of games drawn among teams that played over 14 games?
CREATE TABLE table_64521 ("Position" real,"Name" text,"Played" real,"Drawn" real,"Lost" real,"Points" real)
SELECT AVG("Drawn") FROM table_64521 WHERE "Played" > '14'
Show me a bar chart about the number of races held in each year after 2014, sort from high to low by the y axis.
CREATE TABLE constructorStandings (constructorStandingsId INTEGER,raceId INTEGER,constructorId INTEGER,points REAL,position INTEGER,positionText TEXT,wins INTEGER)CREATE TABLE constructors (constructorId INTEGER,constructorRef TEXT,name TEXT,nationality TEXT,url TEXT)CREATE TABLE qualifying (qualifyId INTEGER,raceId IN...
SELECT year, COUNT(year) FROM races AS T1 JOIN results AS T2 ON T1.raceId = T2.raceId WHERE T1.year > 2014 ORDER BY COUNT(year) DESC
bring the number of patients who are administered drug via iv drip and have been diagnosed with short title hamartorses nec.
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Hamartoses NEC" AND prescriptions.route = "IV DRIP"
what is the number of elective hospital admission patients who were hospitalized for more than 11 days?
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 WHERE demographic.admission_type = "ELECTIVE" AND demographic.days_stay > "11"
What country hosts the tournament the open championship?
CREATE TABLE table_72639 ("Date" text,"Tournament" text,"Player" text,"Country" text,"Rounds" text,"Score" real,"To par" text,"Finish" text)
SELECT "Country" FROM table_72639 WHERE "Tournament" = 'The Open Championship'
How many of the episodes in the top 50 rankings were originally aired on June 28, 2010?
CREATE TABLE table_24824 ("Episode number" real,"Title" text,"Original airing" text,"Timeslot" text,"Viewers" real,"Top 50 Ranking" real,"Scripted Show Ranking" real)
SELECT COUNT("Top 50 Ranking") FROM table_24824 WHERE "Original airing" = 'June 28, 2010'
Which Score has a Place of 4?
CREATE TABLE table_49942 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text,"Money ($)" real)
SELECT "Score" FROM table_49942 WHERE "Place" = '4'
Which Nation has a Second of tomas pitonak?
CREATE TABLE table_39137 ("Nation" text,"Skip" text,"Third" text,"Second" text,"Lead" text)
SELECT "Nation" FROM table_39137 WHERE "Second" = 'tomas pitonak'
how many people were diagnosed with sepsis during the same hospital encounter after being diagnosed with metabolic acidosis?
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 tim...
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 = 'sepsis') AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosistime, p...
users letting Facebook track you through their avatars.
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body te...
SELECT u.ProfileImageUrl FROM Users AS u LIMIT 100
how many patients marital status is married and are below 31 years of age?
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 WHERE demographic.marital_status = "MARRIED" AND demographic.age < "31"
What is the location of the match on February 29, 2012?
CREATE TABLE table_70333 ("Date" text,"Location" text,"Score" text,"Scorers for Chad" text,"Competition" text)
SELECT "Location" FROM table_70333 WHERE "Date" = 'february 29, 2012'
how many players weighed more than 200 pounds ?
CREATE TABLE table_204_170 (id number,"player" text,"position" text,"games\nstarted" text,"hometown" text,"height" text,"weight" number,"age" number)
SELECT COUNT("player") FROM table_204_170 WHERE "weight" > 200
What was the result of the playoffs when the regular season was 7th, southeast
CREATE TABLE table_1214035_1 (playoffs VARCHAR,regular_season VARCHAR)
SELECT playoffs FROM table_1214035_1 WHERE regular_season = "7th, Southeast"
according to the list of alpine peaks by prominence , is pizzo di coca more/less than 2000 m ?
CREATE TABLE table_204_84 (id number,"no" number,"peak" text,"location" text,"elevation (m)" number,"prominence (m)" number,"col height (m)" number,"col location" text,"parent" text)
SELECT (SELECT "prominence (m)" FROM table_204_84 WHERE "peak" = 'pizzo di coca') > 2000
Plot how many booking start date by grouped by booking start date as a bar graph, display by the total number from high to low please.
CREATE TABLE Apartments (apt_id INTEGER,building_id INTEGER,apt_type_code CHAR(15),apt_number CHAR(10),bathroom_count INTEGER,bedroom_count INTEGER,room_count CHAR(5))CREATE TABLE Apartment_Facilities (apt_id INTEGER,facility_code CHAR(15))CREATE TABLE Apartment_Bookings (apt_booking_id INTEGER,apt_id INTEGER,guest_id ...
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings ORDER BY COUNT(booking_start_date) DESC
What was the date for Game 41?
CREATE TABLE table_46155 ("Game" text,"Date" text,"Opponent" text,"Score" text,"Location/Attendance" text,"Record" text)
SELECT "Date" FROM table_46155 WHERE "Game" = '41'
Where was the game played where Collingwood was the away team?
CREATE TABLE table_name_99 (venue VARCHAR,away_team VARCHAR)
SELECT venue FROM table_name_99 WHERE away_team = "collingwood"
Show all the actual delivery dates and bin by weekday in a bar chart.
CREATE TABLE Bookings (Booking_ID INTEGER,Customer_ID INTEGER,Workshop_Group_ID VARCHAR(100),Status_Code CHAR(15),Store_ID INTEGER,Order_Date DATETIME,Planned_Delivery_Date DATETIME,Actual_Delivery_Date DATETIME,Other_Order_Details VARCHAR(255))CREATE TABLE Ref_Service_Types (Service_Type_Code CHAR(15),Parent_Service_T...
SELECT Actual_Delivery_Date, COUNT(Actual_Delivery_Date) FROM Bookings
How is the bleeding time wherein platelet count is decreased and prothrombin time is unaffected?
CREATE TABLE table_20136 ("Condition" text,"Prothrombin time" text,"Partial thromboplastin time" text,"Bleeding time" text,"Platelet count" text)
SELECT "Bleeding time" FROM table_20136 WHERE "Platelet count" = 'Decreased' AND "Prothrombin time" = 'Unaffected'
What was the record after game 37?
CREATE TABLE table_76386 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "Record" FROM table_76386 WHERE "Game" = '37'
What is the background of the person fired in week 5?
CREATE TABLE table_24501530_1 (background VARCHAR,result VARCHAR)
SELECT background FROM table_24501530_1 WHERE result = "Fired in week 5"
What is the average SP+FS for Denise Biellmann, and a Rank larger than 5?
CREATE TABLE table_name_14 (fs VARCHAR,sp INTEGER,name VARCHAR,rank VARCHAR)
SELECT AVG(sp) + fs FROM table_name_14 WHERE name = "denise biellmann" AND rank > 5
How many atp wins did he have when his money list rank was 4?
CREATE TABLE table_25420 ("Year" real,"Majors" real,"ATP wins" real,"Total wins" real,"Earnings ($)" real,"Money list rank" real)
SELECT MAX("ATP wins") FROM table_25420 WHERE "Money list rank" = '4'
What Interview subject was on a Date that is 11-92?
CREATE TABLE table_name_42 (interview_subject VARCHAR,date VARCHAR)
SELECT interview_subject FROM table_name_42 WHERE date = "11-92"
how long was the first stay in the intensive care unit of patient 009-1746?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE diagnosis...
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-1746') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime LIMIT 1
What was time of the game against the Royals with a record of 81 73?
CREATE TABLE table_name_4 (time VARCHAR,opponent VARCHAR,record VARCHAR)
SELECT time FROM table_name_4 WHERE opponent = "royals" AND record = "81–73"
What was the Away team score against a home team with 5.12 (42)?
CREATE TABLE table_32931 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team score" FROM table_32931 WHERE "Home team score" = '5.12 (42)'
What is the fewest games lost by Paulistano with more than 39 points?
CREATE TABLE table_name_85 (lost INTEGER,team VARCHAR,points VARCHAR)
SELECT MIN(lost) FROM table_name_85 WHERE team = "paulistano" AND points > 39
how many people died after being diagnosed with acute coronary syndrome - acute myocardial infarction (no st elevation) during the same hospital visit since 2102?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiasto...
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 = ...
Record of 0 8 had what result?
CREATE TABLE table_37638 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Record" text,"Game Site" text,"Attendance" text)
SELECT "Result" FROM table_37638 WHERE "Record" = '0–8'
Name the townland for fermoy and ballynoe
CREATE TABLE table_30120664_1 (townland VARCHAR,poor_law_union VARCHAR,civil_parish VARCHAR)
SELECT townland FROM table_30120664_1 WHERE poor_law_union = "Fermoy" AND civil_parish = "Ballynoe"
Who were the opponents in the final when the game was played on hard surface and the score of the final was 6 1, 1 6, 7 6(4)?
CREATE TABLE table_7729 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponents in Final" text,"Score in Final" text)
SELECT "Opponents in Final" FROM table_7729 WHERE "Surface" = 'hard' AND "Score in Final" = '6–1, 1–6, 7–6(4)'
how many hours have passed since the last time that patient 2957 stayed during the current hospital encounter in the ward 57?
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 d_labitems (row_id number,itemid number,label text)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,sp...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2957 AND admissions.dischtime IS NULL)) AND transfers....
What's the latest original air date with more than 10 episodes and a DVD Region 2 release date of 23 april 2012?
CREATE TABLE table_45279 ("Series Number" real,"Number of Episodes" real,"Original Air Date" real,"DVD Region 2 release date" text,"DVD Region 1 release date" text)
SELECT MAX("Original Air Date") FROM table_45279 WHERE "DVD Region 2 release date" = '23 april 2012' AND "Number of Episodes" > '10'
What's the hometown of the player with a college of lsu?
CREATE TABLE table_name_51 (hometown VARCHAR,college VARCHAR)
SELECT hometown FROM table_name_51 WHERE college = "lsu"
Before taking ORGSTUDY 201 , what courses must I take ?
CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)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)CREATE TABLE gsi (course_offering_id int,student...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT...
How many laps where the position is 10th and the races is smaller than 9.0?
CREATE TABLE table_27538 ("Season" text,"Series" text,"Team" text,"Races" real,"Wins" real,"Poles" real,"F/Laps" real,"Podiums" real,"Points" text,"Position" text)
SELECT COUNT("F/Laps") FROM table_27538 WHERE "Position" = '10th' AND "Races" < '9.0'
What is the title with the production number greater than 1334 released on 1955-08-27?
CREATE TABLE table_name_65 (title VARCHAR,production_number VARCHAR,release_date VARCHAR)
SELECT title FROM table_name_65 WHERE production_number > 1334 AND release_date = "1955-08-27"
What Viewers (m) has a Rating of 1.7, and an Episode of the game of life?
CREATE TABLE table_61322 ("Episode" text,"18-49" text,"Viewers (m)" real,"Rating" text,"Share" text)
SELECT MAX("Viewers (m)") FROM table_61322 WHERE "Rating" = '1.7' AND "Episode" = 'the game of life'
What grand finalist had a year after 1979, a margin smaller than 30, and winners of essendon?
CREATE TABLE table_name_89 (grand_finalist VARCHAR,winners VARCHAR,year VARCHAR,margin VARCHAR)
SELECT grand_finalist FROM table_name_89 WHERE year > 1979 AND margin < 30 AND winners = "essendon"
Which state has the greatest total number of bank customers?
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,state text)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 ...
SELECT state FROM bank GROUP BY state ORDER BY SUM(no_of_customers) DESC LIMIT 1
which player came in first place ?
CREATE TABLE table_203_555 (id number,"place" text,"player" text,"country" text,"score" text,"to par" number,"money ($)" number)
SELECT "player" FROM table_203_555 WHERE "place" = 1
Name the resolution with dish of 8126
CREATE TABLE table_79816 ("Dish" text,"Callsign" text,"Network" text,"Resolution" text,"City of License" text,"Official Website" text)
SELECT "Resolution" FROM table_79816 WHERE "Dish" = '8126'
list the opponents which are under the friendly competition .
CREATE TABLE table_203_537 (id number,"#" number,"date" text,"venue" text,"opponent" text,"score" text,"result" text,"competition" text)
SELECT "opponent" FROM table_203_537 WHERE "competition" = 'friendly'
count the number of times that patient 007-849 had had an intake of prbcs this month.
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,tr...
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-849')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.cell...
For each year, bin the year into day of the week interval, and return the average of the number of times the team Boston Red Stockings won in the postseasons using a line chart, show by the x-axis from low to high.
CREATE TABLE player_college (player_id TEXT,college_id TEXT,year INTEGER)CREATE TABLE park (park_id TEXT,park_name TEXT,park_alias TEXT,city TEXT,state TEXT,country TEXT)CREATE TABLE appearances (year INTEGER,team_id TEXT,league_id TEXT,player_id TEXT,g_all NUMERIC,gs NUMERIC,g_batting INTEGER,g_defense NUMERIC,g_p INT...
SELECT year, AVG(COUNT(*)) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' ORDER BY year
Questions posted in a given year without a bounty.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE FlagTypes (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,Las...
SELECT COUNT(*) FROM Posts AS p WHERE Id NOT IN (SELECT PostId FROM Votes AS v WHERE v.VoteTypeId = 8) AND p.CreationDate > '2015-05-01' AND p.PostTypeId = 1 AND (p.Score >= 2 AND p.Score <= 9) AND (p.ViewCount >= 77 AND p.ViewCount <= 628) AND p.ClosedDate IS NULL AND p.FavoriteCount >= 1 AND NOT p.AcceptedAnswerId IS...
What episode was first aired in 1976?
CREATE TABLE table_name_85 (episode VARCHAR,first_aired VARCHAR)
SELECT episode FROM table_name_85 WHERE first_aired = "1976"
Where was the friendly competition that Andriy Yarmolenko won on 28 may 2012?
CREATE TABLE table_61379 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text)
SELECT "Venue" FROM table_61379 WHERE "Result" = 'won' AND "Competition" = 'friendly' AND "Date" = '28 may 2012'
Which Surface has an Outcome of runner-up, and a Score in the final of 4 6, 6 7, 6 2, 2 6?
CREATE TABLE table_name_87 (surface VARCHAR,outcome VARCHAR,score_in_the_final VARCHAR)
SELECT surface FROM table_name_87 WHERE outcome = "runner-up" AND score_in_the_final = "4–6, 6–7, 6–2, 2–6"
Users with the highest reputation per answers and questions count ratio. To find your own ratio, go here: https://data.stackexchange.com/stackoverflow/query/384546/users-reputation-per-answers-and-questions-count-ratio
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE Comments (Id number,PostId number,Score number,T...
SELECT u.Id AS "user_link", u.DisplayName, u.Reputation, COUNT(p.Id) AS "posts_count", (CAST(u.Reputation AS FLOAT) / CAST(COUNT(p.Id) AS FLOAT)) AS "ratio" FROM Users AS u LEFT JOIN Posts AS p ON u.Id = p.OwnerUserId WHERE p.PostTypeId = 1 OR p.PostTypeId = 2 GROUP BY u.Id, u.DisplayName, u.Reputation HAVING COUNT(p.I...
How many years had a Venue of eindhoven?
CREATE TABLE table_65368 ("Year" real,"Competition" text,"Venue" text,"Position" text,"Notes" text)
SELECT COUNT("Year") FROM table_65368 WHERE "Venue" = 'eindhoven'
What is the largest enrollment for anglican day schools founded after 1929?
CREATE TABLE table_58000 ("School" text,"Location" text,"Enrolment" real,"Founded" real,"Denomination" text,"Day/Boarding" text,"School Colours" text,"Abbreviation" text,"In competition since" real)
SELECT MAX("Enrolment") FROM table_58000 WHERE "Denomination" = 'anglican' AND "Day/Boarding" = 'day' AND "Founded" > '1929'
In what series did Bobby Labonte drive?
CREATE TABLE table_25146455_1 (series VARCHAR,driver VARCHAR)
SELECT series FROM table_25146455_1 WHERE driver = "Bobby Labonte"
What number was Rashad McCants?
CREATE TABLE table_name_82 (number VARCHAR,name VARCHAR)
SELECT number FROM table_name_82 WHERE name = "rashad mccants"
Which manufacturer has 8 laps?
CREATE TABLE table_45527 ("Rider" text,"Manufacturer" text,"Laps" text,"Time/Retired" text,"Grid" text)
SELECT "Manufacturer" FROM table_45527 WHERE "Laps" = '8'
What was the sum of the years, when the entrant was Scuderia Ferrari, and when the Chassis was Ferrari 312/66?
CREATE TABLE table_name_68 (year INTEGER,entrant VARCHAR,chassis VARCHAR)
SELECT SUM(year) FROM table_name_68 WHERE entrant = "scuderia ferrari" AND chassis = "ferrari 312/66"
For each company id, what are the companies and how many gas stations does each one operate. Plot them as bar chart.
CREATE TABLE station_company (Station_ID int,Company_ID int,Rank_of_the_Year int)CREATE TABLE company (Company_ID int,Rank int,Company text,Headquarters text,Main_Industry text,Sales_billion real,Profits_billion real,Assets_billion real,Market_Value real)CREATE TABLE gas_station (Station_ID int,Open_Year int,Location t...
SELECT Company, COUNT(*) FROM station_company AS T1 JOIN company AS T2 ON T1.Company_ID = T2.Company_ID GROUP BY T1.Company_ID
how many stars have a distance at maximum of 30 light years or higher ?
CREATE TABLE table_203_56 (id number,"star" text,"start\nyear" number,"end\nyear" number,"maximum\nyear" number,"maximum\nmagnitude" number,"distance at\nmaximum (ly)" number,"current\ndistance" number,"current\nmagnitude" number)
SELECT COUNT("star") FROM table_203_56 WHERE "distance at\nmaximum (ly)" >= 30
who directed the episode with the original air date of November 22, 1989?
CREATE TABLE table_18367694_2 (directed_by VARCHAR,original_air_date VARCHAR)
SELECT directed_by FROM table_18367694_2 WHERE original_air_date = "November 22, 1989"
what song took last place ?
CREATE TABLE table_203_755 (id number,"singing position" number,"song title" text,"informal translation" text,"act" text,"percentage of votes" text,"final position" text)
SELECT "song title" FROM table_203_755 ORDER BY "final position" DESC LIMIT 1
what sort of ground transportation is there in WASHINGTON
CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,weight int,capacity int,pay_load int,cruising_speed int,range_miles int,pressurized varchar)CREATE TABLE time_interval (period text,...
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'WASHINGTON' AND ground_service.city_code = city.city_code
What country is Greg Norman from?
CREATE TABLE table_name_84 (country VARCHAR,player VARCHAR)
SELECT country FROM table_name_84 WHERE player = "greg norman"
Show the number of documents for each location code in a bar chart, and I want to rank by the y axis in desc.
CREATE TABLE Document_Locations (Document_ID INTEGER,Location_Code CHAR(15),Date_in_Location_From DATETIME,Date_in_Locaton_To DATETIME)CREATE TABLE All_Documents (Document_ID INTEGER,Date_Stored DATETIME,Document_Type_Code CHAR(15),Document_Name CHAR(255),Document_Description CHAR(255),Other_Details VARCHAR(255))CREATE...
SELECT Location_Code, COUNT(Location_Code) FROM Document_Locations GROUP BY Location_Code ORDER BY COUNT(Location_Code) DESC
What country has the label Control?
CREATE TABLE table_12176 ("Country" text,"Date" text,"Label" text,"Format" text,"Catalogue #" text)
SELECT "Country" FROM table_12176 WHERE "Label" = 'control'
calculate how many times since 2105 patient 9241 has received the insert endotracheal tube procedure.
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE labevents (row_id number,subject_id number,h...
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 = 'insert endotracheal tube') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9241) AND STRFTIME('%y', p...
Visualize a bar chart for what is average age for different job title?, I want to show from low to high by the the average of age.
CREATE TABLE PersonFriend (name varchar(20),friend varchar(20),year INTEGER)CREATE TABLE Person (name varchar(20),age INTEGER,city TEXT,gender TEXT,job TEXT)
SELECT job, AVG(age) FROM Person GROUP BY job ORDER BY AVG(age)
For a total of 1 and the sport of softball what were the years?
CREATE TABLE table_name_93 (years VARCHAR,total VARCHAR,sport VARCHAR)
SELECT years FROM table_name_93 WHERE total = "1" AND sport = "softball"