table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE table_54471 ( "Rank" real, "Player" text, "Country" text, "Earnings ( $ )" real, "Events" real, "Wins" real )
What are the earnings for jim colbert with under 4 wins?
SELECT COUNT("Earnings ( $ )") FROM table_54471 WHERE "Player" = 'jim colbert' AND "Wins" < '4'
CREATE TABLE table_30759 ( "No in. series" real, "No in. season" real, "Title" text, "Original air date" text, "Production Code" real, "U.S. viewers (millions)" text )
What is the highest production code of the episodes having a US viewership of exactly 2.3?
SELECT MAX("Production Code") FROM table_30759 WHERE "U.S. viewers (millions)" = '2.3'
CREATE TABLE table_name_13 ( february VARCHAR, september VARCHAR )
Who is in February where has September is kristine hanson?
SELECT february FROM table_name_13 WHERE september = "kristine hanson"
CREATE TABLE table_name_68 ( runners INTEGER, jockey VARCHAR, placing VARCHAR )
what is the highest runners when the jockey is frankie dettori and the placing is higher than 1?
SELECT MAX(runners) FROM table_name_68 WHERE jockey = "frankie dettori" AND placing > 1
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_...
i would like to find a flight that goes from BOSTON to ORLANDO i would like it to have a stop in NEW YORK and i would like a flight that serves BREAKFAST
SELECT DISTINCT flight.flight_id FROM 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, flight, flight_stop, food_service WHERE ((CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'NEW YOR...
CREATE TABLE Product_Suppliers ( product_id INTEGER, supplier_id INTEGER, date_supplied_from DATETIME, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19,4) ) CREATE TABLE Department_Stores ( dept_store_id INTEGER, dept_store_chain_id INTEGER...
Return the names and ids of customers who have TN in their address by a bar chart, and sort in ascending by the y axis please.
SELECT customer_name, customer_id FROM Customers WHERE customer_address LIKE "%TN%" ORDER BY customer_id
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, sh...
when did patient 45316 recieve tissue microbiology test for the last time since 58 months ago?
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 45316) AND microbiologyevents.spec_type_desc = 'tissue' AND DATETIME(microbiologyevents.charttime) >= DATETIME(CURRENT_TIME(), '-58 month') ORDER BY mi...
CREATE TABLE table_9335 ( "Game" real, "March" real, "Opponent" text, "Score" text, "Record" text )
what is the score when the game is higher than 66 on march 28?
SELECT "Score" FROM table_9335 WHERE "Game" > '66' AND "March" = '28'
CREATE TABLE table_44001 ( "Player" text, "Nationality" text, "Position" text, "Years for Grizzlies" text, "School/Club Team" text )
What position did Rich Manning play?
SELECT "Position" FROM table_44001 WHERE "Player" = 'rich manning'
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 ) C...
give me the number of office admitted patients who had endoscopic retrograde cholangiopancreatography procedure.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND procedures.short_title = "Endosc retro cholangiopa"
CREATE TABLE table_15187735_15 ( segment_a VARCHAR, segment_c VARCHAR )
What is Segment A where Segment C is Sushi (part 1)?
SELECT segment_a FROM table_15187735_15 WHERE segment_c = "Sushi (Part 1)"
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal...
For those employees who was hired before 2002-06-21, find hire_date and the sum of department_id bin hire_date by weekday, and visualize them by a bar chart, could you order from high to low by the y axis please?
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY SUM(DEPARTMENT_ID) DESC
CREATE TABLE table_50441 ( "Fin. Pos" text, "Car No." text, "Driver" text, "Team" text, "Laps" text, "Time/Retired" text, "Grid" text, "Laps Led" text, "Points" text )
Which driver had 35+3 points?
SELECT "Driver" FROM table_50441 WHERE "Points" = '35+3'
CREATE TABLE table_77247 ( "Round" real, "Player" text, "Position" text, "Nationality" text, "College/Junior/Club Team (League)" text )
What position did Luca Sbisa play for the Philadelphia Flyers?
SELECT "Position" FROM table_77247 WHERE "Player" = 'luca sbisa'
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE procedures_icd ( ...
how many patients were diagnosed with dmii oth nt st uncntrld but did not come back to the hospital within 2 months until 2 years ago?
SELECT (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'dmii oth n...
CREATE TABLE table_79516 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
How much Bronze has a Gold larger than 1, and a Silver smaller than 3, and a Nation of germany, and a Total larger than 11?
SELECT COUNT("Bronze") FROM table_79516 WHERE "Gold" > '1' AND "Silver" < '3' AND "Nation" = 'germany' AND "Total" > '11'
CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE time_zone ( time_zone_cod...
what 's the fare for DL flight 217 from DALLAS to SAN FRANCISCO
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 (((flight.airline_code = 'DL') AND flight.flight_number = 217) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRAN...
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 text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
give me the number of patients whose admission type is urgent and diagnoses long title is other preterm infants, 1,750-1,999 grams?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.long_title = "Other preterm infants, 1,750-1,999 grams"
CREATE TABLE table_204_215 ( id number, "airline" text, "destination(s)" text, "aircraft scheduled" text, "service date(s)" text, "comments" text )
what airline has the same scheduled aircraft as beaver aviation/bas airlines ?
SELECT "airline" FROM table_204_215 WHERE "airline" <> 'beaver aviation / bas airlines' AND "aircraft scheduled" = (SELECT "aircraft scheduled" FROM table_204_215 WHERE "airline" = 'beaver aviation / bas airlines')
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 prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time...
tell me the total amount that patient 2004 had received since 1020 days ago?
SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2004)) AND DATETIME(inputevents_cv.charttime) >= DATETIME(CURRENT_TIME(), '-1020 day')
CREATE TABLE table_name_36 ( Id VARCHAR )
What is the 2011 when the 2010 shows grand slam tournaments?
SELECT 2011 FROM table_name_36 WHERE 2010 = "grand slam tournaments"
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
Calculate the maximum age of married patients who have an inpatient hospital discharge location.
SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.discharge_location = "DISC-TRAN CANCER/CHLDRN H"
CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0) ) CREATE TABLE takes ( ID varchar(5), course_id varchar(8), sec_id varchar(8), ...
How many departments for each building? Draw a bar chart.
SELECT building, COUNT(building) FROM department GROUP BY building
CREATE TABLE table_15396 ( "Date" text, "Opponent" text, "Site" text, "Score" text, "Loss" text )
Where was the game on Thursday, April 29, and they played the Chicago Cubs?
SELECT "Site" FROM table_15396 WHERE "Opponent" = 'chicago cubs' AND "Date" = 'thursday, april 29'
CREATE TABLE table_203_131 ( id number, "pos." number, "car #" number, "driver" text, "make" text, "team" text )
did jason leffler race for braun racing or michael waltrip racing ?
SELECT "team" FROM table_203_131 WHERE "team" IN ('braun racing', 'michael waltrip racing') AND "driver" = 'jason leffler'
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...
10000 most recent closed or downvoted questions without comments. This query aims to show the magnitude of the problem where users don't give feedback after voting to close or downvoting. See http://meta.stackoverflow.com/questions/179003/stack-exchange-is-too-harsh-to-new-usersplease-help-them-improve-low-quality-po/1...
SELECT Posts.Id AS "post_link", Posts.Score FROM Posts WHERE Posts.ClosedDate IS NULL AND PostTypeId = 1 AND Posts.Id NOT IN (SELECT Comments.PostId FROM Comments) AND Posts.Id IN (SELECT Votes.PostId FROM Votes WHERE Votes.VoteTypeId = 3) ORDER BY Posts.Id DESC LIMIT 10000
CREATE TABLE diagnoses ( 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, ...
how many divorced patients have lab test item id 50914?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.itemid = "50914"
CREATE TABLE table_16677887_2 ( record VARCHAR, date VARCHAR )
What was the record for the game on Sept. 14?
SELECT record FROM table_16677887_2 WHERE date = "Sept. 14"
CREATE TABLE table_dev_4 ( "id" int, "hypothyroidism" bool, "serum_bicarbonate" int, "c_peptide_level" float, "autoimmune_disease" bool, "hemoglobin_a1c_hba1c" float, "positive_serum" bool, "inhaled_steroids" bool, "diabetic_ketoacidosis" bool, "creatinine_clearance_cl" float, ...
hemoglobin less than 12 g / dl
SELECT * FROM table_dev_4 WHERE hemoglobin_a1c_hba1c < 12
CREATE TABLE table_78960 ( "Goalkeeper" text, "Goals" real, "Matches" real, "Average" real, "Team" text )
What is the sum of Goals, when Matches is less than 29?
SELECT SUM("Goals") FROM table_78960 WHERE "Matches" < '29'
CREATE TABLE table_name_76 ( competition VARCHAR, score VARCHAR )
What Competition's Score was 1-2?
SELECT competition FROM table_name_76 WHERE score = "1-2"
CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TE...
Bin the year attribute into the Year interval and count them for a bar chart, and rank total number in desc order.
SELECT Year, COUNT(Year) FROM wine ORDER BY COUNT(Year) DESC
CREATE TABLE table_22205 ( "Song title" text, "Artist" text, "Decade" text, "Genre" text, "Single / Pack name" text, "Release date" text, "Family Friendly" text, "Additional Rock Band 3 Features" text )
What is the release date for the song 'had a dad'?
SELECT "Release date" FROM table_22205 WHERE "Song title" = 'Had a Dad'
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, ...
what did patient 015-12508 receive for his or her last procedure in the last hospital visit?
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 = '015-12508' AND NOT patient.hospitaldischargetime IS NULL ORDER BY...
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE labevents ( row_id number, subje...
how many times since 2101 had patient 1417 visited the hospital?
SELECT COUNT(DISTINCT admissions.hadm_id) FROM admissions WHERE admissions.subject_id = 1417 AND STRFTIME('%y', admissions.admittime) >= '2101'
CREATE TABLE table_8317 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
What was the Opponent in Week 9?
SELECT "Opponent" FROM table_8317 WHERE "Week" = '9'
CREATE TABLE table_2457 ( "#" real, "Japanese title" text, "R\u014dmaji" text, "Japanese translation" text, "Vocalist" text, "Episodes used" text )
When 1 is the number what episodes were used?
SELECT "Episodes used" FROM table_2457 WHERE "#" = '1'
CREATE TABLE table_name_16 ( builder VARCHAR, works_number VARCHAR )
Who is the builder with a works number of 2534?
SELECT builder FROM table_name_16 WHERE works_number = "2534"
CREATE TABLE table_23465864_5 ( mon_24_aug VARCHAR, rider VARCHAR )
What is the value of Monday August 24 if the rider is Benny Smith 600cc Yamaha?
SELECT mon_24_aug FROM table_23465864_5 WHERE rider = "Benny Smith 600cc Yamaha"
CREATE TABLE d_icd_diagnoses ( 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 icustays ( row_id number, ...
what are the three most commonly ordered specimen test for a patient who was previously diagnosed with mal neo upper lobe lung during the same month during the last year?
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, 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 = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_...
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod 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 ) ...
how many hours has it been since patient 14467 was prescribed potassium chloride during the current hospital visit the first time?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', prescriptions.startdate)) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14467 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'potassium chloride' ORDER BY prescriptions.s...
CREATE TABLE table_name_71 ( season VARCHAR, result VARCHAR )
Which season has a Result of 6 9?
SELECT season FROM table_name_71 WHERE result = "6–9"
CREATE TABLE table_41172 ( "Issue" text, "Date" text, "Title" text, "Penciller" text, "Color" text )
When did the Issue with the Title Homecoming come out?
SELECT "Date" FROM table_41172 WHERE "Title" = 'homecoming'
CREATE TABLE table_name_74 ( fcc_info VARCHAR, city_of_license VARCHAR )
What is the FCC info for the city of Tribune, Kansas?
SELECT fcc_info FROM table_name_74 WHERE city_of_license = "tribune, kansas"
CREATE TABLE table_25146455_1 ( position INTEGER, winnings VARCHAR )
In what position was the driver who won $60,000?
SELECT MIN(position) FROM table_25146455_1 WHERE winnings = "$60,000"
CREATE TABLE field ( fieldid int ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int...
Does Philipp Haberstock ever collaborated with Ludwig Nastansky ?
SELECT DISTINCT WRITES_0.paperid FROM author AS AUTHOR_0, author AS AUTHOR_1, writes AS WRITES_0, writes AS WRITES_1 WHERE AUTHOR_0.authorname = 'Philipp Haberstock' AND AUTHOR_1.authorname = 'Ludwig Nastansky' AND WRITES_0.authorid = AUTHOR_0.authorid AND WRITES_1.authorid = AUTHOR_1.authorid AND WRITES_1.paperid = WR...
CREATE TABLE table_name_15 ( years VARCHAR, distance VARCHAR, wins VARCHAR )
I want the years for marathon distance and wins of 3
SELECT years FROM table_name_15 WHERE distance = "marathon" AND wins = 3
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE T...
Posts where last event was CW-ification and it wasn't done by the OP.
SELECT ph.PostId AS "post_link", revisions = 'site://posts/' + CAST(ph.PostId AS TEXT) + '/revisions' FROM PostHistory AS ph INNER JOIN Posts AS p ON p.Id = ph.PostId WHERE (ph.PostHistoryTypeId = 16) AND (ph.UserId != p.OwnerUserId) AND ph.Id IN (SELECT MAX(Id) AS last FROM PostHistory GROUP BY PostId) ORDER BY ph.Pos...
CREATE TABLE table_name_49 ( canadian_kennel_club_toy_dogs_group VARCHAR, australian_national_kennel_council_toy_dogs_group VARCHAR )
What is the Canadian Kennel Club Toy Dogs Group with the australian silky terrier as the Australian National Kennel Council Toy Dogs Group breed?
SELECT canadian_kennel_club_toy_dogs_group FROM table_name_49 WHERE australian_national_kennel_council_toy_dogs_group = "australian silky terrier"
CREATE TABLE table_53246 ( "Race" text, "Circuit" text, "Date" text, "Pole position" text, "Winning driver" text, "Constructor" text, "Tyre" text, "Report" text )
What date was the Circuit of Indianapolis?
SELECT "Date" FROM table_53246 WHERE "Circuit" = 'indianapolis'
CREATE TABLE table_54155 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
On what date was the crowd over 19,298 when South Melbourne was the home team?
SELECT "Date" FROM table_54155 WHERE "Crowd" > '19,298' AND "Home team" = 'south melbourne'
CREATE TABLE table_53645 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the score for the away team when the home team scored 19.17 (131)?
SELECT "Away team score" FROM table_53645 WHERE "Home team score" = '19.17 (131)'
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
provide me the number of patients admitted before 2203 who had regional lymph node excision.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2203" AND procedures.long_title = "Regional lymph node excision"
CREATE TABLE table_name_52 ( birth VARCHAR, became_duchess VARCHAR )
What is the Birth of the lady that has a Became Duchess on 18 august 1593 husband's accession?
SELECT birth FROM table_name_52 WHERE became_duchess = "18 august 1593 husband's accession"
CREATE TABLE match_season ( season number, player text, position text, country number, team number, draft_pick_number number, draft_class text, college text ) CREATE TABLE country ( country_id number, country_name text, capital text, official_native_language text ) CREA...
What are the names of countries that have both players with position forward and players with position defender?
SELECT T1.country_name FROM country AS T1 JOIN match_season AS T2 ON T1.country_id = T2.country WHERE T2.position = "Forward" INTERSECT SELECT T1.country_name FROM country AS T1 JOIN match_season AS T2 ON T1.country_id = T2.country WHERE T2.position = "Defender"
CREATE TABLE table_name_67 ( english_title__chinese_title_ VARCHAR, airing_date VARCHAR )
Which title aired on 18 dec 2006- 10 feb 2007?
SELECT english_title__chinese_title_ FROM table_name_67 WHERE airing_date = "18 dec 2006- 10 feb 2007"
CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, basePrice INTEGER, decor TEXT ) CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adul...
Show me the average of baseprice by bedtype in a histogram, and sort by the bars from high to low.
SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType ORDER BY bedType DESC
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) ...
in 01/this year, patient 022-164523 has been allergic to any substance?
SELECT COUNT(*) > 0 FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-164523')) AND DATETIME(allergy.allergytime, 'start of year') = DATETIME(CURR...
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(4...
For those employees who was hired before 2002-06-21, a bar chart shows the distribution of hire_date and the average of manager_id bin hire_date by weekday, and could you display y axis in ascending order?
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(MANAGER_ID)
CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE cite ( citingpaperid int, citedpa...
What papers did li dong publish last year ?
SELECT DISTINCT paper.paperid FROM author, paper, writes WHERE author.authorname = 'li dong' AND paper.year = 2015 AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
CREATE TABLE table_train_52 ( "id" int, "pregnancy_or_lactation" bool, "consent" bool, "surgery" bool, "hemodynamic_instability" bool, "age" float, "NOUSE" float )
surgical intervention in context with the septic insult
SELECT * FROM table_train_52 WHERE surgery = 1
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDat...
top users by tag.
WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ON u.Id =...
CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0) ) CREATE TABLE course ( course_id varchar(8), title varchar(50), dept_name varchar(20), credits numeric(2,0) ) CREATE TABLE section ( course_id varchar(8), sec_id varchar(8), ...
Draw a scatter chart about the correlation between ID and salary .
SELECT ID, salary FROM instructor ORDER BY salary
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE job_history ( EMPLO...
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of hire_date and the average of employee_id bin hire_date by weekday, and rank by the y axis in ascending.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(EMPLOYEE_ID)
CREATE TABLE table_204_261 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
what is the total of medals earned by russia ?
SELECT "total" FROM table_204_261 WHERE "nation" = 'russia'
CREATE TABLE table_24928 ( "Name" text, "Position" text, "Height" text, "Weight" text, "Date of Birth" text, "Home Team" text )
If the height is 185cm and the home team is Heaton Mersey, what is the date of birth?
SELECT "Date of Birth" FROM table_24928 WHERE "Height" = '185cm' AND "Home Team" = 'Heaton Mersey'
CREATE TABLE table_28088 ( "Episode Number" real, "Episode" text, "Rating" text, "Share" real, "Rating/Share (18-49)" text, "Viewers (millions)" text, "Rank (Timeslot)" real, "Rank (Night)" real )
What is the rating of the episode with a share of 4 and a rating/share (18-49) of 0.7/2?
SELECT "Rating" FROM table_28088 WHERE "Share" = '4' AND "Rating/Share (18-49)" = '0.7/2'
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE a...
did patient 015-910 undergone a external fixation device procedure in 2105?
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-910')) AND treatment.treatmentname = 'external fixation device' AND STRF...
CREATE TABLE table_46278 ( "Club" text, "Champions" real, "Runners-up" real, "3rd-Place" real, "4th-Place" real )
What is the highest Runners-Up, when Champions is less than 0?
SELECT MAX("Runners-up") FROM table_46278 WHERE "Champions" < '0'
CREATE TABLE table_67111 ( "Date" text, "Visiting Team" text, "Final Score" text, "Host Team" text, "Stadium" text )
Name the host team for january 1 (2006)
SELECT "Host Team" FROM table_67111 WHERE "Date" = 'january 1 (2006)'
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 ) C...
Give me the number of patients with hyperglycemia hyponatremia as their primary disease who have a 3783 procedure icd9 code.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "HYPERGLYCEMIA;HYPONATREMIA" AND procedures.icd9_code = "3783"
CREATE TABLE table_name_51 ( population VARCHAR, deed_number VARCHAR )
What is the population for Deed number of 21352021?
SELECT population FROM table_name_51 WHERE deed_number = "21352021"
CREATE TABLE table_77233 ( "Round" real, "Pick" real, "Overall" real, "Name" text, "Position" text, "College" text )
What is the highest round number for donnie caraway?
SELECT MAX("Round") FROM table_77233 WHERE "Name" = 'donnie caraway'
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, ...
what is the number of patients with gastrointestinal bleed primary disease who stayed in hospital for more than 14 days?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "GASTROINTESTINAL BLEED" AND demographic.days_stay > "14"
CREATE TABLE table_58746 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( \u00a3 )" real )
Which Country has a Place of 2?
SELECT "Country" FROM table_58746 WHERE "Place" = '2'
CREATE TABLE table_204_87 ( id number, "courthouse" text, "city" text, "street address" text, "jurisdiction" text, "dates of use" text, "named for" text )
which jurisdiction has the most courthouses ?
SELECT "jurisdiction" FROM table_204_87 GROUP BY "jurisdiction" ORDER BY COUNT("courthouse") DESC LIMIT 1
CREATE TABLE table_68852 ( "City" text, "Country" text, "IATA" text, "ICAO" text, "Airport" text )
Name the airport with IATA of dmk
SELECT "Airport" FROM table_68852 WHERE "IATA" = 'dmk'
CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE ...
show me the fares for a FIRST class ticket from BALTIMORE to DALLAS
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, fare_basis, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code A...
CREATE TABLE table_204_459 ( id number, "date" text, "time" text, "opponent" text, "site" text, "tv" text, "result" text, "attendance" number, "record" text )
how many people attended the game on 12/01/2013 ?
SELECT "attendance" FROM table_204_459 WHERE "date" = '12/01/2013'
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 Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) CREATE TABLE View_Unit_Status ( apt_id INTEGER, apt_booking_...
What is the number of start date of each apartment booking for each weekday? Return a bar chart, and show by the y-axis in descending please.
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id ORDER BY COUNT(booking_start_date) DESC
CREATE TABLE table_203_300 ( id number, "year" number, "tournament" text, "venue" text, "result" text, "extra" text )
when did she first win first place ?
SELECT MIN("year") FROM table_203_300 WHERE "result" = 1
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, ...
count the number of patients who have been on pantaprazole intake since 2105.
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT icustays.hadm_id FROM icustays WHERE icustays.icustay_id IN (SELECT inputevents_cv.icustay_id FROM inputevents_cv WHERE inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'pantaprazole' AND d...
CREATE TABLE table_name_93 ( position VARCHAR, nationality VARCHAR )
What is the position of the player from Sweden?
SELECT position FROM table_name_93 WHERE nationality = "sweden"
CREATE TABLE table_55670 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Date" text )
Which home team plays in the Corio Oval venue?
SELECT "Home team" FROM table_55670 WHERE "Venue" = 'corio oval'
CREATE TABLE table_name_54 ( april INTEGER, game VARCHAR )
Which April has a Game of 84
SELECT MAX(april) FROM table_name_54 WHERE game = 84
CREATE TABLE table_25987797_1 ( location VARCHAR, school VARCHAR )
What is the name of the school in Lucas ?
SELECT location FROM table_25987797_1 WHERE school = "Lucas"
CREATE TABLE table_70585 ( "Year" real, "Team" text, "Chassis" text, "Engine" text, "Rank" text, "Points" real )
What engine was used by Curb Motorsports after 1982 that had 11 points?
SELECT "Engine" FROM table_70585 WHERE "Year" > '1982' AND "Points" = '11' AND "Team" = 'curb motorsports'
CREATE TABLE table_name_92 ( year VARCHAR, project VARCHAR )
What year was Bulworth nominated?
SELECT year FROM table_name_92 WHERE project = "bulworth"
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 text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
how many of the female patients were treated with drug d10w?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.drug = "D10W"
CREATE TABLE table_21795650_1 ( f_laps INTEGER, series VARCHAR )
What is the minimum number of f/laps in the Italian Formula Renault 2.0 Winter Series?
SELECT MIN(f_laps) FROM table_21795650_1 WHERE series = "Italian Formula Renault 2.0 Winter series"
CREATE TABLE table_name_55 ( total INTEGER, year_s__won VARCHAR )
what is the sum of total when year(s) won is 1985?
SELECT SUM(total) FROM table_name_55 WHERE year_s__won = "1985"
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 t...
how many patients were tested for rheumatoid factor and discharged to home?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.discharge_location = "HOME" AND lab.label = "Rheumatoid Factor"
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid nu...
how many patients were diagnosed with delirium tremens in 2104.
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'delirium tremens') AND STRFTIME('%y', diagnoses_icd.chartt...
CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE T...
what is the seating capacity of the M80
SELECT DISTINCT aircraft_code FROM aircraft WHERE aircraft_code = 'M80'
CREATE TABLE table_name_12 ( home_team VARCHAR, attendance VARCHAR )
What Home team had an Attendance of 2,776?
SELECT home_team FROM table_name_12 WHERE attendance = "2,776"
CREATE TABLE table_75876 ( "Rank" real, "Main span metres" text, "Main span feet" text, "Year opened" real, "Country" text )
What is the main span feet from opening year of 1936 in the United States with a rank greater than 47 and 421 main span metres?
SELECT "Main span feet" FROM table_75876 WHERE "Year opened" = '1936' AND "Country" = 'united states' AND "Rank" > '47' AND "Main span metres" = '421'
CREATE TABLE table_45347 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text )
What was Juli's winning margin on Aug 24, 1986?
SELECT "Margin of victory" FROM table_45347 WHERE "Date" = 'aug 24, 1986'
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...
Get body of all accepted answers in 2019.
SELECT a.Body FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id WHERE YEAR(a.CreationDate) = 2019 AND q.PostTypeId = 1 AND a.PostTypeId = 2
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 t...
what is subject name and death status of subject id 2560?
SELECT demographic.name, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "2560"
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 t...
count the number of patients whose admission location is emergency room admit and diagnoses short title is mixed acid-base bal dis?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND diagnoses.short_title = "Mixed acid-base bal dis"