table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE table_name_4 ( diameter__km_ INTEGER, name VARCHAR, year_named VARCHAR )
Which Diameter (km) has a Name of alma-merghen planitia, and a Year named smaller than 1997?
SELECT MAX(diameter__km_) FROM table_name_4 WHERE name = "alma-merghen planitia" AND year_named < 1997
CREATE TABLE table_203_608 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
how many countries have at least one gold medal ?
SELECT COUNT("nation") FROM table_203_608 WHERE "gold" >= 1
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 those records from the products and each product's manufacturer, return a bar chart about the distribution of founder and the sum of code , and group by attribute founder, and order bar in ascending order.
SELECT T2.Founder, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Founder ORDER BY T2.Founder
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...
Draw a scatter chart about the correlation between Team_ID and All_Games_Percent , and group by attribute ACC_Regular_Season.
SELECT Team_ID, All_Games_Percent FROM basketball_match GROUP BY ACC_Regular_Season
CREATE TABLE table_18894744_6 ( high_rebounds VARCHAR, record VARCHAR )
Who did the high rebounds in the game with a 19-6 record?
SELECT high_rebounds FROM table_18894744_6 WHERE record = "19-6"
CREATE TABLE table_67712 ( "Status" text, "Name" text, "First Performance" text, "Last Performance" text, "Style" text )
What is the First Performance when the status is past and the style was ballet, tap?
SELECT "First Performance" FROM table_67712 WHERE "Status" = 'past' AND "Style" = 'ballet, tap'
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, v...
what was the top three of the most frequent procedures during this year?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of ye...
CREATE TABLE table_name_27 ( score VARCHAR, record VARCHAR )
What was the score of the Kings game when they had a record of 8 11 1?
SELECT score FROM table_name_27 WHERE record = "8–11–1"
CREATE TABLE table_29190 ( "Rank" real, "Rider" text, "Sat 21 Aug" text, "Mon 23 Aug" text, "Tues 24 Aug" text, "Wed 25 Aug" text, "Thurs 26 Aug" text, "Fri 27 Aug" text, "Sat 29 Aug" text )
When 21' 18.87 106.209mph is Tuesday August 24th what is Monday August 23rd?
SELECT "Mon 23 Aug" FROM table_29190 WHERE "Tues 24 Aug" = '21'' 18.87 106.209mph'
CREATE TABLE table_40086 ( "Name" text, "Status" text, "Authors" text, "Unit" text, "Location" text )
What country is the Jiufotang Formation located in?
SELECT "Location" FROM table_40086 WHERE "Unit" = 'jiufotang formation'
CREATE TABLE table_25920798_2 ( leader_battle VARCHAR, vote VARCHAR )
Name the leader battle for 4-3 vote
SELECT leader_battle FROM table_25920798_2 WHERE vote = "4-3"
CREATE TABLE claims_processing ( claim_processing_id number, claim_id number, claim_outcome_code text, claim_stage_id number, staff_id number ) CREATE TABLE claims_documents ( claim_id number, document_type_code text, created_by_staff_id number, created_date number ) CREATE TABLE c...
Find the names of the customers who have an deputy policy.
SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = "Deputy"
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 )
A bar chart for what are the number of the names of all products?
SELECT Name, COUNT(Name) FROM Products GROUP BY Name
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...
give me the number of patients whose gender is m and insurance is private?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.insurance = "Private"
CREATE TABLE table_57363 ( "No. in series" real, "No. in season" real, "Title" text, "Directed By" text, "Written By" text, "Original air date" text )
When did Julie gets Validated originally air?
SELECT "Original air date" FROM table_57363 WHERE "Title" = 'julie gets validated'
CREATE TABLE table_17350255_1 ( film_title_used_in_nomination VARCHAR, original_title VARCHAR )
What was the title used in nomination in the original B b i Zhu ngsh ( )?
SELECT film_title_used_in_nomination FROM table_17350255_1 WHERE original_title = "Bābǎi zhuàngshì (八百壯士)"
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE food_service ( meal_code text, meal_nu...
what is the fare on 11 7 going one way from SAN FRANCISCO to OAKLAND
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND C...
CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE author ( authorid int, authorname varchar ...
most cited papers on stochastic optimization
SELECT DISTINCT cite.citedpaperid, COUNT(cite.citedpaperid) FROM cite, keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'stochastic optimization' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = cite.citedpaperid AND paper.paperid = paperkeyphrase.paperid GROUP BY cite.citedpap...
CREATE TABLE table_name_38 ( goals VARCHAR, name VARCHAR, since VARCHAR, nat VARCHAR, transfer_fee VARCHAR )
How many goals was by Rix from Eng who started before 2005 in the youth system?
SELECT COUNT(goals) FROM table_name_38 WHERE nat = "eng" AND transfer_fee = "youth system" AND since < 2005 AND name = "rix"
CREATE TABLE table_48133 ( "Event" text, "Year" real, "Category" text, "Work" text, "Outcome" text )
What category was the winner in?
SELECT "Category" FROM table_48133 WHERE "Outcome" = 'winner'
CREATE TABLE table_477 ( "Stage" real, "Winner" text, "General classification" text, "Points classification" text, "Mountains classification" text, "Intergiro classification" text, "Trofeo Fast Team" text )
What is the intergiro classification of alexander gontchenkov?
SELECT "Intergiro classification" FROM table_477 WHERE "Winner" = 'Alexander Gontchenkov'
CREATE TABLE table_name_2 ( grid INTEGER, manufacturer VARCHAR, laps VARCHAR )
What is the average grid for vehicles manufactured by Aprilia and having run more than 16 laps?
SELECT AVG(grid) FROM table_name_2 WHERE manufacturer = "aprilia" AND laps > 16
CREATE TABLE table_66057 ( "School" text, "Location" text, "Mascot" text, "Enrollment" real, "IHSAA Class" text, "IHSAA Football Class" text, "County" text )
Which School has a Enrollment of 908?
SELECT "School" FROM table_66057 WHERE "Enrollment" = '908'
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number...
has patient 028-47306 been prescribed pneumococcal vac polyvalent 25 mcg/0.5ml ij inj carvedilol 12.5 mg po tabs or aspirin 81 mg po chew this year?
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-47306')) AND medication.drugname IN ('pneumococcal vac polyvalent 25 m...
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...
Of the Fall term classes offered , which are ITALIAN classes ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'ITALIAN' AND semester.semester = 'Fall'
CREATE TABLE Purchases ( purchase_transaction_id INTEGER, purchase_details VARCHAR(255) ) CREATE TABLE Sales ( sales_transaction_id INTEGER, sales_details VARCHAR(255) ) CREATE TABLE Transactions_Lots ( transaction_id INTEGER, lot_id INTEGER ) CREATE TABLE Ref_Transaction_Types ( transact...
Bar chart x axis date of transaction y axis mean share count, and show by the Y in descending.
SELECT date_of_transaction, AVG(share_count) FROM Transactions ORDER BY AVG(share_count) DESC
CREATE TABLE table_26637 ( "State (class)" text, "Vacator" text, "Reason for change" text, "Successor" text, "Date of successors formal installation" text )
What state had william bigler (d) as a successor)
SELECT "State (class)" FROM table_26637 WHERE "Successor" = 'William Bigler (D)'
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
give the number of patients who were diagnosed under icd9 code 7761.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.icd9_code = "7761"
CREATE TABLE table_name_82 ( time VARCHAR, nfl_recap VARCHAR, game_site VARCHAR )
What is the Time of the game at Arrowhead Stadium with an NFL Recap of recap?
SELECT time FROM table_name_82 WHERE nfl_recap = "recap" AND game_site = "arrowhead stadium"
CREATE TABLE table_24971 ( "#" text, "Spacecraft" text, "Spacewalkers" text, "Start ( UTC )" text, "End (UTC)" text, "Duration" text )
Who walked in space from STS-101 Eva 1?
SELECT "Spacewalkers" FROM table_24971 WHERE "Spacecraft" = 'STS-101 EVA 1'
CREATE TABLE Vehicles ( vehicle_details VARCHAR, vehicle_id VARCHAR )
Show the detail of vehicle with id 1.
SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1
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 lab ( subject_id text, hadm_id text, ...
count the number of patients whose gender is m and diagnoses icd9 code is 769?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.icd9_code = "769"
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 are the full names of all students
SELECT fname, lname FROM student
CREATE TABLE table_76939 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" real )
What is the To par of the Player with a Score of 70-71=141?
SELECT AVG("To par") FROM table_76939 WHERE "Score" = '70-71=141'
CREATE TABLE table_5139 ( "Season" text, "Series" text, "Races" real, "Poles" real, "Wins" real, "Podiums" real, "Points" real, "Position" text )
How many wins are associated with 20 points and over 1 podium?
SELECT SUM("Wins") FROM table_5139 WHERE "Points" = '20' AND "Podiums" > '1'
CREATE TABLE table_32387 ( "Player" text, "Home Town" text, "College/Prior" text, "Drafting Team" text, "Graduated" real )
Who drafted the player from Michigan after 2010?
SELECT "Drafting Team" FROM table_32387 WHERE "Graduated" > '2010' AND "College/Prior" = 'michigan'
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 whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, draw a line chart about the change of manager_id over hire_date , and list by the x-axis from high to low.
SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY HIRE_DATE DESC
CREATE TABLE table_203_444 ( id number, "week" number, "start date" text, "type" text, "tournament" text, "surface" text, "town" text, "country" text, "continent" text, "prize money" text )
what tournament came before the bnp paribas open ?
SELECT "tournament" FROM table_203_444 WHERE id = (SELECT id FROM table_203_444 WHERE "tournament" = 'bnp paribas open') - 1
CREATE TABLE table_20959 ( "Country" text, "Skip" text, "W" real, "L" real, "PF" real, "PA" real, "Ends Won" real, "Ends Lost" real, "Blank Ends F/A" text, "Stolen Ends For" real, "Stolen Ends Against" real, "Shot %" real )
Who was the skip when the stolen ends against was 13?
SELECT "Skip" FROM table_20959 WHERE "Stolen Ends Against" = '13'
CREATE TABLE table_26986076_5 ( mon_23_aug VARCHAR, tues_24_aug VARCHAR )
When 21' 18.87 106.209mph is Tuesday August 24th what is Monday August 23rd?
SELECT mon_23_aug FROM table_26986076_5 WHERE tues_24_aug = "21' 18.87 106.209mph"
CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Movie ( mID int, title text, year int, director text ) CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date )
For each director, return the highest rating among all of their movies and the value of that rating, group by director in a scatter, and Ignore movies whose director is NULL.
SELECT stars, MAX(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE director <> "null" GROUP BY director
CREATE TABLE table_15314901_1 ( coordinate_velocity_v_dx_dt_in_units_of_c VARCHAR, condition_parameter VARCHAR )
If the the condition/parameter is rapidity of 2 hyperbolic radians, what is the coordinate velocity v dx/dt in units of c?
SELECT coordinate_velocity_v_dx_dt_in_units_of_c FROM table_15314901_1 WHERE condition_parameter = "Rapidity of 2 hyperbolic radians"
CREATE TABLE table_11656578_2 ( voivodeship VARCHAR, population__1980_ VARCHAR )
How many different voivodenship have 747 900 citizes?
SELECT COUNT(voivodeship) FROM table_11656578_2 WHERE population__1980_ = "747 900"
CREATE TABLE table_66805 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
Name the score for september 25
SELECT "Score" FROM table_66805 WHERE "Date" = 'september 25'
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE diagnosis ( diagnosisid number...
until 1 year ago, what was the top four most frequent medicines prescribed to patients within the same month after having been diagnosed with dementia?
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 = 'dementia' AND DATETIME(diagnosis.diagnosistime) <=...
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, Cr...
How can I see who has the most of a certain badge?. https://meta.stackexchange.com/questions/302012/how-can-i-see-who-has-the-most-of-a-certain-badge
SELECT DISTINCT Name FROM Badges AS b
CREATE TABLE table_26198 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "School" text )
What CFL team was the player playing on SB position drafted for?
SELECT "CFL Team" FROM table_26198 WHERE "Position" = 'SB'
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_...
what are the fares for flights from CHARLOTTE to NEWARK on tuesday and wednesday
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight AS FLIGHT_0, flight AS FLIGHT_1, flight_fare AS FLIGHT_FARE, flight_fare ...
CREATE TABLE table_61711 ( "Name" text, "Position" text, "League Apps" text, "League Goals" real, "FA Cup Apps" text, "FA Cup Goals" real, "League Cup Apps" text, "League Cup Goals" real, "FLT Apps" text, "FLT Goals" real, "Total Apps" text, "Total Goals" real )
What is the maximum league cup goals when there has been 0 FA cup appearances, and MF is the position, with 1 league appearance, and smaller than 0 total goals?
SELECT MAX("League Cup Goals") FROM table_61711 WHERE "FA Cup Apps" = '0' AND "Position" = 'mf' AND "League Apps" = '1' AND "Total Goals" < '0'
CREATE TABLE table_name_63 ( date VARCHAR, venue VARCHAR )
On what date did the match at Lake Oval take place?
SELECT date FROM table_name_63 WHERE venue = "lake oval"
CREATE TABLE table_name_26 ( episode_title VARCHAR, countries_visited VARCHAR )
Which episode title featured a visit to the country of Cuba?
SELECT episode_title FROM table_name_26 WHERE countries_visited = "cuba"
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), ...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, visualize a bar chart about the distribution of hire_date and the amount of hire_date bin hire_date by weekday, list total number in desc order.
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY COUNT(HIRE_DATE) DESC
CREATE TABLE table_23949 ( "City (Utility)" text, "Residential Monthly usage: 1000 kWh" text, "Small power Power demand: 40 kW; Consumption 10,000 kWh, load factor: 35%." text, "Medium power Power demand: 1,000 kW; Consumption: 400,000 kWh, load factor: 56 %." text, "Large power Power demand: 50,000...
What is every value for large power demand when small power demand is 13.41?
SELECT "Large power Power demand: 50,000 kW; Consumption: 30,600,000 kWh, load factor: 85%." FROM table_23949 WHERE "Small power Power demand: 40 kW; Consumption 10,000 kWh, load factor: 35%." = '13.41'
CREATE TABLE table_30633 ( "Category" text, "Player" text, "Team" text, "Games played" real, "Totals" text, "Average" text )
Who was the team when the category is field goal percentage?
SELECT "Team" FROM table_30633 WHERE "Category" = 'Field goal percentage'
CREATE TABLE table_11220799_2 ( episode_titles VARCHAR, first_air_date VARCHAR )
How many episodes had their first air date on March 6, 2008?
SELECT COUNT(episode_titles) FROM table_11220799_2 WHERE first_air_date = "March 6, 2008"
CREATE TABLE technician ( technician_id number, name text, team text, starting_year number, age number ) CREATE TABLE machine ( machine_id number, making_year number, class text, team text, machine_series text, value_points number, quality_rank number ) CREATE TABLE rep...
List the names of technicians in ascending order of age.
SELECT name FROM technician ORDER BY age
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...
Give me the comparison about Team_ID over the ACC_Road , and group by attribute All_Home.
SELECT ACC_Road, Team_ID FROM basketball_match GROUP BY All_Home, ACC_Road
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CRE...
what was the first height of patient 031-13920 this month.
SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-13920') AND NOT patient.admissionheight IS NULL AND DATETIME(patient.unitadmittime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', ...
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 year of death is less than or equal to 2132 and diagnoses icd9 code is 7098?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dod_year <= "2132.0" AND diagnoses.icd9_code = "7098"
CREATE TABLE invoices ( customer_id VARCHAR ) CREATE TABLE customers ( id VARCHAR, first_name VARCHAR, last_name VARCHAR )
How many orders does Lucas Mancini has?
SELECT COUNT(*) 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_94 ( losses VARCHAR, wins VARCHAR, draws VARCHAR )
What is the total number of losses with less than 6 wins and less than 0 draws?
SELECT COUNT(losses) FROM table_name_94 WHERE wins < 6 AND draws < 0
CREATE TABLE table_name_63 ( overall VARCHAR, name VARCHAR, round VARCHAR )
how many times is the name Derek Smith when the round is higher than 3?
SELECT COUNT(overall) FROM table_name_63 WHERE name = "derek smith" AND round > 3
CREATE TABLE table_name_32 ( enrollment INTEGER, location VARCHAR )
COunt the average Enrollment in hope?
SELECT AVG(enrollment) FROM table_name_32 WHERE location = "hope"
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE Apartment_Facilities ( apt_id I...
What is the number of start dates of each apartment booking for each weekday? Return a bar chart, show y axis in ascending order.
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id ORDER BY COUNT(booking_start_date)
CREATE TABLE table_name_17 ( school VARCHAR, event VARCHAR )
What is School, when Event is '100 Backstroke'?
SELECT school FROM table_name_17 WHERE event = "100 backstroke"
CREATE TABLE table_18214 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Status" text, "Opponent" text )
How many republican incumbents first elected in 1974?
SELECT COUNT("Incumbent") FROM table_18214 WHERE "Party" = 'Republican' AND "First elected" = '1974'
CREATE TABLE table_name_82 ( score VARCHAR, tie_no VARCHAR )
What is Score, when Tie No is '30'?
SELECT score FROM table_name_82 WHERE tie_no = "30"
CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) 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_gradu...
Which professor is running the ULCS classes next Winter ?
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instr...
CREATE TABLE table_67126 ( "Year" real, "Event" text, "Venue" text, "Driver" text, "Result" text )
Where was the BRDC International Trophy with driver Emerson Fittipaldi held?
SELECT "Venue" FROM table_67126 WHERE "Driver" = 'emerson fittipaldi' AND "Event" = 'brdc international trophy'
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airlin...
please list all flights from PHILADELPHIA to BOSTON
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 = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'B...
CREATE TABLE table_22515 ( "Number" real, "Sanskrit" text, "International Alphabet of Sanskrit Transliteration" text, "Sanskrit gloss" text, "Western name" text, "Greek" text, "Gloss" text, "Tattva (Element)" text, "Quality" text, "Ruling Planet" text )
When scorpion is the sankrit gloss how many qualities are there?
SELECT COUNT("Quality") FROM table_22515 WHERE "Sanskrit gloss" = 'scorpion'
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate tim...
Questions answered by a user containing text.
SELECT q.Id AS "post_link" FROM Posts AS q INNER JOIN Posts AS a ON q.Id = a.ParentId WHERE a.OwnerUserId = '##UserId##' AND q.Body LIKE '%##Text##%'
CREATE TABLE table_75641 ( "Poll Source" text, "Date" text, "Candidate" text, "Support" text, "Consider" text, "Oppose" text, "Unsure" text )
What percentage of people were opposed to the candidate based on the Time Poll poll that showed 6% of people were unsure?
SELECT "Oppose" FROM table_75641 WHERE "Poll Source" = 'time poll' AND "Unsure" = '6%'
CREATE TABLE table_50189 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
Who was the Opponent in the match with a Score of 6 3, 6 4?
SELECT "Opponent" FROM table_50189 WHERE "Score" = '6–3, 6–4'
CREATE TABLE table_name_82 ( record VARCHAR, home VARCHAR, date VARCHAR )
which Record has a Home of ottawa senators on Date of december 21?
SELECT record FROM table_name_82 WHERE home = "ottawa senators" AND date = "december 21"
CREATE TABLE customer ( cust_ID varchar(3), cust_name varchar(20), acc_type char(1), acc_bal int, no_of_loans int, credit_score int, branch_ID int, state varchar(20) ) CREATE TABLE bank ( branch_ID int, bname varchar(20), no_of_customers int, city varchar(10), state ...
Return a histogram on what are the different names and credit scores of customers who have taken a loan?, and show by the total number from high to low.
SELECT cust_name, credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_ID = T2.cust_ID ORDER BY credit_score DESC
CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )...
flight from DENVER to BOSTON
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON'...
CREATE TABLE table_name_69 ( date VARCHAR, runner_s__up VARCHAR )
What is the Date with a Runner(s)-up that is jerry steelsmith?
SELECT date FROM table_name_69 WHERE runner_s__up = "jerry steelsmith"
CREATE TABLE table_79110 ( "Round" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning team" text )
What is the date of the zolder circuit, which had a.z.k./roc-comp tition a.z.k./roc-comp tition as the winning team?
SELECT "Date" FROM table_79110 WHERE "Winning team" = 'a.z.k./roc-compétition a.z.k./roc-compétition' AND "Circuit" = 'zolder'
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 ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE cine...
Give me a bar chart for total number of capacity of each openning year
SELECT Openning_year, SUM(Capacity) FROM cinema GROUP BY Openning_year
CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE ground_service ( city_code text, airport_co...
can i go from BOSTON to SAN FRANCISCO with a stopover in DENVER
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND CIT...
CREATE TABLE table_23080 ( "Scorecard" real, "Date" text, "Venue" text, "Team 1" text, "Team 2" text, "Result" text, "Man of the Match" text )
How many scorecards are there for the match on October 28?
SELECT COUNT("Scorecard") FROM table_23080 WHERE "Date" = 'October 28'
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGui...
Number of Users with Reputation <= N. For each unique reputation value N, this query retrieves the number of uses with reputation <= N. Click the graph tab for interesting pictures.
SELECT Reputation, SUM(COUNT(*)) OVER (ORDER BY Reputation ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS UserCount, COUNT(*) AS total FROM Users GROUP BY Reputation ORDER BY Reputation
CREATE TABLE table_30133 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (millions)" text )
when was the episode titled 'cracked' originally aired?
SELECT "Original air date" FROM table_30133 WHERE "Title" = 'Cracked'
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 those records from the products and each product's manufacturer, a bar chart shows the distribution of headquarter and the average of manufacturer , and group by attribute headquarter, and could you order from low to high by the x-axis?
SELECT Headquarter, AVG(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY Headquarter
CREATE TABLE table_28898974_3 ( reason VARCHAR, electorate VARCHAR )
When peninsula is the electorate what is the reason?
SELECT reason FROM table_28898974_3 WHERE electorate = "Peninsula"
CREATE TABLE table_46324 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Points difference" text, "Bonus Points" text, "Points" text )
What is Points Difference, when Points Against is 451?
SELECT "Points difference" FROM table_46324 WHERE "Points against" = '451'
CREATE TABLE table_56731 ( "Edition" real, "Zone" text, "Round" text, "Date" text, "Against" text, "Surface" text, "Partner" text, "Opponents" text, "Result" text )
Who was against the opponents, m d lina gojnea monica niculescu?
SELECT "Against" FROM table_56731 WHERE "Opponents" = 'mădălina gojnea monica niculescu'
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...
give me the number of patients whose diagnoses icd9 code is 2752 and drug type is main?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "2752" AND prescriptions.drug_type = "MAIN"
CREATE TABLE table_71790 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" text, "Finish" text )
In which years was the to par +6?
SELECT "Year(s) won" FROM table_71790 WHERE "To par" = '+6'
CREATE TABLE table_10568553_1 ( street_names VARCHAR, milepost VARCHAR )
Which street is 12.2 miles long?
SELECT street_names FROM table_10568553_1 WHERE milepost = "12.2"
CREATE TABLE table_45366 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
Who was the opponent in a week below 14 on October 10, 1993?
SELECT "Opponent" FROM table_45366 WHERE "Week" < '14' AND "Date" = 'october 10, 1993'
CREATE TABLE table_name_83 ( away_team VARCHAR )
What was Richmond's score when it was the away team?
SELECT away_team AS score FROM table_name_83 WHERE away_team = "richmond"
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE proced...
has criticare hn been given to patient 15209 since 04/2104?
SELECT COUNT(*) > 0 FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15209)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'criticar...
CREATE TABLE table_2076 ( "Player" text, "Years with Dodgers" text, "Role with Dodgers" text, "Inducted as" text, "Year inducted" real )
Name the inducted as for joe medwick category:articles with hcards
SELECT "Inducted as" FROM table_2076 WHERE "Player" = 'Joe Medwick Category:Articles with hCards'
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
since 2105, how many patients were given the pericardial window two times?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, COUNT(*) AS c1 FROM patient WHERE patient.patientunitstayid = (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'pericardial window' AND STRFTIME('%y', treatment.treatmenttime) >= '2105') GROUP BY patient.uniquepid) AS ...
CREATE TABLE table_name_99 ( week_9_oct_20 VARCHAR, week_17__final__jan_4 VARCHAR )
What is listed for the Week 9 Oct 20 that has a Week 17 (Final) Jan 4 of Michigan (10-3)?
SELECT week_9_oct_20 FROM table_name_99 WHERE week_17__final__jan_4 = "michigan (10-3)"
CREATE TABLE table_14977 ( "Parameter" text, "N80 IEC1" text, "N90 IEC1" text, "N90 IEC2" text, "N100 IEC 2" text, "N100 IEC3" text, "N117/2400 IEC3" text )
What is the N117/2400 IEC3 associated with an N100IEC3 of 25?
SELECT "N117/2400 IEC3" FROM table_14977 WHERE "N100 IEC3" = '25'
CREATE TABLE table_22297198_3 ( team VARCHAR, outgoing_manager VARCHAR )
What team did Alireza mansourian leave?
SELECT team FROM table_22297198_3 WHERE outgoing_manager = "Alireza Mansourian"
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE food_service ( mea...
okay show me all the flights to BALTIMORE
SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'BALTIMORE' AND flight.to_airport = airport_service.airport_code