instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Top users from Barcelona, Spain. | 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)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE T... | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE (LOWER(Location) LIKE '%barcelona%' OR LOWER(Location) LIKE '%bcn%') ORDER BY Reputation DESC |
Who won the Women's singles, in the year that Raymond M. White won the Men's singles and that W. Hamilton Ian Maconachie won the Men's doubles? | CREATE TABLE table_80381 ("Year" text,"Men's singles" text,"Women's singles" text,"Men's doubles" text,"Women's doubles" text,"Mixed doubles" text) | SELECT "Women's singles" FROM table_80381 WHERE "Men's singles" = 'raymond m. white' AND "Men's doubles" = 'w. hamilton ian maconachie' |
What was the record on december 8 when the boston bruins visited? | CREATE TABLE table_5386 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text) | SELECT "Record" FROM table_5386 WHERE "Visitor" = 'boston bruins' AND "Date" = 'december 8' |
how many patients were diagnosed with s/p hip surgery and did not come to the hospital within the same month in the last year? | CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE lab (labid number,patientunitstayid num... | SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 's/p hip surgery' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), '... |
What's the number of the game played on January 2, 1936? | CREATE TABLE table_39660 ("Number" real,"Result" text,"Date" text,"Score" text,"Opponent" text,"Record" text) | SELECT MIN("Number") FROM table_39660 WHERE "Date" = 'january 2, 1936' |
has patient 7107 had a potassium test during this month? | 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_items (row_id number,itemid number,label text,linksto text)C... | SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'potassium') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7107) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME... |
Home for away of hispano? | CREATE TABLE table_48380 ("Date" text,"Home" text,"Score" text,"Away" text,"Attendance" real) | SELECT "Home" FROM table_48380 WHERE "Away" = 'hispano' |
Which Film has a Result of nominated, and a Year of 2001? | CREATE TABLE table_35213 ("Year" real,"Group" text,"Award" text,"Film" text,"Result" text) | SELECT "Film" FROM table_35213 WHERE "Result" = 'nominated' AND "Year" = '2001' |
What is Date, when Attendance is less than 521? | CREATE TABLE table_name_43 (date VARCHAR,attendance INTEGER) | SELECT date FROM table_name_43 WHERE attendance < 521 |
what are the five most commonly prescribed medications since 2100? | 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)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob ... | SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE STRFTIME('%y', prescriptions.startdate) >= '2100' GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 5 |
What is the Venue of the Friendly Competition with a Score of 1 4? | CREATE TABLE table_name_58 (venue VARCHAR,competition VARCHAR,score VARCHAR) | SELECT venue FROM table_name_58 WHERE competition = "friendly" AND score = "1–4" |
specify the marital status of patient id 18480 | 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 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,marita... | SELECT demographic.marital_status FROM demographic WHERE demographic.subject_id = "18480" |
What is the average Heat for anjelika solovieva? | CREATE TABLE table_name_38 (heat INTEGER,name VARCHAR) | SELECT AVG(heat) FROM table_name_38 WHERE name = "anjelika solovieva" |
What is Country, when Score is 71-71-69=211? | CREATE TABLE table_51136 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text) | SELECT "Country" FROM table_51136 WHERE "Score" = '71-71-69=211' |
When were the ships launched that were laid down on september 1, 1964? | CREATE TABLE table_14 ("#" text,"Shipyard" text,"Laid down" text,"Launched" text,"Commissioned" text,"Fleet" text,"Status" text) | SELECT "Launched" FROM table_14 WHERE "Laid down" = 'September 1, 1964' |
What is the number of GEO IDs for areas in Riggin township with water area over 0.587 sq mi and ANSI codes over 1759257? | CREATE TABLE table_name_28 (geo_id VARCHAR,ansi_code VARCHAR,water__sqmi_ VARCHAR,township VARCHAR) | SELECT COUNT(geo_id) FROM table_name_28 WHERE water__sqmi_ > 0.587 AND township = "riggin" AND ansi_code > 1759257 |
List all the name of organizations in order of the date formed. | CREATE TABLE organizations (organization_name VARCHAR,date_formed VARCHAR) | SELECT organization_name FROM organizations ORDER BY date_formed |
what kind of aircraft is used on the FIRST class AA flight from PHILADELPHIA to SAN FRANCISCO stopping in DALLAS | CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE flight_stop (flight_id int,stop_number int,stop_days text,stop_airport text,arrival_time int,arrival_airline text,arrival_flight_number int,departure_time int,departure_airline text,departure_flight_number int,stop_time int)CREATE TABLE e... | SELECT DISTINCT aircraft.aircraft_code FROM aircraft, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, equipment_sequence, fare, fare_basis, flight, flight_fare, flight_stop WHERE (((CITY_2.city_code = AIRPO... |
What is North American Release Date, when Japanese Release Date is '2011-06-23'? | CREATE TABLE table_name_17 (north_american_release_date VARCHAR,japanese_release_date VARCHAR) | SELECT north_american_release_date FROM table_name_17 WHERE japanese_release_date = "2011-06-23" |
What is the result when there's less than 2 goals? | CREATE TABLE table_40025 ("Goal" real,"Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text) | SELECT "Result" FROM table_40025 WHERE "Goal" < '2' |
List the name of musicals that do not have actors. | CREATE TABLE musical (musical_id number,name text,year number,award text,category text,nominee text,result text)CREATE TABLE actor (actor_id number,name text,musical_id number,character text,duration text,age number) | SELECT name FROM musical WHERE NOT musical_id IN (SELECT musical_id FROM actor) |
What date did the Boston Celtics play at Richfield Coliseum? | CREATE TABLE table_46302 ("Game" real,"Date" text,"Opponent" text,"Score" text,"Location" text,"Record" text) | SELECT "Date" FROM table_46302 WHERE "Location" = 'richfield coliseum' |
get the id of the patients who had been diagnosed with acute respiratory failure - due to inability to clear secretions in this year. | CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE medication (medicationid number,patient... | SELECT patient.uniquepid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'acute respiratory failure - due to inability to clear secretions' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year'... |
Who was placed fourth when third was Beijing Guoan and the winner was Dalian Wanda and wins total was 4? | CREATE TABLE table_17632217_2 (fourth_placed VARCHAR,total_wins VARCHAR,third_place VARCHAR,winners VARCHAR) | SELECT fourth_placed FROM table_17632217_2 WHERE third_place = "Beijing Guoan" AND winners = "Dalian Wanda" AND total_wins = 4 |
What was held in 2003/04 when Former Ranking Tournaments was in 2007/08? | CREATE TABLE table_69202 ("2003/ 04" text,"2004/ 05" text,"2007/ 08" text,"2009/ 10" text,"2010/ 11" text,"2011/ 12" text,"2012/ 13" text) | SELECT "2003/ 04" FROM table_69202 WHERE "2007/ 08" = 'former ranking tournaments' |
What is the registration of the station with a retained type and a station number of c03? | CREATE TABLE table_name_27 (registrations VARCHAR,type VARCHAR,station_number VARCHAR) | SELECT registrations FROM table_name_27 WHERE type = "retained" AND station_number = "c03" |
which team has had the most queensland cup premierships ? | CREATE TABLE table_204_661 (id number,"team" text,"location" text,"home ground" text,"first year in\nqld cup" number,"last year in\nqld cup" number,"qld cup\npremierships" text) | SELECT "team" FROM table_204_661 ORDER BY "qld cup\npremierships" DESC LIMIT 1 |
What is every value for Monday August 24 if Friday August 28 is 23' 22.25 96.864mph? | CREATE TABLE table_2887 ("Rank" real,"Rider" text,"Mon 24 Aug" text,"Tues 25 Aug" text,"Wed 26 Aug" text,"Thurs 27 Aug" text,"Fri 28 Aug" text) | SELECT "Mon 24 Aug" FROM table_2887 WHERE "Fri 28 Aug" = '23'' 22.25 96.864mph' |
What's the mascot in Huntington after the year 2000? | CREATE TABLE table_13771 ("School" text,"Location" text,"Mascot" text,"County" text,"Year joined" real,"Previous Conference" text,"Year Left" real,"Conference joined" text) | SELECT "Mascot" FROM table_13771 WHERE "Year Left" > '2000' AND "Location" = 'huntington' |
2006 of 10 4 is in which 2000? | CREATE TABLE table_name_85 (Id VARCHAR) | SELECT 2000 FROM table_name_85 WHERE 2006 = "10–4" |
What's the part number of the model with TDP of 2.9 (max.4.1~5.4) w? | CREATE TABLE table_26559 ("Model number" text,"Frequency" text,"L1 Cache" text,"FSB" text,"Mult." text,"Voltage" text,"TDP" text,"Socket" text,"Release date" text,"Part number(s)" text,"sSpec number" text) | SELECT "Part number(s)" FROM table_26559 WHERE "TDP" = '2.9 (Max.4.1~5.4) W' |
what is primary disease and diagnoses icd9 code of subject name bruce harris? | CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)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 ... | SELECT demographic.diagnosis, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Bruce Harris" |
Who is the auther when the english name was histories and eulogies of the sovereigns? | CREATE TABLE table_25014 ("English name" text,"Georgian name" text,"Transliteration" text,"Date" text,"Author" text,"Period covered" text) | SELECT "Author" FROM table_25014 WHERE "English name" = 'Histories and Eulogies of the Sovereigns' |
what is the number of patients with abnormal lab test status who were diagnosed with perforation of intestine? | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Perforation of intestine" AND lab.flag = "abnormal" |
What period has 0.25% as the other mozilla? | CREATE TABLE table_name_66 (period VARCHAR,other_mozilla VARCHAR) | SELECT period FROM table_name_66 WHERE other_mozilla = "0.25%" |
I want the sum of NGC number for spiral galaxy and right acension of 08h14m40.4s | CREATE TABLE table_55299 ("NGC number" real,"Object type" text,"Constellation" text,"Right ascension (J2000)" text,"Declination (J2000)" text,"Apparent magnitude" real) | SELECT SUM("NGC number") FROM table_55299 WHERE "Object type" = 'spiral galaxy' AND "Right ascension ( J2000 )" = '08h14m40.4s' |
The engine family MaxxForce 5 in the years produced 2007-current, have what cylinder layout? | CREATE TABLE table_26352332_4 (cylinder_layout VARCHAR,years_produced VARCHAR,engine_family VARCHAR) | SELECT cylinder_layout FROM table_26352332_4 WHERE years_produced = "2007-current" AND engine_family = "MaxxForce 5" |
count the number of patients whose discharge location is snf and primary disease is posterior communicating aneurysm/sda? | CREATE TABLE diagnoses (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 procedures (subject_id text,hadm_id text,icd9_code text,sho... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SNF" AND demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA" |
Name march 27-29 where january 15-16 is january 15, 1991 | CREATE TABLE table_21287 ("June 10-11" text,"March 27-29" text,"January 15-16" text,"November 3" text,"August 21-22" text) | SELECT "March 27-29" FROM table_21287 WHERE "January 15-16" = 'January 15, 1991' |
Who is the guard for Wisconsin? | CREATE TABLE table_51501 ("Pick" real,"Round" text,"Player" text,"Position" text,"School" text) | SELECT "Player" FROM table_51501 WHERE "Position" = 'guard' AND "School" = 'wisconsin' |
what is the number of patients whose marital status is single and diagnoses long title is bacterial pneumonia, unspecified? | 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 INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "SINGLE" AND diagnoses.long_title = "Bacterial pneumonia, unspecified" |
What position did the driver from Audi Sport North America finish in the race after 2008? | CREATE TABLE table_60297 ("Year" real,"Team" text,"Co-Drivers" text,"Class" text,"Laps" real,"Pos." text) | SELECT "Pos." FROM table_60297 WHERE "Team" = 'audi sport north america' AND "Year" > '2008' |
What's the tail number of the airplane involved in the accident described as crashed? | CREATE TABLE table_229917_2 (tail_number VARCHAR,brief_description VARCHAR) | SELECT tail_number FROM table_229917_2 WHERE brief_description = "Crashed" |
What was the time for the match that resulted in a loss in less than 3 rounds? | CREATE TABLE table_13516 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text) | SELECT "Time" FROM table_13516 WHERE "Res." = 'loss' AND "Round" < '3' |
Total Posts by Database Server Per Month - Oracle. | 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 CONCAT(YEAR(P.CreationDate), '-', MONTH(P.CreationDate)) AS YearMonth, 'Oracle' AS TagName, COUNT(*) AS PostCount FROM Posts AS P INNER JOIN PostTags AS PT ON (P.Id = PT.PostId) INNER JOIN Tags AS T ON (PT.TagId = T.Id) WHERE T.TagName LIKE 'oracle%' GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER BY ... |
Which show as previously on The Family Channel? | CREATE TABLE table_21183 ("Show" text,"Last Aired" real,"Previous Network" text,"Retitled as/Same" text,"New/Returning/Same Network" text,"Returning" text) | SELECT "Show" FROM table_21183 WHERE "Previous Network" = 'The Family Channel' |
What are the facility codes of the apartments with more than four bedrooms, and count them by a bar chart, I want to list by the y-axis from high to low. | CREATE TABLE Guests (guest_id INTEGER,gender_code CHAR(1),guest_first_name VARCHAR(80),guest_last_name VARCHAR(80),date_of_birth DATETIME)CREATE TABLE View_Unit_Status (apt_id INTEGER,apt_booking_id INTEGER,status_date DATETIME,available_yn BIT)CREATE TABLE Apartment_Buildings (building_id INTEGER,building_short_name C... | SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code ORDER BY COUNT(facility_code) DESC |
What is the average number of laps for grid 8? | CREATE TABLE table_11351 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real) | SELECT AVG("Laps") FROM table_11351 WHERE "Grid" = '8' |
How many wins when the pct, is .848? | CREATE TABLE table_name_19 (wins VARCHAR,pct VARCHAR) | SELECT wins FROM table_name_19 WHERE pct = ".848" |
What 2nd leg has pelister as team 1? | CREATE TABLE table_13051 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text) | SELECT "2nd leg" FROM table_13051 WHERE "Team 1" = 'pelister' |
what was the top four of the most frequent procedures until 2 years ago? | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime t... | SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-2 year') GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 4 |
Who won the womens singles when Marc Zwiebler won the men's singles? | CREATE TABLE table_17427 ("Year" real,"Mens singles" text,"Womens singles" text,"Mens doubles" text,"Womens doubles" text,"Mixed doubles" text) | SELECT "Womens singles" FROM table_17427 WHERE "Mens singles" = 'Marc Zwiebler' |
when did patient 9294 first have a arterial bp [systolic] measured on the first intensive care unit visit? | CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime 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_diagnoses (row_id number,icd9_code text,short_title text,long_... | SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9294) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.itemid IN (S... |
what exactly does carbuncle, site nec mean? | CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE... | SELECT d_icd_diagnoses.long_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'carbuncle, site nec' UNION SELECT d_icd_procedures.long_title FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'carbuncle, site nec' |
What was the total number for the Bulls when they were at Old Trafford? | CREATE TABLE table_name_27 (bulls VARCHAR,venue VARCHAR) | SELECT COUNT(bulls) FROM table_name_27 WHERE venue = "old trafford" |
What production was created by Monogram? | CREATE TABLE table_5938 ("Medium" text,"Title" text,"Date" text,"Theatre,Studio,or Network" text,"Role" text) | SELECT "Title" FROM table_5938 WHERE "Theatre, Studio, or Network" = 'monogram' |
Posts with images hosted on ImageShack. | CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,T... | SELECT Posts.Id, Posts.Id AS "post_link", PostTypes.Name AS "type", Posts.Score, Posts.CreationDate, Posts.Tags FROM Posts JOIN PostTypes ON PostTypes.Id = Posts.PostTypeId WHERE Body LIKE '%<img%.imageshack.us/img%' LIMIT 1000 |
For all employees who have the letters D or S in their first name, a line chart shows the change of employee_id over hire_date | CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))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 v... | SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' |
How many countries earned 177.2 points? | CREATE TABLE table_69 ("Rank" real,"Member Association" text,"Points" text,"Group stage" real,"Play-off" real,"AFC Cup" real) | SELECT COUNT("Member Association") FROM table_69 WHERE "Points" = '177.2' |
Tell me the opponents for runner-up and surface of grass | CREATE TABLE table_name_27 (opponents_in_the_final VARCHAR,outcome VARCHAR,surface VARCHAR) | SELECT opponents_in_the_final FROM table_name_27 WHERE outcome = "runner-up" AND surface = "grass" |
Which Total has a Hereditary peer of , and a Lords spiritual of , and a Life peers of 2, and an Affiliation of plaid cymru? | CREATE TABLE table_5552 ("Affiliation" text,"Life peers" text,"Hereditary peers" text,"Lords spiritual" text,"Total" real) | SELECT COUNT("Total") FROM table_5552 WHERE "Hereditary peers" = '–' AND "Lords spiritual" = '–' AND "Life peers" = '2' AND "Affiliation" = 'plaid cymru' |
What is the lowest year listed? | CREATE TABLE table_72665 ("Year" real,"Dates" text,"Champion" text,"Country" text,"Score" text,"To par" text,"Margin of victory" text,"Purse (US$)" real,"Winners share" real) | SELECT MIN("Year") FROM table_72665 |
how many hours have passed since the last time patient 006-2586 has received a albumin-lab test during this hospital visit? | CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,... | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', lab.labresulttime)) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-2586' AND patient.hospi... |
Which League has a League Cup smaller than 0? | CREATE TABLE table_40664 ("Player" text,"Club" text,"League" real,"FA Cup" real,"FA Trophy" real,"League Cup" real,"Total" real) | SELECT MIN("League") FROM table_40664 WHERE "League Cup" < '0' |
Tell me the score for december 3 | CREATE TABLE table_57399 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text) | SELECT "Score" FROM table_57399 WHERE "Date" = 'december 3' |
How much is the purse ( $ ) when the margin of victory is 1 stroke? | CREATE TABLE table_13388681_1 (purse___$__ VARCHAR,margin_of_victory VARCHAR) | SELECT purse___$__ FROM table_13388681_1 WHERE margin_of_victory = "1 stroke" |
Tell me the year for rank more than 35 and out of 167 | CREATE TABLE table_57602 ("Index" text,"Organization" text,"Year" text,"Rank" real,"Out of" real) | SELECT "Year" FROM table_57602 WHERE "Rank" > '35' AND "Out of" = '167' |
List the presbyterian members of the senate. | CREATE TABLE table_20803065_1 (senator VARCHAR,religion VARCHAR) | SELECT senator FROM table_20803065_1 WHERE religion = "Presbyterian" |
List the state names and the number of customers living in each state, I want to list Y-axis in descending order. | CREATE TABLE Regular_Order_Products (regular_order_id INTEGER,product_id INTEGER)CREATE TABLE Employees (employee_id INTEGER,employee_address_id INTEGER,employee_name VARCHAR(80),employee_phone VARCHAR(80))CREATE TABLE Delivery_Route_Locations (location_code VARCHAR(10),route_id INTEGER,location_address_id INTEGER,loca... | SELECT state_province_county, COUNT(*) FROM Customer_Addresses AS t1 JOIN Addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county ORDER BY COUNT(*) DESC |
Which tests have 'Pass' results? Return the dates when the tests were taken, and count them by a line chart, and order x-axis from high to low order. | CREATE TABLE Student_Tests_Taken (registration_id INTEGER,date_test_taken DATETIME,test_result VARCHAR(255))CREATE TABLE Course_Authors_and_Tutors (author_id INTEGER,author_tutor_ATB VARCHAR(3),login_name VARCHAR(40),password VARCHAR(40),personal_name VARCHAR(80),middle_name VARCHAR(80),family_name VARCHAR(80),gender_m... | SELECT date_test_taken, COUNT(date_test_taken) FROM Student_Tests_Taken WHERE test_result = "Pass" ORDER BY date_test_taken DESC |
How many CFL teams are from York college? | CREATE TABLE table_16395 ("Pick #" real,"CFL Team" text,"Player" text,"Position" text,"College" text) | SELECT COUNT("CFL Team") FROM table_16395 WHERE "College" = 'York' |
What 's the easiest class I can take to make the MDE requirement ? | CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)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_d... | SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_cou... |
Users who have answered the most distinct questions. | CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidan... | SELECT A.OwnerUserId AS "user_link", COUNT(DISTINCT A.ParentId) AS "distinct_questions_answered" FROM Posts AS A WHERE A.PostTypeId = 2 AND A.OwnerUserId > 0 GROUP BY A.OwnerUserId ORDER BY 'distinct_questions_answered' DESC |
What is the Team with a game of more than 56, and the score is l 85 90 (ot)? | CREATE TABLE table_75920 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Team" FROM table_75920 WHERE "Game" > '56' AND "Score" = 'l 85–90 (ot)' |
How many bookings did each customer make? Show the customer id as the Y-axis and the first name as the X-axis in a bar chart, and could you sort by the X-axis from low to high? | CREATE TABLE Discount_Coupons (coupon_id INTEGER,date_issued DATETIME,coupon_amount DECIMAL(19,4))CREATE TABLE Payments (payment_id INTEGER,booking_id INTEGER,customer_id INTEGER,payment_type_code VARCHAR(15),amount_paid_in_full_yn VARCHAR(1),payment_date DATETIME,amount_due DECIMAL(19,4),amount_paid DECIMAL(19,4))CREA... | SELECT T1.first_name, T1.customer_id FROM Customers AS T1 JOIN Bookings AS T2 ON T1.customer_id = T2.customer_id ORDER BY T1.first_name |
Stacked bar chart of team_id for with each All_Home in each acc road, and could you list by the Y in ascending? | CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En... | SELECT ACC_Road, Team_ID FROM basketball_match GROUP BY All_Home, ACC_Road ORDER BY Team_ID |
Which Total has a Name of eoin jess category:articles with hcards, and a Scottish Cup larger than 23? | CREATE TABLE table_47268 ("Name" text,"Years" text,"League" real,"Scottish Cup" real,"League Cup" real,"Europe" real,"Total" real) | SELECT MIN("Total") FROM table_47268 WHERE "Name" = 'eoin jess category:articles with hcards' AND "Scottish Cup" > '23' |
During which loss was the record 48-50? | CREATE TABLE table_name_45 (loss VARCHAR,record VARCHAR) | SELECT loss FROM table_name_45 WHERE record = "48-50" |
how many patients whose diagnoses short title is status amput below knee and lab test abnormal status is delta? | 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,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Status amput below knee" AND lab.flag = "delta" |
Show the names of products and the number of events they are in Visualize by bar chart, and could you display from low to high by the X-axis? | CREATE TABLE Channels (Channel_ID INTEGER,Other_Details VARCHAR(255))CREATE TABLE Locations (Location_ID INTEGER,Other_Details VARCHAR(255))CREATE TABLE Products (Product_ID INTEGER,Product_Type_Code CHAR(15),Product_Name VARCHAR(255),Product_Price DECIMAL(20,4))CREATE TABLE Parties (Party_ID INTEGER,Party_Details VARC... | SELECT Product_Name, COUNT(*) FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name ORDER BY Product_Name |
list flights from DENVER to PHILADELPHIA | CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE code_description (code varchar,description text)CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE date_day (month_number int,day_number int,year int,da... | 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 = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADE... |
For the Temple Square station, what is the park & ride lot name? | CREATE TABLE table_59133 ("Station Name" text,"Opening Year" text,"Municipality" text,"Park and Ride Lot" text,"Free Fare Zone" text) | SELECT "Park and Ride Lot" FROM table_59133 WHERE "Station Name" = 'temple square' |
what flights can i find from PITTSBURGH to SAN FRANCISCO after 900 | CREATE TABLE code_description (code varchar,description text)CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE fare (far... | 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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.departure_time > 900 AND flight.to_airport = AIRPORT_SERVICE_1.... |
Number of questions with a positive score and at least one downvote. | CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,... | SELECT COUNT(DISTINCT (p.Id)) FROM Posts AS p INNER JOIN Votes AS v ON p.Id = v.PostId AND v.VoteTypeId = 2 WHERE p.PostTypeId = 1 AND p.Score > 0 |
What's the T-100 when the IS-3 is 150 (225)? | CREATE TABLE table_14223 ("T-35" text,"T-100" text,"KV-1 M1940" text,"KV-1 M1941" text,"KV-1 M1942" text,"KV-1S M1942" text,"KV-85 M1943" text,"IS-2 M1945" text,"IS-3 M1945" text) | SELECT "T-100" FROM table_14223 WHERE "IS-3 M1945" = '150 (225)' |
Find the id of courses which are registered or attended by student whose id is 121? | CREATE TABLE student_course_registrations (course_id VARCHAR,student_id VARCHAR)CREATE TABLE student_course_attendance (course_id VARCHAR,student_id VARCHAR) | SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121 |
What is the name of the player with a pick # less than 5 and an overall of 284? | CREATE TABLE table_35431 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text) | SELECT "Name" FROM table_35431 WHERE "Pick #" < '5' AND "Overall" = '284' |
In what venue did the 1982 FIFA World Cup Qualification take place? | CREATE TABLE table_11873 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text) | SELECT "Venue" FROM table_11873 WHERE "Competition" = '1982 fifa world cup qualification' |
Find the average hours for the students whose tryout decision is no. | CREATE TABLE player (pid number,pname text,ycard text,hs number)CREATE TABLE tryout (pid number,cname text,ppos text,decision text)CREATE TABLE college (cname text,state text,enr number) | SELECT AVG(T1.hs) FROM player AS T1 JOIN tryout AS T2 ON T1.pid = T2.pid WHERE T2.decision = 'no' |
Votes on which day after posting. | CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,... | SELECT DATEDIFF(day, p.CreationDate, CreationDate) AS Days, COUNT(v.Id) AS Count FROM Votes AS v INNER JOIN Posts AS p ON v.PostId = p.Id GROUP BY DATEDIFF(day, p.CreationDate, CreationDate) ORDER BY DATEDIFF(day, p.CreationDate, CreationDate) |
What Airport's ICAO is ENTO? | CREATE TABLE table_name_23 (airport VARCHAR,icao VARCHAR) | SELECT airport FROM table_name_23 WHERE icao = "ento" |
What is the minimum price of the rooms for each different decor? Show me a bar chart!, I want to list in ascending by the Y please. | CREATE TABLE Reservations (Code INTEGER,Room TEXT,CheckIn TEXT,CheckOut TEXT,Rate REAL,LastName TEXT,FirstName TEXT,Adults INTEGER,Kids INTEGER)CREATE TABLE Rooms (RoomId TEXT,roomName TEXT,beds INTEGER,bedType TEXT,maxOccupancy INTEGER,basePrice INTEGER,decor TEXT) | SELECT decor, MIN(basePrice) FROM Rooms GROUP BY decor ORDER BY MIN(basePrice) |
How to find all answers that a certain person has answered me?. http://meta.stackoverflow.com/questions/340245/how-to-find-all-answers-that-a-certain-person-has-answered-me | CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE FlagTypes (I... | WITH questions AS (SELECT q.Id, q.OwnerUserId FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId WHERE a.OwnerUserId = '##userid:int?3577745##') SELECT q.Id AS "post_link", q.OwnerUserId AS "user_link", (SELECT COUNT(*) FROM questions AS qs WHERE q.OwnerUserId = qs.OwnerUserId) AS "#_tot_questions" FROM questio... |
Find the number of people whose age is greater than all engineers. | CREATE TABLE Person (age INTEGER,job VARCHAR)CREATE TABLE person (age INTEGER,job VARCHAR) | SELECT COUNT(*) FROM Person WHERE age > (SELECT MAX(age) FROM Person WHERE job = 'engineer') |
Number of badges of a certain kind. | CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number... | SELECT COUNT(*) AS "count" FROM Badges AS b WHERE (b.Name = '##name?Caucus##') GROUP BY b.Name LIMIT 100 |
how many patients whose admission year is less than 2150 and drug route is iv bolus? | 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.admityear < "2150" AND prescriptions.route = "IV BOLUS" |
what are the different nationalities of pilots? Show each nationality and the number of pilots of each nationality. | CREATE TABLE pilot_record (Record_ID int,Pilot_ID int,Aircraft_ID int,Date text)CREATE TABLE pilot (Pilot_ID int,Pilot_name text,Rank int,Age int,Nationality text,Position text,Join_Year int,Team text)CREATE TABLE aircraft (Aircraft_ID int,Order_Year int,Manufacturer text,Model text,Fleet_Series text,Powertrain text,Fu... | SELECT Nationality, COUNT(*) FROM pilot GROUP BY Nationality |
which game did the opponent score only 7 points ? | CREATE TABLE table_203_158 (id number,"date" text,"time" text,"opponent#" text,"rank#" text,"site" text,"tv" text,"result" text,"attendance" number) | SELECT "date" FROM table_203_158 WHERE "result" = 7 |
Show the authors of their total submissions with a bar chart. | CREATE TABLE Acceptance (Submission_ID int,Workshop_ID int,Result text)CREATE TABLE workshop (Workshop_ID int,Date text,Venue text,Name text)CREATE TABLE submission (Submission_ID int,Scores real,Author text,College text) | SELECT Author, COUNT(Author) FROM submission GROUP BY Author |
What is the best time for a team with a first-qualifying time of 59.448? | CREATE TABLE table_44711 ("Name" text,"Team" text,"Qual 1" text,"Qual 2" text,"Best" text) | SELECT "Best" FROM table_44711 WHERE "Qual 1" = '59.448' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.