table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
how many patients are diagnosed with primary disease copd exacerbation?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "COPD EXACERBATION"
CREATE TABLE table_40678 ( "Television service" text, "Country" text, "Language" text, "Content" text, "HDTV" text, "Package/Option" text )
What Country's Content is TV Locale?
SELECT "Country" FROM table_40678 WHERE "Content" = 'tv locale'
CREATE TABLE table_29843 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Who had the high rebounds when the record was 14 7?
SELECT "High rebounds" FROM table_29843 WHERE "Record" = '14–7'
CREATE TABLE table_68355 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( \u00a3 )" text )
Name the money for p draig harrington
SELECT "Money ( \u00a3 )" FROM table_68355 WHERE "Player" = 'pádraig harrington'
CREATE TABLE table_64405 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text, "Arena" text, "Points" real )
Which Date has a Record of 19 16 8?
SELECT "Date" FROM table_64405 WHERE "Record" = '19–16–8'
CREATE TABLE table_66876 ( "Sunday Sunna/S\u00f3l" text, "Monday Mona/ M\u00e1ni" text, "Tuesday Tiw/ Tyr" text, "Wednesday Woden / Odin" text, "Thursday Thunor / Thor" text, "Friday Frige or Freya" text, "Saturday Saturn" text )
Which Monday Mona/Mani also had a Thursday Thunor/Thor of Tongersdei?
SELECT "Monday Mona/ M\u00e1ni" FROM table_66876 WHERE "Thursday Thunor / Thor" = 'tongersdei'
CREATE TABLE table_79725 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Record" text )
What's the loss for September 16?
SELECT "Loss" FROM table_79725 WHERE "Date" = 'september 16'
CREATE TABLE table_14940519_1 ( week VARCHAR, game_site VARCHAR, opponent VARCHAR )
Name the number of week for game site being memorial stadium for buffalo bills
SELECT COUNT(week) FROM table_14940519_1 WHERE game_site = "Memorial Stadium" AND opponent = "Buffalo Bills"
CREATE TABLE table_51904 ( "Club" text, "Head Coach" text, "City" text, "Stadium" text, "2006-2007 season" text )
Where did the Vit ria de Set bal club place in the 2006-2007 season?
SELECT "2006-2007 season" FROM table_51904 WHERE "Club" = 'vitória de setúbal'
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), ...
How many students does each advisor have. Show scatter chart.
SELECT Advisor, COUNT(*) FROM Student GROUP BY Advisor
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type t...
tell me the maximum hospital cost if there is a gstr/ddnts nos w hmrhg this year?
SELECT MAX(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.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 = 'gstr/ddnts nos w hmrhg')) AND DATETIME(cost.chargetime, 'start ...
CREATE TABLE table_68311 ( "Name" text, "Birth" text, "Marriage" text, "Became Consort" text, "Ceased to be Consort" text, "Spouse" text )
Name the birth of the person married 24 may 1935
SELECT "Birth" FROM table_68311 WHERE "Marriage" = '24 may 1935'
CREATE TABLE table_name_52 ( attendance INTEGER, score VARCHAR )
How many attended during the game with a score of 80-94?
SELECT SUM(attendance) FROM table_name_52 WHERE score = "80-94"
CREATE TABLE Asset_Parts ( asset_id INTEGER, part_id INTEGER ) CREATE TABLE Skills ( skill_id INTEGER, skill_code VARCHAR(20), skill_description VARCHAR(255) ) CREATE TABLE Fault_Log_Parts ( fault_log_entry_id INTEGER, part_fault_id INTEGER, fault_status VARCHAR(10) ) CREATE TABLE Sta...
Draw a bar chart of asset make versus the number of asset make, and display in asc by the X.
SELECT asset_make, COUNT(asset_make) FROM Assets GROUP BY asset_make ORDER BY asset_make
CREATE TABLE table_32374 ( "Season" text, "Team" text, "League Apps" real, "League Goals" real, "Cup Apps" real, "Cup Goals" real )
How many cop apps in the season with fewer than 12 league apps?
SELECT SUM("Cup Apps") FROM table_32374 WHERE "League Apps" < '12'
CREATE TABLE table_name_89 ( competition VARCHAR, club VARCHAR )
What competition has the club villareal?
SELECT competition FROM table_name_89 WHERE club = "villareal"
CREATE TABLE table_203_214 ( id number, "member" text, "party" text, "electorate" text, "state" text, "first elected" text )
when was joe clark first elected ?
SELECT "first elected" FROM table_203_214 WHERE "member" = 'joe clark'
CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text ) CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int )
Bar graph to show how many nationality from different nationality, list in desc by the total number.
SELECT Nationality, COUNT(Nationality) FROM ship GROUP BY Nationality ORDER BY COUNT(Nationality) DESC
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, ...
what are the top five frequent prescribed drugs that were prescribed to patients aged 20s in the same hospital encounter after they had been diagnosed with quadriplegia-partial until 2104?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'quadriplegia-pa...
CREATE TABLE table_14524 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
In which venue did the competition on 11 October 2008 take place?
SELECT "Venue" FROM table_14524 WHERE "Date" = '11 october 2008'
CREATE TABLE Accounts ( account_id INTEGER, customer_id INTEGER, account_name VARCHAR(50), other_account_details VARCHAR(255) ) CREATE TABLE Customers_Cards ( card_id INTEGER, customer_id INTEGER, card_type_code VARCHAR(15), card_number VARCHAR(80), date_valid_from DATETIME, dat...
Display a bar chart for what are the different card types, and how many cards are there of each?
SELECT card_type_code, COUNT(*) FROM Customers_Cards GROUP BY card_type_code
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
count the number of patients whose days of hospital stay is greater than 17 and diagnoses long title is diabetes with renal manifestations, type i [juvenile type], not stated as uncontrolled?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "17" AND diagnoses.long_title = "Diabetes with renal manifestations, type I [juvenile type], not stated as uncontrolled"
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 lab ( subject_id text, hadm_id text, ...
give me the number of patients less than 45 years who were hospitalized for more than 20 days.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "45" AND demographic.days_stay > "20"
CREATE TABLE table_17356873_1 ( venue VARCHAR, shirt_sponsor VARCHAR )
Which venue does Mardan sponsor?
SELECT venue FROM table_17356873_1 WHERE shirt_sponsor = "Mardan"
CREATE TABLE table_16331144_1 ( runner_up VARCHAR, season VARCHAR )
Who was the runner-up in season five?
SELECT runner_up FROM table_16331144_1 WHERE season = "Five"
CREATE TABLE table_16484 ( "Trim" text, "Engine" text, "Turbo" text, "Fuel Delivery" text, "Power" text, "Torque" text, "Transmission" text, "Performance" text )
what's the transmission where turbo is yes (mitsubishi td04-16t )
SELECT "Transmission" FROM table_16484 WHERE "Turbo" = 'Yes (Mitsubishi TD04-16t )'
CREATE TABLE table_35935 ( "Round" real, "Pick" real, "Player" text, "Position" text, "School/Club Team" text )
What is the lowest round of Ed Smith, who had a pick lower than 19?
SELECT MIN("Round") FROM table_35935 WHERE "Player" = 'ed smith' AND "Pick" > '19'
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 ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
count the number of patients whose primary disease is coronary artery disease\coronary artery bypass graft; myomectomy/sda and lab test fluid is urine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT; MYOMECTOMY/SDA" AND lab.fluid = "Urine"
CREATE TABLE table_name_94 ( plural_word VARCHAR, plural_abbreviation VARCHAR )
The plural abbreviation of ll. uses what plural word?
SELECT plural_word FROM table_name_94 WHERE plural_abbreviation = "ll."
CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) CREATE TABLE food_service ( meal_code text, meal_number int, ...
list flights from INDIANAPOLIS to MEMPHIS with fares on monday
SELECT DISTINCT flight.flight_id FROM fare, flight, flight_fare WHERE ((flight.flight_days IN (SELECT DAYSalias0.days_code FROM days AS DAYSalias0 WHERE DAYSalias0.day_name IN (SELECT DATE_DAYalias0.day_name FROM date_day AS DATE_DAYalias0 WHERE DATE_DAYalias0.day_number = 21 AND DATE_DAYalias0.month_number = 2 AND DAT...
CREATE TABLE table_name_37 ( date VARCHAR, time___et__ VARCHAR, game_site VARCHAR )
What date is the 1:00 pm game at arrowhead stadium?
SELECT date FROM table_name_37 WHERE time___et__ = "1:00 pm" AND game_site = "arrowhead stadium"
CREATE TABLE addresses ( address_id number, address_details text ) CREATE TABLE circulation_history ( document_id number, draft_number number, copy_number number, employee_id number ) CREATE TABLE ref_document_status ( document_status_code text, document_status_description text ) CREA...
What is draft detail of the document with id 7?
SELECT draft_details FROM document_drafts WHERE document_id = 7
CREATE TABLE table_32520 ( "Athlete Name" text, "Jump 1" text, "Jump 2" text, "Jump 3" text, "Best Jump" text )
What is the Jump 2 of the person that has a Jump 3 of 7.77?
SELECT "Jump 2" FROM table_32520 WHERE "Jump 3" = '7.77'
CREATE TABLE cinema ( Cinema_ID int, Name text, Openning_year int, Capacity int, Location text ) CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_season int, Title text, Directed_by text, Original_air_date text, Production_code text ) CREATE TABLE schedule...
Give me a pie to show how many directed by from different directed by.
SELECT Directed_by, COUNT(Directed_by) FROM film GROUP BY Directed_by
CREATE TABLE table_name_3 ( cospar_id VARCHAR, satellite VARCHAR )
What is Ariel 3's COSPAR ID?
SELECT cospar_id FROM table_name_3 WHERE satellite = "ariel 3"
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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
in a year before d5 1/2ns, labetalol or insulin were prescribed for patient 10266?
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10266) AND prescriptions.drug IN ('d5 1/2ns', 'labetalol', 'insulin') AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year...
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostHistory ( Id number, Po...
Top 100 posts by view count.
SELECT CONCAT('id', 'post_link'), ViewCount, CreationDate, Score FROM Posts ORDER BY ViewCount DESC LIMIT 100
CREATE TABLE table_71124 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Tyres" text, "Points" real )
What Chassis has g Tyres before 1987?
SELECT "Chassis" FROM table_71124 WHERE "Tyres" = 'g' AND "Year" < '1987'
CREATE TABLE table_name_83 ( channel VARCHAR, country VARCHAR )
Which channel comes out of Israel?
SELECT channel FROM table_name_83 WHERE country = "israel"
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) 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 t...
how many patients are diagnosed with nb obsrv suspct infect and tested under hematology category in lab?
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 = "NB obsrv suspct infect" AND lab."CATEGORY" = "Hematology"
CREATE TABLE table_name_83 ( year VARCHAR, team VARCHAR, tournament VARCHAR, finish VARCHAR )
In what Year was 1st Division El Salvador with a Finish of Champion and a Team of Fas?
SELECT year FROM table_name_83 WHERE tournament = "1st division el salvador" AND finish = "champion" AND team = "fas"
CREATE TABLE table_name_76 ( accolade VARCHAR, rank VARCHAR, year VARCHAR, publication VARCHAR )
What is Accolade, when Year is less than 2002, when Publication is 'Rolling Stone', and when Rank is '48'?
SELECT accolade FROM table_name_76 WHERE year < 2002 AND publication = "rolling stone" AND rank = 48
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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLO...
For those employees who did not have any job in the past, return a bar chart about the distribution of hire_date and the sum of salary bin hire_date by time.
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar...
what are the flights and fares from BOSTON to PHILADELPHIA
SELECT DISTINCT fare.fare_id, flight.airline_code, flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPO...
CREATE TABLE table_203_109 ( id number, "treaty" text, "organization" text, "introduced" number, "signed" number, "ratified" number )
what is the last treaty morocco ratified ?
SELECT "treaty" FROM table_203_109 ORDER BY "ratified" DESC LIMIT 1
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 ...
had patient 13806 been prescribed vancomycin hcl, phenylephrine or d5w (excel bag) until 2102?
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13806) AND prescriptions.drug IN ('vancomycin hcl', 'phenylephrine', 'd5w (excel bag)') AND STRFTIME('%y', prescriptions.startdate) <= '2102'
CREATE TABLE table_58551 ( "Tournament" text, "2009" text, "2011" text, "2012" text, "2013" text )
Name the 2012 for 2009 of 1r
SELECT "2012" FROM table_58551 WHERE "2009" = '1r'
CREATE TABLE on_call ( nurse VARCHAR, blockfloor VARCHAR, blockcode VARCHAR )
What nurses are on call with block floor 1 and block code 1? Tell me their names.
SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
Find posts with broken MathJax (single dollar sign).
SELECT Id AS "post_link", Body, CreationDate AS "date" FROM Posts WHERE Body LIKE '%$%' AND NOT Body LIKE '%$%$%'
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...
how many patients whose admission type is urgent and primary disease is mesenteric ischemia?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.diagnosis = "MESENTERIC ISCHEMIA"
CREATE TABLE table_name_15 ( right_ascension___j2000__ VARCHAR, object_type VARCHAR, apparent_magnitude VARCHAR )
What is the Right ascension of the Object type spiral galaxy that has an Apparent magnitude larger that 12.2
SELECT right_ascension___j2000__ FROM table_name_15 WHERE object_type = "spiral galaxy" AND apparent_magnitude > 12.2
CREATE TABLE table_30586 ( "Stage" real, "Winner" text, "General classification" text, "Points classification" text, "Mountains classification" text, "Young rider classification" text )
Who was the young rider classification when Alessandro Petacchi won?
SELECT "Young rider classification" FROM table_30586 WHERE "Winner" = 'Alessandro Petacchi'
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConce...
Total number of posts by months.
SELECT COUNT(*) FROM Posts
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id ...
what are the four most frequently ordered lab tests for patients who had previously received ven cath renal dialysis within the same month, in 2104?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_i...
CREATE TABLE table_name_24 ( status VARCHAR, newspaper_magazine VARCHAR )
What is Status, when Newspaper/Magazine is Al-Thawra?
SELECT status FROM table_name_24 WHERE newspaper_magazine = "al-thawra"
CREATE TABLE table_name_89 ( result VARCHAR, date VARCHAR )
Where Date is september 13, 1998 what is result?
SELECT result FROM table_name_89 WHERE date = "september 13, 1998"
CREATE TABLE table_28657 ( "Name / designation" text, "Year of introduction" text, "Country of origin" text, "Primary cartridge" text, "primary user" text )
If the Country of Origin is Denmark and the year of introduction is 1962, what is the primary cartridge?
SELECT "Primary cartridge" FROM table_28657 WHERE "Year of introduction" = '1962' AND "Country of origin" = 'Denmark'
CREATE TABLE table_79697 ( "Rank" real, "Name" text, "1st run" text, "2nd run" text, "3rd run" text, "Total" real )
Which 3rd run has rank of 8?
SELECT "3rd run" FROM table_79697 WHERE "Rank" = '8'
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) 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_NA...
For all employees who have the letters D or S in their first name, a bar chart shows the distribution of hire_date and the amount of hire_date bin hire_date by time.
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
CREATE TABLE allergy_type ( allergy text, allergytype text ) CREATE TABLE has_allergy ( stuid number, allergy text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text )
What is the type of allergy Cat?
SELECT allergytype FROM allergy_type WHERE allergy = "Cat"
CREATE TABLE table_18796 ( "Season" real, "Premiers" text, "Runners Up" text, "Score" text, "Captain" text, "Coach" text, "Simpson Medal" text, "Venue" text, "Attendance" real, "Umpires" text )
Which venue did Luke Blackwell serve as captain?
SELECT "Venue" FROM table_18796 WHERE "Captain" = 'Luke Blackwell'
CREATE TABLE table_55351 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
When the driver peter gethin has a grid less than 25, what is the average number of laps?
SELECT AVG("Laps") FROM table_55351 WHERE "Driver" = 'peter gethin' AND "Grid" < '25'
CREATE TABLE table_35910 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" real, "Record" text )
How many people attended the game when Larry Hughes(33) was the leading scorer and cleveland was visiting?
SELECT SUM("Attendance") FROM table_35910 WHERE "Visitor" = 'cleveland' AND "Leading scorer" = 'larry hughes(33)'
CREATE TABLE table_489 ( "Celebrity" text, "Background" text, "Original Team" text, "Age" real, "Hometown" text, "Charity" text, "Result" text, "Raised" text )
What is the original team of the celebrity who had the result 08 fired in week 10 (2008-03-06)
SELECT "Original Team" FROM table_489 WHERE "Result" = '08 Fired in week 10 (2008-03-06)'
CREATE TABLE table_204_265 ( id number, "no." number, "title (latin)" text, "title (english translation)" text, "subject" text, "date" text )
what is the total number of title ?
SELECT COUNT("subject") FROM table_204_265
CREATE TABLE table_204_1 ( id number, "season" text, "north" text, "south" text, "east" text, "west" text )
who won the south after esc geretsried did during the 2006-07 season ?
SELECT "south" FROM table_204_1 WHERE id = (SELECT id FROM table_204_1 WHERE "south" = 'esc geretsried') + 1
CREATE TABLE table_44900 ( "Team" text, "Coach" text, "Home Ground" text, "Location" text, "Founded" real )
Where is the home ground for the club coached by nick pantsaras and founded before 1946?
SELECT "Home Ground" FROM table_44900 WHERE "Founded" < '1946' AND "Coach" = 'nick pantsaras'
CREATE TABLE table_name_82 ( year INTEGER, tyres VARCHAR, chassis VARCHAR )
How many years were g Tyres and Minardi m187 used?
SELECT AVG(year) FROM table_name_82 WHERE tyres = "g" AND chassis = "minardi m187"
CREATE TABLE table_78664 ( "Week" text, "Date" text, "Opponent" text, "Result" text, "Location" text )
What was the result of the game against the Miami Dolphins held at the Riverfront Stadium?
SELECT "Result" FROM table_78664 WHERE "Location" = 'riverfront stadium' AND "Opponent" = 'miami dolphins'
CREATE TABLE table_20709 ( "Number in series" real, "Broadcast Order" text, "Title" text, "Directed by" text, "Written by" text, "Original airdate" text, "Production Code" real )
Who directed the totle 'tjockare n vatten'?
SELECT "Directed by" FROM table_20709 WHERE "Title" = 'Tjockare än vatten'
CREATE TABLE table_44491 ( "Archbishop" text, "Born" text, "Ordained Priest" text, "Ordained Bishop" text, "Appointed Archbishop" text, "Vacated throne" text, "Died" text )
When did the archbishop that was ordained a bishop on July 25, 1902 die?
SELECT "Died" FROM table_44491 WHERE "Ordained Bishop" = 'july 25, 1902'
CREATE TABLE table_17829 ( "City/Town" text, "July av. T" text, "Rain" text, "Days with rain (year/summer)" text, "Days with frost" real, "Sunlight hours" real )
How many rain figures are provided for sunlight hours in 1966?
SELECT COUNT("Rain") FROM table_17829 WHERE "Sunlight hours" = '1966'
CREATE TABLE round ( Round_ID int, Member_ID int, Decoration_Theme text, Rank_in_Round int ) CREATE TABLE member ( Member_ID int, Name text, Country text, College_ID int ) CREATE TABLE college ( College_ID int, Name text, Leader_Name text, College_Location text )
Show the different countries and the number of members from each with a bar chart, rank by the bar in ascending.
SELECT Country, COUNT(*) FROM member GROUP BY Country ORDER BY Country
CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight re...
Bar chart of total number of height from each sex
SELECT Sex, SUM(Height) FROM people GROUP BY Sex
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( la...
what was the first time until 05/2100 patient 002-52932 was prescribed a medication via a misc route?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-52932')) AND medication.routeadmin = 'misc' AND STRFTIME('...
CREATE TABLE table_802 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
how many times have there been helps by damon stoudamire (13)
SELECT COUNT("Record") FROM table_802 WHERE "High assists" = 'Damon Stoudamire (13)'
CREATE TABLE Products ( Product_ID VARCHAR(100), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255) ) CREATE TABLE Customer_Orders ( Order_ID INTEGER, Customer_ID INTEGER, Store_ID INTEGER, Order_Date ...
Show all payment method codes and the number of orders for each code. Visualize by pie chart.
SELECT payment_method_code, COUNT(*) FROM Invoices GROUP BY payment_method_code
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE T...
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the sum of employee_id , and group by attribute job_id, and sort y axis in ascending order.
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(EMPLOYEE_ID)
CREATE TABLE table_name_13 ( date VARCHAR, director VARCHAR )
When was the film directed by Pen-Ek Ratanaruang released?
SELECT date FROM table_name_13 WHERE director = "pen-ek ratanaruang"
CREATE TABLE table_52741 ( "Rank" real, "Rider" text, "Team" text, "Speed" text, "Time" text )
Which rider had a speed of 104.630mph?
SELECT "Rider" FROM table_52741 WHERE "Speed" = '104.630mph'
CREATE TABLE table_204_340 ( id number, "name" text, "year inducted" number, "position" text, "apps" number, "goals" number )
what is the total number of apps and goals for luther blissett ?
SELECT "apps" + "goals" FROM table_204_340 WHERE "name" = 'luther blissett'
CREATE TABLE table_name_21 ( driver_s_ VARCHAR, primary_sponsor_s_ VARCHAR )
Parts Plus sponsors what driver?
SELECT driver_s_ FROM table_name_21 WHERE primary_sponsor_s_ = "parts plus"
CREATE TABLE table_name_65 ( place VARCHAR, performance VARCHAR )
What is the place when the performance is 60.73m?
SELECT place FROM table_name_65 WHERE performance = "60.73m"
CREATE TABLE table_name_35 ( year VARCHAR, producer VARCHAR )
What year was Sam Kazman a producer?
SELECT year FROM table_name_35 WHERE producer = "sam kazman"
CREATE TABLE table_203_254 ( id number, "position" number, "team" text, "points" number, "played" number, "won" number, "drawn" number, "lost" number, "for" number, "against" number, "difference" number )
which team had the largest goal difference ?
SELECT "team" FROM table_203_254 ORDER BY ABS("difference") DESC LIMIT 1
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, spec_type_desc text, org_name text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, sh...
how many days have elapsed since the first time patient 30826 stayed in the ward 12 during this hospital encounter?
SELECT 1 * (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 = 30826 AND admissions.dischtime IS NULL)) AND transfers....
CREATE TABLE table_13239 ( "Position" text, "Player" text, "Loaned to" text, "Date" text, "Loan expires" text )
What loan expires date has a Date of 29 december 2003?
SELECT "Loan expires" FROM table_13239 WHERE "Date" = '29 december 2003'
CREATE TABLE table_9885 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents in the final" text, "Score in the final" text )
Who was the partner that played against Serena Williams Venus Williams?
SELECT "Partner" FROM table_9885 WHERE "Opponents in the final" = 'serena williams venus williams'
CREATE TABLE party ( party_name VARCHAR, party_id VARCHAR ) CREATE TABLE Member ( party_id VARCHAR )
What is the name of party with most number of members?
SELECT T2.party_name FROM Member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE table_28631 ( "Channel" real, "Channel name" text, "Callsign" text, "Signal power" text, "Broadcast area" text )
What is the call sign for channel 6?
SELECT "Callsign" FROM table_28631 WHERE "Channel" = '6'
CREATE TABLE table_42037 ( "Date" text, "Score" text, "Set 1" text, "Set 2" text, "Set 3" text, "Set 4" text, "Set 5" text, "Total" text )
What date has a set 4 of 25-19?
SELECT "Date" FROM table_42037 WHERE "Set 4" = '25-19'
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, ...
how many patients were admitted before the year 2135 under procedure icd9 code 3893?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2135" AND procedures.icd9_code = "3893"
CREATE TABLE table_9027 ( "Name" text, "GP-GS" text, "Effic" real, "Att-Cmp-Int" text, "Avg/G" real )
What was the total effic for the quarterbacks?
SELECT MIN("Effic") FROM table_9027 WHERE "Name" = 'total'
CREATE TABLE table_name_78 ( civil_liberties INTEGER, year VARCHAR, political_rights VARCHAR, president VARCHAR )
When the president was Yoweri Museveni, and the year was 1993, with rank of 6 under political rights, what was the total of civil liberties?
SELECT SUM(civil_liberties) FROM table_name_78 WHERE political_rights = 6 AND president = "yoweri museveni" AND year = 1993
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, r...
ST. PETERSBURG to DETROIT
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 = 'ST. PETERSBURG' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = ...
CREATE TABLE table_31955 ( "Points" real, "Name" text, "Club" text, "Tries" real, "Drop" real )
Name the fewest tries for leicester tigers with points less than 207
SELECT MIN("Tries") FROM table_31955 WHERE "Club" = 'leicester tigers' AND "Points" < '207'
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense...
Total View Count of User's Accepted Answers.
SELECT 'Grand Total' AS Title, SUM(Question.ViewCount) AS ViewCount, NULL AS Score FROM Posts AS Answer INNER JOIN PostTypes ON PostTypes.Id = Answer.PostTypeId INNER JOIN Posts AS Question ON Question.Id = Answer.ParentId AND Question.AcceptedAnswerId = Answer.Id WHERE PostTypes.Name = 'Answer' AND Answer.OwnerUserId ...
CREATE TABLE Addresses ( address_id INTEGER, line_1 VARCHAR(120), line_2 VARCHAR(120), line_3 VARCHAR(120), city VARCHAR(80), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), other_address_details VARCHAR(255) ) CREATE TABLE Students_in_Detention ( ...
Find other_details and the sum of monthly_rental , and group by attribute other_details, and visualize them by a bar chart.
SELECT other_details, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
CREATE TABLE table_2668401_17 ( district VARCHAR, incumbent VARCHAR )
In what district was the incumbent Edwin Gray?
SELECT district FROM table_2668401_17 WHERE incumbent = "Edwin Gray"
CREATE TABLE table_64172 ( "Year" real, "Game" text, "Genre" text, "Platform(s)" text, "Developer(s)" text )
What year was the developer(s) Bioware?
SELECT AVG("Year") FROM table_64172 WHERE "Developer(s)" = 'bioware'