instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What is the year for the country of Morocco?
CREATE TABLE table_name_22 (year INTEGER,country VARCHAR)
SELECT MAX(year) FROM table_name_22 WHERE country = "morocco"
provide me the location of admission and short title of diagnoses for patient with patient id 29541.
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 text,gender text,language text,religion text,admission_type text,days_stay ...
SELECT demographic.admission_location, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "29541"
What is the Location of the Moulin Bertrand Mill?
CREATE TABLE table_79590 ("Location" text,"Name of mill" text,"Type" text,"Built" real,"Notes" text)
SELECT "Location" FROM table_79590 WHERE "Name of mill" = 'moulin bertrand'
What was Olazabal's margin of victory int he Ebel European Masters Swiss Open?
CREATE TABLE table_name_6 (margin_of_victory VARCHAR,tournament VARCHAR)
SELECT margin_of_victory FROM table_name_6 WHERE tournament = "ebel european masters swiss open"
what are the top five most common specimen tests that patients had in the same hospital encounter after being diagnosed with lumbosacral neuritis nos since 1 year ago?
CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx text,route text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,...
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnos...
What date was the release when the format was lp?
CREATE TABLE table_42462 ("Country" text,"Date" text,"Label" text,"Format" text,"Catalog" text)
SELECT "Date" FROM table_42462 WHERE "Format" = 'lp'
What is the year listed when tied is listed as 11?
CREATE TABLE table_30801 ("Year" text,"Position" real,"Games played" real,"Won" real,"Tied" real,"Lost" real,"Goals Scored" real,"Goals Against" real,"Points" real,"Postseason place" text)
SELECT "Year" FROM table_30801 WHERE "Tied" = '11'
What model has a builder of zhuzhou, and a power output of 9600 (kw)?
CREATE TABLE table_name_20 (model VARCHAR,builder__family_ VARCHAR,power_output__kw_ VARCHAR)
SELECT model FROM table_name_20 WHERE builder__family_ = "zhuzhou" AND power_output__kw_ = "9600"
What was Phil Mickelson's score to par?
CREATE TABLE table_name_20 (to_par VARCHAR,player VARCHAR)
SELECT to_par FROM table_name_20 WHERE player = "phil mickelson"
What capital has an area of 2166086?
CREATE TABLE table_9076 ("Country or territory" text,"Area (km\u00b2)" real,"Population" real,"Population density (per km\u00b2)" real,"Capital" text)
SELECT "Capital" FROM table_9076 WHERE "Area (km\u00b2)" = '2166086'
how many days has it been since the last time patient 57050 was diagnosed with pleural effusion nos in the during this hospital encounter?
CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnoses_icd.charttime)) FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'pleural effusion nos') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissi...
Which player was drafted after round 9 and number 464 overall?
CREATE TABLE table_name_83 (player VARCHAR,round VARCHAR,overall VARCHAR)
SELECT player FROM table_name_83 WHERE round > 9 AND overall = 464
What is the id of the account with the most transactions?
CREATE TABLE invoice_line_items (order_item_id number,invoice_number number,product_id number,product_title text,product_quantity text,product_price number,derived_product_cost number,derived_vat_payable number,derived_total_cost number)CREATE TABLE order_items (order_item_id number,order_id number,product_id number,pr...
SELECT account_id FROM financial_transactions GROUP BY account_id ORDER BY COUNT(*) DESC LIMIT 1
Gold Javascript Badge Ranking in Morocco.
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName t...
SELECT b.UserId, MAX(b.Date) AS DateReceived, u.DisplayName FROM Users AS u, Badges AS b WHERE b.Name = 'javascript' AND u.Id = b.UserId AND u.Location LIKE '%Morocco%' GROUP BY b.UserId, u.DisplayName HAVING COUNT(*) > 2 ORDER BY DateReceived
Can you tell me the Country that has the To par larger than 9, and the Year(s) won of 1984?
CREATE TABLE table_name_67 (country VARCHAR,to_par VARCHAR,year_s__won VARCHAR)
SELECT country FROM table_name_67 WHERE to_par > 9 AND year_s__won = "1984"
What is the largest value for Fall 08 when Fall 09 is 792 and Fall 05 is less than 791?
CREATE TABLE table_name_95 (fall_08 INTEGER,fall_09 VARCHAR,fall_05 VARCHAR)
SELECT MAX(fall_08) FROM table_name_95 WHERE fall_09 = 792 AND fall_05 < 791
When did soul train music awards return?
CREATE TABLE table_name_49 (returning VARCHAR,show VARCHAR)
SELECT returning FROM table_name_49 WHERE show = "soul train music awards"
What's the name of Constituency number 108?
CREATE TABLE table_64783 ("Constituency number" text,"Name" text,"Reserved for (SC / ST /None)" text,"District" text,"Number of electorates (2009)" real)
SELECT "Name" FROM table_64783 WHERE "Constituency number" = '108'
What's the melamine content of having more than 1 samples failed?
CREATE TABLE table_66320 ("Producer" text,"Product" text,"Samples taken" real,"Samples failed" real,"Melamine content(mg/kg)" real)
SELECT "Melamine content(mg/kg)" FROM table_66320 WHERE "Samples failed" > '1' AND "Product" = '英雄牌嬰幼兒配方乳粉'
what is the top speed ?
CREATE TABLE table_203_764 (id number,"name" text,"date" number,"nation" text,"displacement" text,"speed" text,"number" number,"notes" text)
SELECT "speed" FROM table_203_764 ORDER BY "speed" DESC LIMIT 1
When was the last final lost of the club with a last win in 1959?
CREATE TABLE table_name_70 (last_final_lost VARCHAR,last_win VARCHAR)
SELECT last_final_lost FROM table_name_70 WHERE last_win = "1959"
Who was the opponent at the game that had a loss of Stieb (5-7)?
CREATE TABLE table_name_64 (opponent VARCHAR,loss VARCHAR)
SELECT opponent FROM table_name_64 WHERE loss = "stieb (5-7)"
What is Wayne Grady's total?
CREATE TABLE table_60665 ("Player" text,"Country" text,"Year(s) won" text,"Total" real,"To par" text,"Finish" text)
SELECT SUM("Total") FROM table_60665 WHERE "Player" = 'wayne grady'
When 'the postcard' is the original title what is the production code?
CREATE TABLE table_23553 ("#" text,"Original title" text,"Directed by" text,"Written by" text,"Original airdate" text,"Prod. code" text,"Viewers" real)
SELECT "Prod. code" FROM table_23553 WHERE "Original title" = 'The Postcard'
A bar chart showing the first name of all the faculty members who participated in some activity, together with the number of activities they participated in, and sort in descending by the Y-axis.
CREATE TABLE Participates_in (stuid INTEGER,actid INTEGER)CREATE TABLE Faculty_Participates_in (FacID INTEGER,actid INTEGER)CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))CREATE TABLE Activity (actid INTEGER,activity_...
SELECT Fname, COUNT(*) FROM Faculty AS T1 JOIN Faculty_Participates_in AS T2 ON T1.FacID = T2.FacID GROUP BY T1.FacID ORDER BY COUNT(*) DESC
Find the names of stadiums whose capacity is smaller than the average capacity.
CREATE TABLE stadium (id number,name text,capacity number,city text,country text,opening_year number)CREATE TABLE event (id number,name text,stadium_id number,year text)CREATE TABLE swimmer (id number,name text,nationality text,meter_100 number,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,...
SELECT name FROM stadium WHERE capacity < (SELECT AVG(capacity) FROM stadium)
what is the total number of destinations for the hancock location ?
CREATE TABLE table_204_888 (id number,"location" text,"mile" number,"destinations" text,"notes" text)
SELECT COUNT("destinations") FROM table_204_888 WHERE "location" = 'hancock'
Tell me the pos for adrian sutil
CREATE TABLE table_name_75 (pos VARCHAR,driver VARCHAR)
SELECT pos FROM table_name_75 WHERE driver = "adrian sutil"
Return a scatter chart about the correlation between School_ID and ACC_Percent , and group by attribute ACC_Home.
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 (School_ID int,School text,Location text,Founded real,Affiliation text,En...
SELECT School_ID, ACC_Percent FROM basketball_match GROUP BY ACC_Home
What is the latest year that ended with a 3rd day of rowed-over?
CREATE TABLE table_65327 ("Year" real,"Finish position" text,"1st day" text,"2nd day" text,"3rd day" text,"4th Day" text)
SELECT MAX("Year") FROM table_65327 WHERE "3rd day" = 'rowed-over'
what is discharge time and procedure long title of subject id 9258?
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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do...
SELECT demographic.dischtime, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "9258"
Draw a bar chart about the distribution of All_Road and All_Games_Percent , rank in asc by the y axis.
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_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Perce...
SELECT All_Road, All_Games_Percent FROM basketball_match ORDER BY All_Games_Percent
what year did both diddy and the notorious b.i.g. sign with bad boy records ?
CREATE TABLE table_200_14 (id number,"act" text,"year signed" number,"# albums released under bad boy" number)
SELECT "year signed" FROM table_200_14 WHERE "act" = 'diddy'
What eagle riders where ova (harmony gold dub) is lord zortek?
CREATE TABLE table_17480471_3 (eagle_riders VARCHAR,ova__harmony_gold_dub_ VARCHAR)
SELECT eagle_riders FROM table_17480471_3 WHERE ova__harmony_gold_dub_ = "Lord Zortek"
what were the drugs that were added to patient 8116 today, compared to those yesterday?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code tex...
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8116) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE ...
select * from information_schema.columns where table_name ='users'.
CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE CloseAsOf...
SELECT Column_name, data_type, is_nullable, character_maximum_length FROM information_schema.columns WHERE table_name = 'users'
Who directed the film titled 'Steam of Life'?
CREATE TABLE table_24720 ("Year (Ceremony)" text,"Film title used in nomination" text,"Title in the original language" text,"Director" text,"Result" text)
SELECT "Director" FROM table_24720 WHERE "Film title used in nomination" = 'Steam of Life'
Return the average transaction amount, as well as the total amount of all transactions.
CREATE TABLE accounts (account_id number,customer_id number,account_name text,other_account_details text)CREATE TABLE customers (customer_id number,customer_first_name text,customer_last_name text,customer_address text,customer_phone text,customer_email text,other_customer_details text)CREATE TABLE financial_transactio...
SELECT AVG(transaction_amount), SUM(transaction_amount) FROM financial_transactions
Show the number of films for each type in a pie chart.
CREATE TABLE market (Market_ID int,Country text,Number_cities int)CREATE TABLE film (Film_ID int,Title text,Studio text,Director text,Gross_in_dollar int)CREATE TABLE film_market_estimation (Estimation_ID int,Low_Estimate real,High_Estimate real,Film_ID int,Type text,Market_ID int,Year int)
SELECT Type, COUNT(Type) FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID GROUP BY Type
in the number of episode in season is 11, who was the writer?
CREATE TABLE table_24256 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (millions)" text)
SELECT "Written by" FROM table_24256 WHERE "No. in season" = '11'
show me the flights from PHILADELPHIA to DALLAS
CREATE TABLE code_description (code varchar,description text)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,departure_time int,dual_carrier text,flight_days text,flight_id int,flight_number int,from_airport varchar,meal_code text,stops int,time...
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 = 'D...
give me the number of patients whose diagnoses icd9 code is 78321 and drug type is base?
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)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex...
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 = "78321" AND prescriptions.drug_type = "BASE"
i would like information on flights from BALTIMORE to ATLANTA on thursday arriving in ATLANTA before 1800
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_airline text,departure_flight_number int,stop_time int)CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_n...
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 ((date_day.day_number = 24 AND date_day.month_number = 5 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.arrival_time <...
what's the position with college being usc
CREATE TABLE table_19495 ("Pick #" real,"NFL Team" text,"Player" text,"Position" text,"College" text)
SELECT "Position" FROM table_19495 WHERE "College" = 'USC'
Total number of unresolved questions with answer.
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)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE T...
SELECT COUNT(*) FROM Posts AS q WHERE ClosedDate IS NULL AND q.ParentId IS NULL AND PostTypeId = 1 AND AcceptedAnswerId IS NULL AND AnswerCount > 1
what is the year when the driver was kevin lepage?
CREATE TABLE table_49781 ("Year" real,"Series" text,"Make" text,"Driver" text,"Team" text,"Schedule" text,"Role" text)
SELECT SUM("Year") FROM table_49781 WHERE "Driver" = 'kevin lepage'
Show me a bar chart for how many total credits are offered by each department?
CREATE TABLE instructor (ID varchar(5),name varchar(20),dept_name varchar(20),salary numeric(8,2))CREATE TABLE takes (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0),grade varchar(2))CREATE TABLE prereq (course_id varchar(8),prereq_id varchar(8))CREATE TABLE advisor (s_ID varc...
SELECT dept_name, SUM(credits) FROM course GROUP BY dept_name
I want the lowest Gold for silver being 2 and electronic sports
CREATE TABLE table_10314 ("Sport" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MIN("Gold") FROM table_10314 WHERE "Silver" = '2' AND "Sport" = 'electronic sports'
how many days have elapsed since patient 012-66291 has received their first procedure on this hospital encounter?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientu...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-66291'...
show me flights from NEW YORK to MIAMI
CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)C...
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 = 'NEW YORK' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MIAMI...
patient 23969 was diagnosed in this year for the first time with what?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE labevents (row_id number,subject_id numb...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT diagnoses_icd.icd9_code FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23969) AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(C...
Name the sum of spectators for time more than 20.05 and team #2 of estonia
CREATE TABLE table_68225 ("Date" text,"Time (CEST)" real,"Team #1" text,"Res." text,"Team #2" text,"Round" text,"Spectators" real)
SELECT SUM("Spectators") FROM table_68225 WHERE "Time ( CEST )" > '20.05' AND "Team #2" = 'estonia'
what is the latitude for the berlin township with a geo id less than 3801706260
CREATE TABLE table_name_62 (latitude VARCHAR,township VARCHAR,geo_id VARCHAR)
SELECT COUNT(latitude) FROM table_name_62 WHERE township = "berlin" AND geo_id < 3801706260
calculate minimum age of the patients admitted to trsf within this facility who were discharged to rehab/distinct part hosp
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.discharge_location = "REHAB/DISTINCT PART HOSP"
what is the percent for other when the margin of error is 3%?
CREATE TABLE table_10801 ("Poll source" text,"Date(s) administered" text,"Sample size" text,"Margin of error" text,"Barbara Boxer (D)" text,"Carly Fiorina (R)" text,"Other" text,"Undecided" text)
SELECT "Other" FROM table_10801 WHERE "Margin of error" = '± 3%'
Posts with YouTube or SoundCloud links on Music Fans.
CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)...
SELECT COUNT(*) AS aantal, HasYouTube, PostType FROM (SELECT p.Id AS PostId, CASE WHEN p.Body LIKE '%youtube.com%' OR p.Body LIKE '%youtu.be%' OR p.Body LIKE '%soundcloud.com%' THEN 1 ELSE 0 END AS HasYouTube, pt.Name AS PostType FROM Posts AS p LEFT JOIN PostTypes AS pt ON pt.Id = p.PostTypeId) AS pp GROUP BY HasYouTu...
What city is Garfield County Museum located in?
CREATE TABLE table_35681 ("Name" text,"Town/City" text,"Region" text,"On Dinosaur Trail?" text,"Education programs/ Guided tours?" text,"Associated Field Digs?" text)
SELECT "Town/City" FROM table_35681 WHERE "Name" = 'garfield county museum'
What year is the death for a birth of 1873 and higher than rank 28?
CREATE TABLE table_13032 ("Rank" real,"Name" text,"Country" text,"Birth" real,"Death" text)
SELECT "Death" FROM table_13032 WHERE "Birth" = '1873' AND "Rank" > '28'
How many votes cast per day.
CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body ...
SELECT CreationDate, VoteTypeId, COUNT(*) FROM Votes WHERE (VoteTypeId = 2 OR VoteTypeId = 3) GROUP BY CreationDate, VoteTypeId ORDER BY CreationDate, VoteTypeId
What was the opponent on December 16, 1989?
CREATE TABLE table_43852 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT "Opponent" FROM table_43852 WHERE "Date" = 'december 16, 1989'
What is the To par when fredrik andersson hed was runner-up?
CREATE TABLE table_name_86 (to_par VARCHAR,runner_s__up VARCHAR)
SELECT to_par FROM table_name_86 WHERE runner_s__up = "fredrik andersson hed"
Give me a bar chart for the total number of each dept name, and rank x-axis in desc order.
CREATE TABLE prereq (course_id varchar(8),prereq_id varchar(8))CREATE TABLE teaches (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0))CREATE TABLE course (course_id varchar(8),title varchar(50),dept_name varchar(20),credits numeric(2,0))CREATE TABLE classroom (building varchar(...
SELECT dept_name, COUNT(*) FROM student GROUP BY dept_name ORDER BY dept_name DESC
Who is the second member that was elected in 1555?
CREATE TABLE table_60046 ("Summoned" text,"Elected" text,"Assembled" text,"Dissolved" text,"1st member" text,"2nd member" text)
SELECT "2nd member" FROM table_60046 WHERE "Elected" = '1555'
What is 1999, when 1998 is 2R?
CREATE TABLE table_name_18 (Id VARCHAR)
SELECT 1999 FROM table_name_18 WHERE 1998 = "2r"
What was the year that had an issue price of $1,295.95?
CREATE TABLE table_54148 ("Year" real,"Artist" text,"Composition" text,"Mintage" real,"Issue Price" text)
SELECT AVG("Year") FROM table_54148 WHERE "Issue Price" = '$1,295.95'
What was the attendance on week 1?
CREATE TABLE table_name_96 (attendance VARCHAR,week VARCHAR)
SELECT attendance FROM table_name_96 WHERE week = 1
show me the flights from SAN DIEGO to NEWARK
CREATE TABLE fare (fare_id int,from_airport varchar,to_airport varchar,fare_basis_code text,fare_airline text,restriction_code text,one_direction_cost int,round_trip_cost int,round_trip_required varchar)CREATE TABLE class_of_service (booking_class varchar,rank int,class_description text)CREATE TABLE flight_fare (flight...
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 = 'SAN DIEGO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NEWA...
How many silver metals are possessed by countries with 2 gold medals?
CREATE TABLE table_15103 ("Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT COUNT("Silver") FROM table_15103 WHERE "Gold" = '2'
How many networks run on virtual channel 23.4?
CREATE TABLE table_30610 ("Callsign" text,"City of license" text,"Virtual channel" text,"Digital channel" text,"Network" text)
SELECT COUNT("Network") FROM table_30610 WHERE "Virtual channel" = '23.4'
What was the incumbent for texas 19?
CREATE TABLE table_18320 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "Incumbent" FROM table_18320 WHERE "District" = 'Texas 19'
Who is the constituency when the runner-up was d. Venugopal?
CREATE TABLE table_25284 ("Constituency" text,"Winner" text,"Party" text,"Margin" real,"Runner-up a" text,"Party a" text)
SELECT "Constituency" FROM table_25284 WHERE "Runner-up a" = 'D. Venugopal'
Top users without gold badge..
CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)...
SELECT Users.Reputation, Users.Id AS "user_link", SUM(CASE WHEN Badges.Class = 2 THEN 1 ELSE 0 END) AS Silver, SUM(CASE WHEN Badges.Class = 3 THEN 1 ELSE 0 END) AS Bronze, COUNT(*) AS Total FROM Users INNER JOIN Badges ON Badges.UserId = Users.Id GROUP BY Users.Id, Reputation, DisplayName HAVING MIN(Badges.Class) > 1 O...
What was their record on July 22?
CREATE TABLE table_name_58 (record VARCHAR,date VARCHAR)
SELECT record FROM table_name_58 WHERE date = "july 22"
What was the record in the game where the decision was Backstrom and there were more than 18,568 in attendance?
CREATE TABLE table_52970 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text)
SELECT "Record" FROM table_52970 WHERE "Decision" = 'backstrom' AND "Attendance" > '18,568'
count the number of patients whose ethnicity is black/cape verdean and year of birth is less than 1821?
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,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.dob_year < "1821"
provide the number of patients whose diagnosis short title is atriovent block complete and drug type is base.
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 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 te...
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.short_title = "Atriovent block complete" AND prescriptions.drug_type = "BASE"
Name the country with year more than 2008
CREATE TABLE table_name_95 (country VARCHAR,year INTEGER)
SELECT country FROM table_name_95 WHERE year > 2008
Visualize a bar chart, the x-axis is the arrival time, and the y-axis is the total number of trains in each arrival time, and sort x-axis in asc order.
CREATE TABLE manager (Manager_ID int,Name text,Country text,Working_year_starts text,Age int,Level int)CREATE TABLE train (Train_ID int,Train_Num text,Name text,From text,Arrival text,Railway_ID int)CREATE TABLE railway (Railway_ID int,Railway text,Builder text,Built text,Wheels text,Location text,ObjectNumber text)CRE...
SELECT Arrival, COUNT(Arrival) FROM train GROUP BY Arrival ORDER BY Arrival
What is the earliest date with Great Expectations label with LP format?
CREATE TABLE table_37591 ("Region" text,"Date" real,"Label" text,"Format" text,"Catalog" text)
SELECT MIN("Date") FROM table_37591 WHERE "Label" = 'great expectations' AND "Format" = 'lp'
What is the hight in ft and m of the building with less than 11 floors?
CREATE TABLE table_62097 ("Name" text,"Street address" text,"Years as tallest" text,"Height ft (m)" text,"Floors" real)
SELECT "Height ft (m)" FROM table_62097 WHERE "Floors" < '11'
Name the least game for october 10 at shibe park
CREATE TABLE table_69022 ("Game" real,"Date" text,"Location" text,"Time" text,"Attendance" real)
SELECT MIN("Game") FROM table_69022 WHERE "Location" = 'shibe park' AND "Date" = 'october 10'
how many patients stayed in hospital for more than 6 days and were procedured with diagnostic ultrasound?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "6" AND procedures.long_title = "Diagnostic ultrasound of heart"
What is the Year won for the player with a To par of 8?
CREATE TABLE table_name_70 (year_s__won VARCHAR,to_par VARCHAR)
SELECT year_s__won FROM table_name_70 WHERE to_par = 8
who is the frist country to have a 1st runner up of 2
CREATE TABLE table_204_225 (id number,"rank" number,"country/territory" text,"miss supranational" number,"1st runner-up" number,"2nd runner-up" number,"3rd runner-up" number,"4th runner-up" number,"semifinalists" number,"total" number)
SELECT "country/territory" FROM table_204_225 WHERE "1st runner-up" = 2
what was the maximum monthly number of patients who were diagnosed with arrhythmia during this year?
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,culturetakentime time)CREATE TABLE lab (labid number,patientunitstayid num...
SELECT MAX(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'arrhythmia' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY STRFTIME('%y-%m', diagnosis.diagnosistime)) AS t1
Who is the visitor of the match on July 29?
CREATE TABLE table_name_13 (visitor VARCHAR,date VARCHAR)
SELECT visitor FROM table_name_13 WHERE date = "july 29"
For those employees who did not have any job in the past, return a bar chart about the distribution of job_id and the average of manager_id , and group by attribute job_id.
CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decimal(2,2),MANAGER_ID decimal(6,0),DEPARTMENT_ID decimal(4,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0)...
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID
What is the sum of Blks, when Stls is 1, and when Rebs is greater than 8.6?
CREATE TABLE table_name_49 (blks INTEGER,stls VARCHAR,rebs VARCHAR)
SELECT SUM(blks) FROM table_name_49 WHERE stls = 1 AND rebs > 8.6
how many french restaurants are there in palo alto ?
CREATE TABLE location (restaurant_id int,house_number int,street_name varchar,city_name varchar)CREATE TABLE restaurant (id int,name varchar,food_type varchar,city_name varchar,rating "decimal)CREATE TABLE geographic (city_name varchar,county varchar,region varchar)
SELECT COUNT(*) FROM location, restaurant WHERE location.city_name = 'palo alto' AND restaurant.food_type = 'french' AND restaurant.id = location.restaurant_id
how many patients had an urgent admission type with hyperpotassemia?
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,itemid text,charttime text,flag text,value_unit text,label text,fluid ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.long_title = "Hyperpotassemia"
what is the number of patients who underwent allogeneic hematopoietic stem cell transplant without purging and are still alive?
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,la...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.long_title = "Allogeneic hematopoietic stem cell transpant without purging"
Which To par has a Player of jack nicklaus, and a Total smaller than 146?
CREATE TABLE table_12930 ("Player" text,"Country" text,"Year(s) won" text,"Total" real,"To par" real)
SELECT AVG("To par") FROM table_12930 WHERE "Player" = 'jack nicklaus' AND "Total" < '146'
Show the number of male and female assistant professors with a bar chart.
CREATE TABLE Activity (actid INTEGER,activity_name varchar(25))CREATE TABLE Faculty (FacID INTEGER,Lname VARCHAR(15),Fname VARCHAR(15),Rank VARCHAR(15),Sex VARCHAR(1),Phone INTEGER,Room VARCHAR(5),Building VARCHAR(13))CREATE TABLE Participates_in (stuid INTEGER,actid INTEGER)CREATE TABLE Faculty_Participates_in (FacID ...
SELECT Sex, COUNT(*) FROM Faculty WHERE Rank = "AsstProf" GROUP BY Sex
Give me the number of hispanic/latino-puerto rican patients with unique drug code hydx25.
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND prescriptions.formulary_drug_cd = "HYDX25"
What is the highest NGC number that has a Declination ( J2000 ) of 04 58 and a Apparent magnitude larger than 7.3?
CREATE TABLE table_name_5 (ngc_number INTEGER,declination___j2000__ VARCHAR,apparent_magnitude VARCHAR)
SELECT MAX(ngc_number) FROM table_name_5 WHERE declination___j2000__ = "°04′58″" AND apparent_magnitude > 7.3
Which Score has a Money ( ) of 90,400, and a Country of south africa, and a Player of thomas aiken? Question 1
CREATE TABLE table_name_38 (score VARCHAR,player VARCHAR,money___£__ VARCHAR,country VARCHAR)
SELECT score FROM table_name_38 WHERE money___£__ = "90,400" AND country = "south africa" AND player = "thomas aiken"
What is Team, when Capacity is greater than 16,981, and when Venue is 'Atat rk Olympic Stadium'?
CREATE TABLE table_48889 ("Team" text,"Head coach" text,"Team captain" text,"Venue" text,"Capacity" real,"Kitmaker" text,"Shirt sponsor" text,"Club Chairman" text)
SELECT "Team" FROM table_48889 WHERE "Capacity" > '16,981' AND "Venue" = 'atatürk olympic stadium'
how many trains have the number 99808
CREATE TABLE table_29301050_1 (train_name VARCHAR,train_number VARCHAR)
SELECT COUNT(train_name) FROM table_29301050_1 WHERE train_number = 99808
count the number of patients diagnosed with diarrhea who did not come to the hospital during the same month since 2105.
CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id n...
SELECT (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'diarrhea')...
count the number of patients whose primary disease is st elevated myocardial infarction\cardiac cath and lab test abnormal status is delta?
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 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 te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND lab.flag = "delta"