table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE table_62593 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What is the Home team in the Game with a Score of 1 0?
SELECT "Home team" FROM table_62593 WHERE "Score" = '1–0'
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, ...
how many patients of asian ethnicity are administered additive drug types?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "ASIAN" AND prescriptions.drug_type = "ADDITIVE"
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...
what is the minimum amylase value until 10 months ago for patient 005-86645?
SELECT MIN(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-86645')) AND lab.labname = 'amylase' AND DATETIME(lab.labresulttime) <= DATETI...
CREATE TABLE table_203_721 ( id number, "school" text, "location" text, "control" text, "type" text, "enrollment" number, "founded" number )
what 's the number of schools represented in the table ?
SELECT COUNT("school") FROM table_203_721
CREATE TABLE table_71937 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" real )
What is the Name of the person from the Netherlands in a Lane lower than 5, with a Rank better than 5, and a time of less than 55.62?
SELECT "Name" FROM table_71937 WHERE "Rank" < '5' AND "Time" < '55.62' AND "Lane" < '5' AND "Nationality" = 'netherlands'
CREATE TABLE table_name_45 ( runner_s__up VARCHAR, winning_score VARCHAR )
Who is the runner-up where the winning score is 8 (71-69-67-73=280)?
SELECT runner_s__up FROM table_name_45 WHERE winning_score = –8(71 - 69 - 67 - 73 = 280)
CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT ) CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) CREATE TABLE trip ( id INTEGER, d...
Please give me a pie chart to show the proportion of end stations for the trips with the three smallest ids?
SELECT end_station_name, COUNT(end_station_name) FROM trip GROUP BY end_station_name ORDER BY id LIMIT 3
CREATE TABLE table_40547 ( "Round" text, "Opposition" text, "First leg" text, "Second leg" text, "Aggregate score" text )
What round had the opponent Lyon?
SELECT "Round" FROM table_40547 WHERE "Opposition" = 'lyon'
CREATE TABLE table_name_81 ( name_designation VARCHAR, payload VARCHAR )
What is the name/designation for the 1200kg payload?
SELECT name_designation FROM table_name_81 WHERE payload = "1200kg"
CREATE TABLE stock ( shop_id number, device_id number, quantity number ) CREATE TABLE shop ( shop_id number, shop_name text, location text, open_date text, open_year number ) CREATE TABLE device ( device_id number, device text, carrier text, package_version text, ap...
Give the average quantity of stocks.
SELECT AVG(quantity) FROM stock
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ...
Answer score as a function of length. Plots average answer score, +/- 1 standard deviation, as a function of binned answer length.
SELECT Score, LENGTH(Body) FROM Posts WHERE PostTypeId = 2 AND LENGTH(Body) <= 20000
CREATE TABLE Students_in_Detention ( student_id INTEGER, detention_id INTEGER, incident_id INTEGER ) CREATE TABLE Behavior_Incident ( incident_id INTEGER, incident_type_code VARCHAR(10), student_id INTEGER, date_incident_start DATETIME, date_incident_end DATETIME, incident_summary V...
Visualize a line chart about the change of the sum of monthly_rental over date_address_to , and group by attribute other_details.
SELECT date_address_to, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details, date_address_to ORDER BY monthly_rental DESC
CREATE TABLE table_24791 ( "Pilot" text, "Organization" text, "Total Flights" real, "USAF space flights" real, "FAI space flights" real, "Max Mach" text, "Max speed (mph)" real, "Max altitude (miles)" text )
Who was the pilot of max altitude of 55.9 miles?
SELECT "Pilot" FROM table_24791 WHERE "Max altitude (miles)" = '55.9'
CREATE TABLE Patient ( SSN INTEGER, Name VARCHAR(30), Address VARCHAR(30), Phone VARCHAR(30), InsuranceID INTEGER, PCP INTEGER ) CREATE TABLE Prescribes ( Physician INTEGER, Patient INTEGER, Medication INTEGER, Date DATETIME, Appointment INTEGER, Dose VARCHAR(30) ) CREA...
Find the number of the physicians who are trained in a procedure that costs more than 5000.
SELECT T1.Name, COUNT(T1.Name) FROM Physician AS T1 JOIN Trained_In AS T2 ON T1.EmployeeID = T2.Physician JOIN Procedures AS T3 ON T3.Code = T2.Treatment WHERE T3.Cost > 5000 GROUP BY T1.Name
CREATE TABLE table_7944 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" text )
What is Money ( $ ), when Score is '75-71-72-70=288'?
SELECT "Money ( $ )" FROM table_7944 WHERE "Score" = '75-71-72-70=288'
CREATE TABLE table_38343 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text )
Which Round is the highest one that has an Overall of 32, and a Pick # smaller than 4?
SELECT MAX("Round") FROM table_38343 WHERE "Overall" = '32' AND "Pick #" < '4'
CREATE TABLE table_27537870_3 ( location_attendance VARCHAR, record VARCHAR )
What is the location and what was the attendance on those days when the score was 3-5-1?
SELECT location_attendance FROM table_27537870_3 WHERE record = "3-5-1"
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 ( Scho...
What is the relationship between Team_ID and ACC_Percent , and group by attribute All_Road?
SELECT Team_ID, ACC_Percent FROM basketball_match GROUP BY All_Road
CREATE TABLE table_58356 ( "Position" text, "Game 1" text, "Game 2" text, "Game 3" text, "Game 4" text )
For which Game 4 did Michael O'Connor play during Game 1?
SELECT "Game 4" FROM table_58356 WHERE "Game 1" = 'michael o''connor'
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 treatment ( treat...
how many hours have passed since first time that patient 027-32001 stayed in ward 962 during the current hospital encounter?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.unitadmittime)) FROM patient WHERE patient.uniquepid = '027-32001' AND patient.wardid = 962 AND patient.hospitaldischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
how many patients whose procedure long title is colonoscopy?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Colonoscopy"
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 varchar(2) ) CREATE TABLE departments ( DEPARTME...
For those employees who did not have any job in the past, give me the comparison about the average of salary over the hire_date bin hire_date by weekday by a bar chart, and show in desc by the Y.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(SALARY) DESC
CREATE TABLE table_name_41 ( color_commentator_s_ VARCHAR, channel VARCHAR, year VARCHAR )
Which Color commentator has a Channel of fsn new england, and a Year of 2004-05?
SELECT color_commentator_s_ FROM table_name_41 WHERE channel = "fsn new england" AND year = "2004-05"
CREATE TABLE table_12592074_1 ( launched VARCHAR, commissioned_or_completed_ VARCHAR, _ VARCHAR )
When was the ship launched when the commissioned or completed(*) is 6 june 1864?
SELECT launched FROM table_12592074_1 WHERE commissioned_or_completed_ * _ = "6 June 1864"
CREATE TABLE table_64128 ( "Rank" real, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the silver when the Total is 1, and Gold is 1?
SELECT AVG("Silver") FROM table_64128 WHERE "Total" = '1' AND "Gold" = '1'
CREATE TABLE table_name_59 ( administrative_panel VARCHAR, nominated_by_the_taoiseach VARCHAR, labour_panel VARCHAR, total VARCHAR )
Tell me the total number of administrative panel with labour panel more than 2, nominated by taoiseach more than 6 and total of 28
SELECT COUNT(administrative_panel) FROM table_name_59 WHERE labour_panel > 2 AND total = 28 AND nominated_by_the_taoiseach > 6
CREATE TABLE table_47327 ( "Game" real, "October" real, "Opponent" text, "Score" text, "Record" text )
Which opponent played in game 3 before October 18?
SELECT "Opponent" FROM table_47327 WHERE "October" < '18' AND "Game" = '3'
CREATE TABLE table_17862135_3 ( number_of_dances VARCHAR, couple VARCHAR )
How many dances did Warren & Kym have?
SELECT number_of_dances FROM table_17862135_3 WHERE couple = "Warren & Kym"
CREATE TABLE table_name_37 ( method VARCHAR, record VARCHAR )
How did the match end when his record was 15-11?
SELECT method FROM table_name_37 WHERE record = "15-11"
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, ...
Last posts with negative score.
SELECT 'id' AS "post_link", 'score', 'creationdate', 'closeddate', 'body' FROM Posts WHERE Score < -10 ORDER BY CreationDate DESC LIMIT 50
CREATE TABLE table_69299 ( "Name" text, "Years" text, "Gender" text, "Area" text, "Authority" text, "Decile" real, "Roll" real )
What is the area of Mangamahu primary school?
SELECT "Area" FROM table_69299 WHERE "Name" = 'mangamahu primary school'
CREATE TABLE table_2891 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "U.S. viewers (million)" text, "Original air date" text, "Production code" real )
What is the series number of the episode that aired March 25, 2010?
SELECT MIN("No. in series") FROM table_2891 WHERE "Original air date" = 'March 25, 2010'
CREATE TABLE table_27631756_2 ( chairman VARCHAR, captain VARCHAR )
Who is the chairman when teh captain is fawzi bashir?
SELECT chairman FROM table_27631756_2 WHERE captain = "Fawzi Bashir"
CREATE TABLE table_40855 ( "Season" text, "Round" text, "Country" text, "Opponent" text, "Result" text )
What season had a game in the first round with a result of 4 1, 0 1?
SELECT "Season" FROM table_40855 WHERE "Round" = 'first round' AND "Result" = '4–1, 0–1'
CREATE TABLE table_42044 ( "Actual Title" text, "Writer" text, "Artist" text, "Issue" real, "Date" text )
What writer has mort drucker as the artist, an issue greater than 470, and law & order: svu as an actual title?
SELECT "Writer" FROM table_42044 WHERE "Artist" = 'mort drucker' AND "Issue" > '470' AND "Actual Title" = 'law & order: svu'
CREATE TABLE table_name_29 ( to_par VARCHAR, player VARCHAR )
What is Charlie Wi's To par?
SELECT to_par FROM table_name_29 WHERE player = "charlie wi"
CREATE TABLE table_71103 ( "Date" text, "Time" text, "Score" text, "Set 1" text, "Set 2" text, "Set 3" text, "Total" text, "Report" text )
Which Set 3 has a Set 1 of 25 20?
SELECT "Set 3" FROM table_71103 WHERE "Set 1" = '25–20'
CREATE TABLE station_company ( Station_ID int, Company_ID int, Rank_of_the_Year int ) CREATE TABLE gas_station ( Station_ID int, Open_Year int, Location text, Manager_Name text, Vice_Manager_Name text, Representative_Name text ) CREATE TABLE company ( Company_ID int, Rank i...
Show all main industry and total market value in each industry by a bar chart, show in asc by the x-axis.
SELECT Main_Industry, SUM(Market_Value) FROM company GROUP BY Main_Industry ORDER BY Main_Industry
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Return a pie chart about the proportion of All_Games and School_ID.
SELECT All_Games, School_ID FROM basketball_match
CREATE TABLE table_name_4 ( county VARCHAR, name VARCHAR )
In which county is the swann covered bridge located?
SELECT county FROM table_name_4 WHERE name = "swann covered bridge"
CREATE TABLE table_54424 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
What is the least number of laps for the driver Jo Siffert?
SELECT MIN("Laps") FROM table_54424 WHERE "Driver" = 'jo siffert'
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, ...
among patients diagnosed with fever in other diseases, how many of them were female?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.short_title = "Fever in other diseases"
CREATE TABLE table_14594528_6 ( losses VARCHAR, games VARCHAR )
How many losses for the coach that coached 19 games?
SELECT losses FROM table_14594528_6 WHERE games = 19
CREATE TABLE table_name_83 ( latitude VARCHAR, year_built VARCHAR )
What is the Latitude of the monument built in 1901?
SELECT latitude FROM table_name_83 WHERE year_built = 1901
CREATE TABLE playlists ( id number, name text ) CREATE TABLE invoices ( id number, customer_id number, invoice_date time, billing_address text, billing_city text, billing_state text, billing_country text, billing_postal_code text, total number ) CREATE TABLE albums ( id...
What is the total amount of money spent by Lucas Mancini?
SELECT SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T1.id = T2.customer_id WHERE T1.first_name = "Lucas" AND T1.last_name = "Mancini"
CREATE TABLE table_name_75 ( yellow_cards INTEGER, season VARCHAR )
Which Yellow Cards has a Season of 1999/2000?
SELECT AVG(yellow_cards) FROM table_name_75 WHERE season = "1999/2000"
CREATE TABLE table_2077192_2 ( french VARCHAR, english VARCHAR )
What is the French translation for the English word 'orange'?
SELECT french FROM table_2077192_2 WHERE english = "orange"
CREATE TABLE table_35542 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text )
What is the lowest overall for a quarterback with fewer than 7 rounds?
SELECT MIN("Overall") FROM table_35542 WHERE "Position" = 'quarterback' AND "Round" < '7'
CREATE TABLE table_name_34 ( country VARCHAR )
What is the lowest number of participants in 2013 when there were more than 5 participants in 2010, less than 4 participants in 2012 and country was germany?
SELECT MIN(2013) FROM table_name_34 WHERE 2010 > 5 AND country = "germany" AND 2012 < 4
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
FILMVID 490 has been taught by who in the past ?
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN semester...
CREATE TABLE table_70025 ( "Season" text, "Competition" text, "Round" text, "Club" text, "Home" text, "Away" text, "Aggregate" text )
Which round did Dundee United end in?
SELECT "Round" FROM table_70025 WHERE "Club" = 'dundee united'
CREATE TABLE table_54518 ( "Species" text, "Strain" text, "Type" text, "Base Pairs" real, "Genes" real )
What species has more than 2,030 genes?
SELECT "Species" FROM table_54518 WHERE "Genes" > '2,030'
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE code_des...
show me flights from DENVER to BOSTON on thursday
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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND date_day.day_number = 24 AND date_day.month_number = 5 AND da...
CREATE TABLE table_67186 ( "Year" real, "Class" text, "Team" text, "Points" real, "Rank" text, "Wins" real )
Name the least wins for 6 points
SELECT MIN("Wins") FROM table_67186 WHERE "Points" = '6'
CREATE TABLE table_56711 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
Who is the driver for laps of 45
SELECT "Driver" FROM table_56711 WHERE "Laps" = '45'
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, ...
what is maximum age of patients whose gender is m and admission type is emergency?
SELECT MAX(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.admission_type = "EMERGENCY"
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 is the difference between the hct of patient 030-8973 second measured on the first hospital visit compared to the first value measured on the first hospital visit?
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-8973' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospit...
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE treatment ( ...
what are the four most frequent procedures that patients were given during the same month after receiving medicine consultation in the previous year?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'medicine consultation' AND DATETIME(trea...
CREATE TABLE Companies ( Industry VARCHAR, Headquarters VARCHAR )
Show the industries shared by companies whose headquarters are 'USA' and companies whose headquarters are 'China'.
SELECT Industry FROM Companies WHERE Headquarters = "USA" INTERSECT SELECT Industry FROM Companies WHERE Headquarters = "China"
CREATE TABLE table_61457 ( "Date" text, "Tournament" text, "Surface" text, "Partnering" text, "Opponent in the final" text, "Score" text )
Name the Opponent in the final on july 4, 2005?
SELECT "Opponent in the final" FROM table_61457 WHERE "Date" = 'july 4, 2005'
CREATE TABLE table_11664 ( "Year" real, "Tournament" text, "Venue" text, "Result" text, "Extra" text )
What is the latest year in Annecy, France?
SELECT MAX("Year") FROM table_11664 WHERE "Venue" = 'annecy, france'
CREATE TABLE table_203_642 ( id number, "name" text, "quadrant" text, "sector" text, "ward" text, "type" text, "2012\npopulation\nrank" number, "population\n(2012)" number, "population\n(2011)" number, "% change" number, "dwellings\n(2012)" number, "area\n(km2)" number, ...
how many industrial neighborhoods exist in calgary ?
SELECT COUNT(*) FROM table_203_642 WHERE "type" = 'industrial'
CREATE TABLE table_11214 ( "Week" text, "Date" text, "Opponent" text, "Result" text, "Kickoff [a ]" text, "Game site" text, "Attendance" text, "Record" text )
What was the score on September 1, 1996?
SELECT "Result" FROM table_11214 WHERE "Date" = 'september 1, 1996'
CREATE TABLE table_name_63 ( first_season_in_first_division VARCHAR, first_season_after_most_recent_promotion VARCHAR, name VARCHAR )
When was Alianza's first season in first division with a promotion after 1959?
SELECT first_season_in_first_division FROM table_name_63 WHERE first_season_after_most_recent_promotion = "1959" AND name = "alianza"
CREATE TABLE table_80084 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
Who used Gordini Straight-6 in 1956?
SELECT "Entrant" FROM table_80084 WHERE "Engine" = 'gordini straight-6' AND "Year" = '1956'
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 t...
how many patients were born before the year 2041 and had 3761 as their procedure icd9 code?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2041" AND procedures.icd9_code = "3761"
CREATE TABLE table_42688 ( "Spoofed Title" text, "Writer" text, "Artist" text, "Issue" real, "Date" text )
Who was the artist for Spoofed title Genteel Ben in an issue later than 74?
SELECT "Artist" FROM table_42688 WHERE "Issue" > '74' AND "Spoofed Title" = 'genteel ben'
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 TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL v...
For all employees who have the letters D or S in their first name, visualize a scatter chart about the correlation between employee_id and salary .
SELECT EMPLOYEE_ID, SALARY FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
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...
provide the number of patients whose drug code is levo500pm?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "LEVO500PM"
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 ) CRE...
Questions by month per tag. Question count for a particular tag
SELECT TIME_TO_STR(p.CreationDate, '%Y') AS Year, TIME_TO_STR(p.CreationDate, '%m') AS Month, COUNT(*) AS questions FROM Posts AS p JOIN PostTags AS pt ON pt.PostId = p.Id JOIN Tags AS t ON t.Id = pt.TagId GROUP BY TIME_TO_STR(p.CreationDate, '%Y'), TIME_TO_STR(p.CreationDate, '%m') ORDER BY TIME_TO_STR(p.CreationDate,...
CREATE TABLE table_71374 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text )
Name the played with lost of 5
SELECT "Played" FROM table_71374 WHERE "Lost" = '5'
CREATE TABLE table_26544 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real )
What is the production code for episode number 86 in the series?
SELECT MIN("Production code") FROM table_26544 WHERE "No. in series" = '86'
CREATE TABLE table_203_751 ( id number, "year" number, "title" text, "peak chart positions\nus\nair" number, "peak chart positions\nus\nmain" number, "peak chart positions\nus\nmod" number, "album" text )
which album had the most chart reaching singles ?
SELECT "album" FROM table_203_751 GROUP BY "album" ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE table_name_9 ( notes VARCHAR, date VARCHAR )
What is Notes, when Date is 2007?
SELECT notes FROM table_name_9 WHERE date = "2007"
CREATE TABLE table_200_22 ( id number, "year" number, "single" text, "peak chart positions\nger" number, "peak chart positions\nire" number, "peak chart positions\nuk" number, "peak chart positions\nus" number, "peak chart positions\nus\nmain" number, "peak chart positions\nus\ndance...
on what album did the single old habits die hard appear ?
SELECT "year" FROM table_200_22 WHERE "single" = '"old habits die hard"'
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients (...
tell me the length of the last stay of patient 12938 in the icu.
SELECT STRFTIME('%j', icustays.outtime) - STRFTIME('%j', icustays.intime) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12938) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1
CREATE TABLE Settlements ( Settlement_ID INTEGER, Claim_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER, Customer_Policy_ID INTEGER ) CREATE TABLE Customers ( Customer_ID INTEGER, Customer_Details VARCHAR(255) ) CREATE TABLE...
Please use a bar chart to show the total amount of payment by each payment method code, and rank by the Payment_Method_Code in ascending.
SELECT Payment_Method_Code, SUM(Amount_Payment) FROM Payments GROUP BY Payment_Method_Code ORDER BY Payment_Method_Code
CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, ...
Would SAC 480 be easier than SAC 600 ?
SELECT COUNT(*) > 0 FROM course AS COURSE_0, course AS COURSE_1, program_course AS PROGRAM_COURSE_0, program_course AS PROGRAM_COURSE_1 WHERE COURSE_0.department = 'SAC' AND COURSE_0.number = 600 AND COURSE_1.department = 'SAC' AND COURSE_1.number = 480 AND PROGRAM_COURSE_0.course_id = COURSE_0.course_id AND PROGRAM_CO...
CREATE TABLE table_41955 ( "Tournament" text, "1993" text, "1994" text, "1995" text, "1996" text, "1997" text, "1998" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text...
What is 2009, when 2008 is 1R, and when Tournament is French Open?
SELECT "2009" FROM table_41955 WHERE "2008" = '1r' AND "Tournament" = 'french open'
CREATE TABLE table_2508633_11 ( college VARCHAR, nfl_team VARCHAR )
How many colleges have the NFL Team Buffalo Bills?
SELECT COUNT(college) FROM table_2508633_11 WHERE nfl_team = "Buffalo Bills"
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Return a bar chart about the distribution of ACC_Road and the sum of Team_ID , and group by attribute ACC_Road, list in desc by the Y please.
SELECT ACC_Road, SUM(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY SUM(Team_ID) DESC
CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT ) CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER )
How many people are under 40 for each gender. Plot them as bar chart.
SELECT gender, COUNT(*) FROM Person WHERE age < 40 GROUP BY gender
CREATE TABLE table_27533947_1 ( players VARCHAR, grand_average VARCHAR )
If the grand average is 12.76-202, who is the player?
SELECT players FROM table_27533947_1 WHERE grand_average = "12.76-202"
CREATE TABLE manager_half ( player_id TEXT, year INTEGER, team_id TEXT, league_id TEXT, inseason INTEGER, half INTEGER, g INTEGER, w INTEGER, l INTEGER, rank INTEGER ) CREATE TABLE pitching ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_i...
bin the yearid into the day of the week interval and count them for visualizing a bar chart.
SELECT yearid, COUNT(yearid) FROM hall_of_fame
CREATE TABLE table_name_7 ( team VARCHAR )
Who is the 2008 head coach of UCLA?
SELECT 2008 AS _head_coach FROM table_name_7 WHERE team = "ucla"
CREATE TABLE table_21100348_11 ( player VARCHAR, runs VARCHAR )
What player has 477 runs?
SELECT player FROM table_21100348_11 WHERE runs = 477
CREATE TABLE table_6460 ( "District" text, "2010 Population (000)" real, "2008 GDP (USD bn) a" real, "2008 GDP per capita (USD) a" real, "Agri culture b" real, "Mining b" real, "Manufac turing b" real, "Services & cons truction b" real, "Exports (USD mn) 2011" text, "Median mo. s...
Agri culture b larger than 12.6, what is the lowest vehicles per 1000?
SELECT MIN("Vehicles (per 1000) d") FROM table_6460 WHERE "Agri culture b" > '12.6'
CREATE TABLE table_72853 ( "Game" real, "Date" text, "Opponent" text, "Score/Time" text, "High points" text, "High rebounds" text, "High assists" text, "Arena/Attendance" text, "Record" text )
name the date where score time is w 74-63
SELECT "Date" FROM table_72853 WHERE "Score/Time" = 'W 74-63'
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 demographic (...
let me know the number of patients born before 1882 who had delta abnormal lab test status.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "1882" AND lab.flag = "delta"
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId ...
Top SO Users from Malaga.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%malaga%' OR UPPER(Location) LIKE '%MALAGA%' OR Location LIKE '%Malaga%' AND Reputation >= 1000 ORDER BY Reputation DESC
CREATE TABLE table_name_45 ( rank INTEGER, population_density___km_2__ VARCHAR, _percentage_growth__2006_11_ VARCHAR )
What was the highest rank of an area with a population density larger than 5.7 and a 2006 2011 percentage growth of 5.7%?
SELECT MAX(rank) FROM table_name_45 WHERE population_density___km_2__ > 5.7 AND _percentage_growth__2006_11_ = "5.7%"
CREATE TABLE table_26734 ( "Year" text, "Championship" text, "54 holes" text, "Winning score" text, "Margin" text, "Runner(s)-up" text )
In what tournament was the difference only 1 stroke and 54 holes with a 2 shot deficit?
SELECT "Championship" FROM table_26734 WHERE "Margin" = '1 stroke' AND "54 holes" = '2 shot deficit'
CREATE TABLE table_name_27 ( score VARCHAR, date VARCHAR )
What was the score on January 12?
SELECT score FROM table_name_27 WHERE date = "january 12"
CREATE TABLE table_72984 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Raiders points" real, "Opponents" real, "Raiders first downs" real, "Record" text, "Attendance" real )
Who was the game attended by 60425 people played against?
SELECT "Opponent" FROM table_72984 WHERE "Attendance" = '60425'
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For each manufacturer, what are the names and prices of their most expensive product?, and order y axis in descending order.
SELECT T1.Name, MAX(T1.Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY MAX(T1.Price) DESC
CREATE TABLE table_60136 ( "Name" text, "Position" text, "Height" text, "Weight" real, "Year" text, "Home Town" text )
What is the Year of the Player weighing 185?
SELECT "Year" FROM table_60136 WHERE "Weight" = '185'
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe tex...
top 10 users: Tunisia.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%tunis%' ORDER BY Reputation DESC LIMIT 10
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( ...
how many patients were tested since 3 years ago for sputum, expectorated?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT microlab.patientunitstayid FROM microlab WHERE microlab.culturesite = 'sputum, expectorated' AND DATETIME(microlab.culturetakentime) >= DATETIME(CURRENT_TIME(), '-3 year'))
CREATE TABLE table_train_78 ( "id" int, "mini_mental_state_examination_mmse" int, "consent" bool, "swallow_oral_medication" bool, "rosen_modified_hachinski_ischemic_score" int, "NOUSE" float )
subject must have a screening mini _ mental state examination score of 16 _ 26 .
SELECT * FROM table_train_78 WHERE mini_mental_state_examination_mmse >= 16 AND mini_mental_state_examination_mmse <= 26
CREATE TABLE table_dev_6 ( "id" int, "gender" string, "systolic_blood_pressure_sbp" int, "heart_disease" bool, "renal_disease" bool, "hematocrit_hct" float, "creatinine_clearance_cl" float, "diastolic_blood_pressure_dbp" int, "symptomatic_coronary_artery_disease" bool, "hypertens...
uncontrolled hypertension ( resting blood pressure > 140 / 90 )
SELECT * FROM table_dev_6 WHERE hypertension = 1 OR systolic_blood_pressure_sbp > 140 OR diastolic_blood_pressure_dbp > 90