table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d...
how much is the cost of a drug called dorzolamide 2% ophth. soln.?
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'prescriptions' AND cost.event_id IN (SELECT prescriptions.row_id FROM prescriptions WHERE prescriptions.drug = 'dorzolamide 2% ophth. soln.')
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, war...
since 6 years ago, how many times patient 80119 had visited the hospital?
SELECT COUNT(DISTINCT admissions.hadm_id) FROM admissions WHERE admissions.subject_id = 80119 AND DATETIME(admissions.admittime) >= DATETIME(CURRENT_TIME(), '-6 year')
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
Name the 3 -credit courses .
SELECT DISTINCT name, number FROM course WHERE credits = 3 AND department = 'EECS'
CREATE TABLE appointment ( Physician VARCHAR ) CREATE TABLE physician ( name VARCHAR, EmployeeID VARCHAR )
List the name of physicians who took some appointment.
SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID
CREATE TABLE Student ( StuID VARCHAR, age INTEGER )
Show all student ids who are older than 20.
SELECT StuID FROM Student WHERE age > 20
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE instructor ( instructo...
Could I take class HHCR 710 as Core ?
SELECT COUNT(*) > 0 FROM course, program, program_course WHERE course.department = 'HHCR' AND course.number = 710 AND program_course.category LIKE '%Core%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id
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 countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE T...
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of email and salary in a bar chart, list in asc by the x-axis.
SELECT EMAIL, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMAIL
CREATE TABLE table_name_43 ( body VARCHAR, year VARCHAR )
What body participated in 1973?
SELECT body FROM table_name_43 WHERE year = "1973"
CREATE TABLE table_name_3 ( country VARCHAR, iata VARCHAR )
Which country has an IATA of JFK?
SELECT country FROM table_name_3 WHERE iata = "jfk"
CREATE TABLE Person ( job VARCHAR, age INTEGER, gender VARCHAR )
What is average age of male for different job title?
SELECT AVG(age), job FROM Person WHERE gender = 'male' GROUP BY job
CREATE TABLE table_204_756 ( id number, "year" number, "team" text, "games" number, "combined tackles" number, "tackles" number, "assisted tackles" number, "sacks" number, "forced fumbles" number, "fumble recoveries" number, "fumble return yards" number, "interceptions" n...
how many years did he play in less than 16 games ?
SELECT COUNT("year") FROM table_204_756 WHERE "games" < 16
CREATE TABLE table_name_63 ( score VARCHAR, partnering VARCHAR )
which Score has a Partnering of dmitry tursunov?
SELECT score FROM table_name_63 WHERE partnering = "dmitry tursunov"
CREATE TABLE table_15835 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" text )
What year did Elf Team Tyrrell have 34 points?
SELECT AVG("Year") FROM table_15835 WHERE "Entrant" = 'elf team tyrrell' AND "Points" = '34'
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...
calculate the maximum age of unmarried patients who have gangrene primary disease.
SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.diagnosis = "GANGRENE"
CREATE TABLE College ( cName varchar(20), state varchar(2), enr numeric(5,0) ) CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3) ) CREATE TABLE Player ( pID numeric(5,0), pName varchar(20), yCard varchar(3), HS numeric(5,0) )
How many students participated in tryouts for each college by descennding count. Show a pie chart.
SELECT cName, COUNT(*) FROM Tryout GROUP BY cName ORDER BY COUNT(*) DESC
CREATE TABLE table_name_54 ( byes INTEGER, benalla_dfl VARCHAR, wins VARCHAR )
What are the average byes of Bonnie Doon having more than 16 wins?
SELECT AVG(byes) FROM table_name_54 WHERE benalla_dfl = "bonnie doon" AND wins > 16
CREATE TABLE Circulation_History ( document_id INTEGER, draft_number INTEGER, copy_number INTEGER, employee_id INTEGER ) CREATE TABLE Roles ( role_code CHAR(15), role_description VARCHAR(255) ) CREATE TABLE Documents_Mailed ( document_id INTEGER, mailed_to_address_id INTEGER, maili...
Give me the trend of how many receipt date by receipt date, and could you show in asc by the receipt_date?
SELECT receipt_date, COUNT(receipt_date) FROM Documents ORDER BY receipt_date
CREATE TABLE table_42620 ( "Name" text, "Position" text, "Number" real, "School/Club Team" text, "Season" text, "Acquisition via" text )
How did the School/Club Team of Manuel Luis Quezon acquire their Forward?
SELECT "Acquisition via" FROM table_42620 WHERE "Position" = 'forward' AND "School/Club Team" = 'manuel luis quezon'
CREATE TABLE table_49221 ( "Round" real, "Pick" text, "Player" text, "Position" text, "School/Club Team" text )
What is the WR player?
SELECT "Player" FROM table_49221 WHERE "Position" = 'wr'
CREATE TABLE table_name_15 ( attendance VARCHAR, date VARCHAR )
Name the attendance on april 17
SELECT attendance FROM table_name_15 WHERE date = "april 17"
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, a...
what are the three most common procedures that followed within 2 months for patients who were given a contrast arteriogram-leg?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, 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 = admi...
CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as ...
What are the courses offered this semester ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016 ORDER BY course.department
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE aircraft (...
show flights from PITTSBURGH into SAN FRANCISCO
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 = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN...
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 whose age is less than 81 and days of hospital stay is greater than 29?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "81" AND demographic.days_stay > "29"
CREATE TABLE table_47031 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High assists" text, "Location Attendance" text, "Record" text )
What is the record of game 26 with beno udrih (4) as the highest assists?
SELECT "Record" FROM table_47031 WHERE "High assists" = 'beno udrih (4)' AND "Game" = '26'
CREATE TABLE head ( head_ID int, name text, born_state text, age real ) CREATE TABLE management ( department_ID int, head_ID int, temporary_acting text ) CREATE TABLE department ( Department_ID int, Name text, Creation text, Ranking int, Budget_in_Billions real, Num...
I want to see trend of the average of budget in billions by creation
SELECT Creation, AVG(Budget_in_Billions) FROM department
CREATE TABLE table_name_92 ( winner VARCHAR, finalist VARCHAR )
Who was the winner against finalist Lina Krasnoroutskaya?
SELECT winner FROM table_name_92 WHERE finalist = "lina krasnoroutskaya"
CREATE TABLE table_48509 ( "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, "Career WR"...
What is 2000, when 1996 is 'A', when 1997 is 'A', and when 2007 is 'A'?
SELECT "2000" FROM table_48509 WHERE "1996" = 'a' AND "1997" = 'a' AND "2007" = 'a'
CREATE TABLE table_59095 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" text, "Finish" text )
What is the maximum total when the To par is +3?
SELECT MAX("Total") FROM table_59095 WHERE "To par" = '+3'
CREATE TABLE table_name_62 ( venue VARCHAR, away_team VARCHAR )
Where did Geelong play as the away team?
SELECT venue FROM table_name_62 WHERE away_team = "geelong"
CREATE TABLE table_34997 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" text, "Record" text )
What date has ny islanders as the visitor?
SELECT "Date" FROM table_34997 WHERE "Visitor" = 'ny islanders'
CREATE TABLE table_48512 ( "Year" real, "Award" text, "Nominated Work" text, "Category" text, "Result" text )
Before the year 2012, what award was given to the artist in the category of revelaci n pop del a o?
SELECT "Award" FROM table_48512 WHERE "Year" < '2012' AND "Category" = 'revelación pop del año'
CREATE TABLE table_53603 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
What is the average attendance on april 24?
SELECT AVG("Attendance") FROM table_53603 WHERE "Date" = 'april 24'
CREATE TABLE architect ( id text, name text, nationality text, gender text ) CREATE TABLE bridge ( architect_id int, id int, name text, location text, length_meters real, length_feet real ) CREATE TABLE mill ( architect_id int, id int, location text, name text, ...
What are the ids and names of the architects who built at least 3 bridges , and rank y-axis in desc order.
SELECT T1.name, T1.id FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id ORDER BY T1.id DESC
CREATE TABLE table_name_2 ( d_46_√ VARCHAR, d_43_√ VARCHAR )
What is the D 46 with a D 43 with r 3?
SELECT d_46_√ FROM table_name_2 WHERE d_43_√ = "r 3"
CREATE TABLE table_name_93 ( loses INTEGER, points VARCHAR, points_against VARCHAR, club VARCHAR )
What are the highest losses that have points agaisnt less than 956, high park demons as the club, and points less than 16?
SELECT MAX(loses) FROM table_name_93 WHERE points_against < 956 AND club = "high park demons" AND points < 16
CREATE TABLE table_63443 ( "Rank" real, "Rowers" text, "Country" text, "Time" text, "Notes" text )
What rank was the team from Australia?
SELECT COUNT("Rank") FROM table_63443 WHERE "Country" = 'australia'
CREATE TABLE table_71700 ( "Name" text, "Years" text, "Gender" text, "Area" text, "Authority" text, "Decile" real, "Roll" real )
Name the sum of roll for morrinsville school
SELECT SUM("Roll") FROM table_71700 WHERE "Name" = 'morrinsville school'
CREATE TABLE Customers_Cards ( card_id INTEGER, customer_id INTEGER, card_type_code VARCHAR(15), card_number VARCHAR(80), date_valid_from DATETIME, date_valid_to DATETIME, other_card_details VARCHAR(255) ) CREATE TABLE Accounts ( account_id INTEGER, customer_id INTEGER, account_...
Draw a bar chart of transaction type versus the total number, and rank from low to high by the names.
SELECT transaction_type, COUNT(*) FROM Financial_Transactions GROUP BY transaction_type ORDER BY transaction_type
CREATE TABLE section ( course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), building varchar(15), room_number varchar(7), time_slot_id varchar(4) ) CREATE TABLE takes ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), ...
How many courses are provided in each year? Visualize with a group line chart grouping by semester, I want to order X from in desc order.
SELECT year, COUNT(*) FROM section GROUP BY semester ORDER BY year DESC
CREATE TABLE All_Documents ( Document_ID INTEGER, Date_Stored DATETIME, Document_Type_Code CHAR(15), Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Document_Locations ( Document_ID INTEGER, Location_Code CHAR(15), Date_in_Location_...
Show all role codes and the number of employees in each role by a bar chart.
SELECT Role_Code, COUNT(*) FROM Employees GROUP BY Role_Code
CREATE TABLE table_25751 ( "Position" real, "Driver" text, "Points" real, "Starts" real, "Wins" real, "Top 5s" real, "Top 10s" real, "Winnings ($)" real )
How many starts are there?
SELECT MIN("Starts") FROM table_25751
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 demographic (...
give me the number of patients who had single internal mammary-coronary artery bypass.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.short_title = "1 int mam-cor art bypass"
CREATE TABLE table_53324 ( "Unit" text, "Reactor Type" text, "Net Capacity" text, "Gross Capacity" text, "Construction Start" text, "Grid Connection" text, "Commercial Operation" text, "Status" text )
What is the gross capacity of the unit that started commercial operation on August 28, 1987?
SELECT "Gross Capacity" FROM table_53324 WHERE "Commercial Operation" = 'august 28, 1987'
CREATE TABLE table_72485 ( "N" real, "P" text, "Name" text, "EU" text, "Country" text, "Age" real, "Type" text, "Moving from" text, "Transfer window" text, "Ends" text, "Transfer fee" text, "Source" text )
What is the type of the player whose transfer fee was 20m?
SELECT "Type" FROM table_72485 WHERE "Transfer fee" = '€20M'
CREATE TABLE table_11157122_5 ( yards VARCHAR, attempts VARCHAR )
How many yards did the player with 87 attempts rush?
SELECT yards FROM table_11157122_5 WHERE attempts = 87
CREATE TABLE table_75986 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
Which Score has smaller than 1994, and a Partner of elizabeth sayers smylie?
SELECT "Score" FROM table_75986 WHERE "Year" < '1994' AND "Partner" = 'elizabeth sayers smylie'
CREATE TABLE table_20819 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "College" text )
How many players named Jeff Brown were drafted
SELECT COUNT("Position") FROM table_20819 WHERE "Player" = 'Jeff Brown'
CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3) ) CREATE TABLE Player ( pID numeric(5,0), pName varchar(20), yCard varchar(3), HS numeric(5,0) ) CREATE TABLE College ( cName varchar(20), state varchar(2), enr numeric(5,0) )
Find cName and enr , and visualize them by a bar chart.
SELECT cName, enr FROM College ORDER BY enr
CREATE TABLE table_train_165 ( "id" int, "gender" string, "hemoglobin_a1c_hba1c" float, "visual_impairment" bool, "blood_glucose" int, "body_mass_index_bmi" float, "a1c" float, "age" float, "NOUSE" float )
must have a bmi equal to or greater than 30
SELECT * FROM table_train_165 WHERE body_mass_index_bmi >= 30
CREATE TABLE table_42631 ( "Rank" real, "Song title" text, "Composer(s)" text, "Performer(s)" text, "Year" real )
Who sang the song composed by Mariah Carey and Walter Afanasieff?
SELECT "Performer(s)" FROM table_42631 WHERE "Composer(s)" = 'mariah carey and walter afanasieff'
CREATE TABLE table_dev_26 ( "id" int, "gender" string, "hemoglobin_a1c_hba1c" float, "dyslipidemia" bool, "body_weight" float, "hba1c" float, "body_mass_index_bmi" float, "hypertension" bool, "NOUSE" float )
hba1c > 7 % and not to exceed 10.5 % .
SELECT * FROM table_dev_26 WHERE hba1c > 7 AND hemoglobin_a1c_hba1c < 10.5
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetake...
what's patient 011-53628's minimum value of alkaline phos. in 03/this year?
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 = '011-53628')) AND lab.labname = 'alkaline phos.' AND DATETIME(lab.labresulttime, 's...
CREATE TABLE table_37959 ( "Date" text, "Time" text, "Score" text, "Set 1" text, "Set 2" text, "Set 3" text, "Total" text )
Which Total has a Score of 1 3, and a Set 1 of 29 31?
SELECT "Total" FROM table_37959 WHERE "Score" = '1–3' AND "Set 1" = '29–31'
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 language of subject name charles deshay?
SELECT demographic.language FROM demographic WHERE demographic.name = "Charles Deshay"
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) 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, insuranc...
what was the top five most frequent drugs prescribed to patients in the same month after the diagnosis of ac kidny fail, tubr necr?
SELECT t3.drug FROM (SELECT t2.drug, 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_icd_diagnoses WHERE ...
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, find name and manufacturer , and group by attribute founder, and visualize them by a bar chart.
SELECT T1.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name
CREATE TABLE table_66764 ( "Rank" real, "Year" real, "Name" text, "Moving from" text, "Moving to" text )
The player with a rank of 9, made a move from what football club?
SELECT "Moving from" FROM table_66764 WHERE "Rank" = '9'
CREATE TABLE table_261941_1 ( founded VARCHAR, type VARCHAR )
When was the private/baptist school founded?
SELECT founded FROM table_261941_1 WHERE type = "Private/Baptist"
CREATE TABLE table_name_1 ( location VARCHAR, opponent VARCHAR )
Where was the location where justin robbins fought against billy kidd?
SELECT location FROM table_name_1 WHERE opponent = "billy kidd"
CREATE TABLE table_160510_1 ( capital VARCHAR, hanja VARCHAR )
The hanja is for what capital?
SELECT capital FROM table_160510_1 WHERE hanja = "尙州"
CREATE TABLE table_76384 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" text, "Location" text )
Where was the fight located that lasted 1 round against luiz claudio das dores?
SELECT "Location" FROM table_76384 WHERE "Round" = '1' AND "Opponent" = 'luiz claudio das dores'
CREATE TABLE table_62241 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the nation when bronze is less than 7, gold is larger than 0, total is larger than 7, and silver is smaller than 3?
SELECT "Nation" FROM table_62241 WHERE "Bronze" < '7' AND "Gold" > '0' AND "Total" > '7' AND "Silver" < '3'
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) 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 departments ( DEP...
For all employees who have the letters D or S in their first name, give me the comparison about the average of manager_id over the job_id , and group by attribute job_id.
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID
CREATE TABLE table_name_24 ( event VARCHAR, opponent VARCHAR, res VARCHAR, round VARCHAR )
Which event is a win by an opponent of Nicolas Smith, with the round marked n/a?
SELECT event FROM table_name_24 WHERE res = "win" AND round = "n/a" AND opponent = "nicolas smith"
CREATE TABLE table_name_64 ( byes INTEGER, against VARCHAR, wins VARCHAR, benalla_dfl VARCHAR )
What is the highest value for Byes, when Wins is less than 16, when Benalla DFL is 'Swanpool', and when Against is less than 2177?
SELECT MAX(byes) FROM table_name_64 WHERE wins < 16 AND benalla_dfl = "swanpool" AND against < 2177
CREATE TABLE table_42628 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text )
Which average against has a lost less than 1?
SELECT AVG("Against") FROM table_42628 WHERE "Lost" < '1'
CREATE TABLE table_27755603_11 ( game VARCHAR, team VARCHAR )
What numbered game did they play chicago?
SELECT game FROM table_27755603_11 WHERE team = "Chicago"
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, ...
how many times do patient 002-62783 get a magnesium test until 2103?
SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-62783')) AND lab.labname = 'magnesium' AND STRFTIME('%y', lab.labresulttime) <= '2103'
CREATE TABLE table_43268 ( "Date" text, "Label" text, "Format" text, "Country" text, "Catalog" text )
What is the Catalog with a Format of lp, a Country of us, a Label of sundazed, and a Date of 2006?
SELECT "Catalog" FROM table_43268 WHERE "Format" = 'lp' AND "Country" = 'us' AND "Label" = 'sundazed' AND "Date" = '2006'
CREATE TABLE table_34961 ( "Eruptions" text, "Country" text, "Location" text, "Year" real, "Volcanic Explosivity Index" text, "Fatalities" text )
Which Eruptions have a Location of pacific ring of fire, and a Volcanic Explosivity Index of 6, and a Country of peru?
SELECT "Eruptions" FROM table_34961 WHERE "Location" = 'pacific ring of fire' AND "Volcanic Explosivity Index" = '6' AND "Country" = 'peru'
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 cost ( costid num...
what are the three most frequent drugs that were prescribed within 2 months to the patients of age 50s after having been diagnosed with cardiac arrest since 2101?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'cardiac arrest' AND STRFTIME('%y', diagnosis.diagn...
CREATE TABLE table_28035004_1 ( variant VARCHAR, bodybuilder VARCHAR )
What is the variant when Alexander was the bodybuilder?
SELECT variant FROM table_28035004_1 WHERE bodybuilder = "Alexander"
CREATE TABLE table_11391 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
How many laps are associated with a time of + 1:39.591?
SELECT "Laps" FROM table_11391 WHERE "Time/Retired" = '+ 1:39.591'
CREATE TABLE table_name_77 ( goal_difference INTEGER, losses VARCHAR, points VARCHAR, club VARCHAR )
Which Goal Difference has 28 Points, and a Club of cd cartagena, more than 15 losses?
SELECT MAX(goal_difference) FROM table_name_77 WHERE points = 28 AND club = "cd cartagena" AND losses > 15
CREATE TABLE table_38907 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
Who is the Visitor on march 16?
SELECT "Visitor" FROM table_38907 WHERE "Date" = 'march 16'
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...
Get the number of patients who have a jehovah's witness religious background and have a creatinine kinase mb isoenzyme lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.religion = "JEHOVAH'S WITNESS" AND lab.label = "Creatine Kinase, MB Isoenzyme"
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_...
fares and flights from BALTIMORE 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 = 'BALTIMORE' AND CITY_1.city_code = AI...
CREATE TABLE table_name_60 ( date VARCHAR, opponent VARCHAR, score VARCHAR )
Which date has a Opponent of juan m naco, and a Score of 6 2, 4 6, 7 6 (7 3)?
SELECT date FROM table_name_60 WHERE opponent = "juan mónaco" AND score = "6–2, 4–6, 7–6 (7–3)"
CREATE TABLE table_79402 ( "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is Turkey's average Gold entry that also has a Bronze entry that is smaller than 2 and the Total is greater than 1?
SELECT AVG("Gold") FROM table_79402 WHERE "Bronze" < '2' AND "Nation" = 'turkey' AND "Total" > '1'
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
graph of distribution of question view counts.
SELECT ViewCount / 100 AS Hundred_Views, COUNT(*) AS Nquestions FROM Posts WHERE PostTypeId = 1 GROUP BY ViewCount / 100 ORDER BY ViewCount / 100
CREATE TABLE table_name_81 ( average INTEGER, city VARCHAR )
What is the Average of bergen, norway?
SELECT MIN(average) FROM table_name_81 WHERE city = "bergen, norway"
CREATE TABLE table_19412902_1 ( clubs VARCHAR, group_stage VARCHAR, member_association VARCHAR )
which club in group stage 4 had member association iran
SELECT clubs FROM table_19412902_1 WHERE group_stage = 4 AND member_association = "Iran"
CREATE TABLE table_27455 ( "Rank" real, "Rider" text, "Sat 29 May" text, "Mon 31 May" text, "Tues 1 June" text, "Wed 2 June" text, "Thurs 3 June" text, "Fri 4 June" text )
If Thursday 3 June is 20' 27.93 110.615mph, what are the names of the riders?
SELECT "Rider" FROM table_27455 WHERE "Thurs 3 June" = '20'' 27.93 110.615mph'
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
count the number of patients whose days of hospital stay is greater than 10 and procedure long title is (aorto)coronary bypass of two coronary arteries?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "10" AND procedures.long_title = "(Aorto)coronary bypass of two coronary arteries"
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
count the number of patients whose admission location is clinic referral/premature and diagnoses icd9 code is 7069?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND diagnoses.icd9_code = "7069"
CREATE TABLE table_28192 ( "Metropolitan ring" text, "Localities" real, "Total" real, "Jews and others 1" real, "Thereof: Jews" real, "Arabs" real, "Population density (per km\u00b2)" text, "Annual Population growth rate" text )
What is the lowest jews and others 1 for the localities 11?
SELECT MIN("Jews and others 1") FROM table_28192 WHERE "Localities" = '11'
CREATE TABLE table_name_49 ( starts INTEGER, year VARCHAR, avg_start VARCHAR )
What was the highest number of starts in 2007 when the average start was over 17.6?
SELECT MAX(starts) FROM table_name_49 WHERE year = 2007 AND avg_start > 17.6
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 drug name is promethazine hcl?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Promethazine HCl"
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, ...
calculate the maximum days for which patients aged 79 years or more were hospitalized.
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.age >= "79"
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, ...
User Rank and Hoarded Rep.
SELECT p.Id AS "user_link", p.Ranking, SUBSTRING(CAST(CAST(Ranking AS FLOAT) / Count * 100.00 AS TEXT), 1, 6) + '%' AS Percentile, Reputation, SUBSTRING(CAST(CAST(Reputation AS FLOAT) / Sum * 100.00 AS TEXT), 1, 6) + '%' AS "Hoarded rep" FROM (SELECT Id, ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS Ranking, Reputati...
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, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ...
calculate the number of patients with item id 50983 who were provided phys referral/normal deli.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND lab.itemid = "50983"
CREATE TABLE table_12752 ( "Season" real, "Winners" text, "Total wins" real, "Runners-up" text, "Third-place" text, "Number of clubs" real )
What is the sum of the number of clubs in seasons before 1992 with more than 3 total wins?
SELECT SUM("Number of clubs") FROM table_12752 WHERE "Season" < '1992' AND "Total wins" > '3'
CREATE TABLE table_name_66 ( opponent VARCHAR, arena VARCHAR, date VARCHAR )
What is the Opponent at the Honda Center on March 29?
SELECT opponent FROM table_name_66 WHERE arena = "honda center" AND date = "march 29"
CREATE TABLE table_name_19 ( against INTEGER, draw VARCHAR, played VARCHAR )
What is the total against with 1 draw and less than 8 played?
SELECT SUM(against) FROM table_name_19 WHERE draw = 1 AND played < 8
CREATE TABLE table_32706 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Attendance" text )
Which opponent had an attendance of 40,070?
SELECT "Opponent" FROM table_32706 WHERE "Attendance" = '40,070'
CREATE TABLE table_69694 ( "Year" real, "Winners" text, "2nd place" text, "3rd place" text, "4th place" text )
Name the 3rd place with winners of weymouth wildcats and 4th place of boston barracudas
SELECT "3rd place" FROM table_69694 WHERE "Winners" = 'weymouth wildcats' AND "4th place" = 'boston barracudas'
CREATE TABLE table_1341865_40 ( district VARCHAR, incumbent VARCHAR )
What district is incumbent albert w. johnson from?
SELECT district FROM table_1341865_40 WHERE incumbent = "Albert W. Johnson"
CREATE TABLE table_74970 ( "Condition" text, "Prothrombin time" text, "Partial thromboplastin time" text, "Bleeding time" text, "Platelet count" text )
Which Condition has a Bleeding time of unaffected, and a Partial thromboplastin time of prolonged, and a Prothrombin time of unaffected?
SELECT "Condition" FROM table_74970 WHERE "Bleeding time" = 'unaffected' AND "Partial thromboplastin time" = 'prolonged' AND "Prothrombin time" = 'unaffected'
CREATE TABLE table_test_29 ( "id" int, "bleeding" int, "left_ventricular_ejection_fraction_lvef" int, "systolic_blood_pressure_sbp" int, "hemoglobin_a1c_hba1c" float, "heart_disease" bool, "trauma" bool, "renal_disease" bool, "creatinine_clearance_cl" float, "hemorrhagic_stroke" ...
history of hemorrhagic stroke.
SELECT * FROM table_test_29 WHERE hemorrhagic_stroke = 1