instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
How many different values of total power are there for the unit whose construction started on 01.03.1977 and whose commercial operation started on 01.02.1984?
CREATE TABLE table_12983929_1 (total_power VARCHAR,construction_start VARCHAR,commercial_operation VARCHAR)
SELECT COUNT(total_power) FROM table_12983929_1 WHERE construction_start = "01.03.1977" AND commercial_operation = "01.02.1984"
What were the 'other details' (number released) for 'is my love will follow me'?
CREATE TABLE table_22559 ("Date" real,"Single" text,"Backed with" text,"Record label" text,"Format" text,"Other details" text)
SELECT "Other details" FROM table_22559 WHERE "Single" = 'My Love Will Follow Me'
Name the team for june 16 jeff gordon
CREATE TABLE table_24432 ("Year" text,"Date" text,"Driver" text,"Team" text,"Manufacturer" text,"Laps" text,"Miles (km)" text,"Race Time" text,"Average Speed (mph)" text,"Report" text)
SELECT "Team" FROM table_24432 WHERE "Date" = 'June 16' AND "Driver" = 'Jeff Gordon'
What are the countries that have at least two perpetrators?
CREATE TABLE people (people_id number,name text,height number,weight number,home town text)CREATE TABLE perpetrator (perpetrator_id number,people_id number,date text,year number,location text,country text,killed number,injured number)
SELECT country, COUNT(*) FROM perpetrator GROUP BY country HAVING COUNT(*) >= 2
until 2104, patient 7073 has received any procedure?
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,admission_location text,discharge_location text,insurance text,langua...
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7073) AND STRFTIME('%y', procedures_icd.charttime) <= '2104'
What was the surface for the May 10, 2009 tournament?
CREATE TABLE table_71174 ("Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponents" text,"Score" text)
SELECT "Surface" FROM table_71174 WHERE "Date" = 'may 10, 2009'
In which tournament was vijay singh a runner-up?
CREATE TABLE table_34806 ("Date" text,"Tournament" text,"Winning score" text,"Margin of victory" text,"Runner-up" text)
SELECT "Tournament" FROM table_34806 WHERE "Runner-up" = 'vijay singh'
What is the smallest crowd when richmond is away?
CREATE TABLE table_33580 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT MIN("Crowd") FROM table_33580 WHERE "Away team" = 'richmond'
What is the total number of poles and 63 points?
CREATE TABLE table_name_66 (poles VARCHAR,points VARCHAR)
SELECT COUNT(poles) FROM table_name_66 WHERE points = "63"
Show me about the distribution of Sex and the sum of Height , and group by attribute Sex in a bar chart.
CREATE TABLE candidate (Candidate_ID int,People_ID int,Poll_Source text,Date text,Support_rate real,Consider_rate real,Oppose_rate real,Unsure_rate real)CREATE TABLE people (People_ID int,Sex text,Name text,Date_of_Birth text,Height real,Weight real)
SELECT Sex, SUM(Height) FROM people GROUP BY Sex
Who was the manager that was positioned 11th in table and resigned in departure?
CREATE TABLE table_45268 ("Team" text,"Outgoing manager" text,"Manner of departure" text,"Date of vacancy" text,"Replaced by" text,"Date of appointment" text,"Position in table" text)
SELECT "Replaced by" FROM table_45268 WHERE "Position in table" = '11th' AND "Manner of departure" = 'resigned'
how many songs reached the us main charts ?
CREATE TABLE table_203_751 (id number,"year" number,"title" text,"peak chart positions\nus\nair" number,"peak chart positions\nus\nmain" number,"peak chart positions\nus\nmod" number,"album" text)
SELECT COUNT("peak chart positions\nus\nmain") FROM table_203_751
Which wheel arrangement had a Specification of dl-700?
CREATE TABLE table_70792 ("Model" text,"Specification" text,"Build date" text,"Total produced" real,"Wheel arrangement" text,"Prime mover" text,"Power output" text)
SELECT "Wheel arrangement" FROM table_70792 WHERE "Specification" = 'dl-700'
What is the total losses for the player with fewer than 51 pens, 3 tries and 45 starts?
CREATE TABLE table_name_19 (lost VARCHAR,start VARCHAR,pens VARCHAR,tries VARCHAR)
SELECT COUNT(lost) FROM table_name_19 WHERE pens < 51 AND tries = 3 AND start = 45
what is the number of patients whose diagnoses icd9 code is 34590 and lab test abnormal status is abnormal?
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 text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "34590" AND lab.flag = "abnormal"
What is the code of 1.5 dci 110, which has a capacity of 1,461cc?
CREATE TABLE table_name_7 (code VARCHAR,capacity VARCHAR,name VARCHAR)
SELECT code FROM table_name_7 WHERE capacity = "1,461cc" AND name = "1.5 dci 110"
Count the number of artists who are older than 46 and joined after 1990.
CREATE TABLE exhibition_record (exhibition_id number,date text,attendance number)CREATE TABLE artist (artist_id number,name text,country text,year_join number,age number)CREATE TABLE exhibition (exhibition_id number,year number,theme text,artist_id number,ticket_price number)
SELECT COUNT(*) FROM artist WHERE age > 46 AND year_join > 1990
When austin, texas is the hometown what is the lowest age?
CREATE TABLE table_22453 ("Candidate" text,"Background" text,"Original Team" text,"Age" real,"Hometown" text,"Result" text)
SELECT MIN("Age") FROM table_22453 WHERE "Hometown" = 'Austin, Texas'
What is the value of D 43 when the value of D 42 is d 42 ?
CREATE TABLE table_name_58 (d_43_√ VARCHAR,d_42_√ VARCHAR)
SELECT d_43_√ FROM table_name_58 WHERE d_42_√ = "d 42 √"
Are there DANCE classes that meet any day other than Friday ?
CREATE TABLE course_tags_count (course_id int,clear_grading int,pop_quiz int,group_projects int,inspirational int,long_lectures int,extra_credit int,few_tests int,good_feedback int,tough_tests int,heavy_papers int,cares_for_students int,heavy_assignments int,respected int,participation int,heavy_reading int,tough_grade...
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_offering.friday = 'N' AND course.department = 'DANCE' AND semester.semester = 'WN' AND ...
count the number of patients whose diagnosis short title is dmi neuro nt st uncntrld with a main drug type.
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 text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
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 = "DMI neuro nt st uncntrld" AND prescriptions.drug_type = "MAIN"
Show me mean age by born state in a histogram, and could you order from low to high by the bars please?
CREATE TABLE department (Department_ID int,Name text,Creation text,Ranking int,Budget_in_Billions real,Num_Employees real)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)
SELECT born_state, AVG(age) FROM head GROUP BY born_state ORDER BY born_state
What are the rank, first name, and last name of the faculty members?
CREATE TABLE participates_in (stuid number,actid number)CREATE TABLE activity (actid number,activity_name text)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE faculty_participates_in (facid number,actid number)CREATE TABLE faculty (fac...
SELECT rank, fname, lname FROM faculty
How many departments whose budget is more than the average budget in each building? Show me a bar chart, list by the total number in asc.
CREATE TABLE teaches (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0))CREATE TABLE department (dept_name varchar(20),building varchar(15),budget numeric(12,2))CREATE TABLE section (course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0),building varchar(15...
SELECT building, COUNT(building) FROM department WHERE budget > (SELECT AVG(budget) FROM department) GROUP BY building ORDER BY COUNT(building)
select top 1 from Posts.
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body ...
SELECT * FROM Posts WHERE AnswerCount = 0 ORDER BY CreationDate DESC LIMIT 10
What is the 1st leg where Team 1 is C.D. Plaza Amador?
CREATE TABLE table_77922 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text)
SELECT "1st leg" FROM table_77922 WHERE "Team 1" = 'c.d. plaza amador'
What is Opponent, when Week is '5'?
CREATE TABLE table_9208 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real)
SELECT "Opponent" FROM table_9208 WHERE "Week" = '5'
When 2 is the k-band what is the v-band?
CREATE TABLE table_1944 ("Property" text,"K-band" text,"Ka-band" text,"Q-band" text,"V-band" text,"W-band" text)
SELECT "V-band" FROM table_1944 WHERE "K-band" = '2'
Return a bar chart about the distribution of meter_400 and meter_100 , and show from low to high by the bar please.
CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 te...
SELECT meter_400, meter_100 FROM swimmer ORDER BY meter_400
What are the number of the completion dates of all the tests that have result 'Fail'?, and sort y axis in desc order.
CREATE TABLE Subjects (subject_id INTEGER,subject_name VARCHAR(120))CREATE TABLE Students (student_id INTEGER,date_of_registration DATETIME,date_of_latest_logon DATETIME,login_name VARCHAR(40),password VARCHAR(10),personal_name VARCHAR(40),middle_name VARCHAR(40),family_name VARCHAR(40))CREATE TABLE Student_Tests_Taken...
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" ORDER BY COUNT(date_of_completion) DESC
What's the IS-3 when the KV-1S is 45?
CREATE TABLE table_name_72 (is_3_m1945 VARCHAR,kv_1s_m1942 VARCHAR)
SELECT is_3_m1945 FROM table_name_72 WHERE kv_1s_m1942 = "45"
What is the highest number of points of the game in Conseco fieldhouse 7,134?
CREATE TABLE table_48760 ("Game" real,"Date" text,"Opponent" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location/Attendance" text,"Record" text)
SELECT "High points" FROM table_48760 WHERE "Location/Attendance" = 'conseco fieldhouse 7,134'
Played that has a Points of 38, and a B.P. larger than 5 has what sum?
CREATE TABLE table_name_52 (played INTEGER,points VARCHAR,bp VARCHAR)
SELECT SUM(played) FROM table_name_52 WHERE points = 38 AND bp > 5
If the varsity team is 6, what is the location?
CREATE TABLE table_24919 ("School" text,"Location" text,"Team Name" text,"Colors" text,"Varsity Teams" real,"NJCAA Championships" real)
SELECT "Location" FROM table_24919 WHERE "Varsity Teams" = '6'
how many patients stayed at hospital for more than 4 days?
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 text,discharge_location text,diagnosis text,dod text,dob_year text,dod_year ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.days_stay > "4"
How many laps for grid of 9?
CREATE TABLE table_52870 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Laps" FROM table_52870 WHERE "Grid" = '9'
Bar chart x axis meter 600 y axis id
CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 te...
SELECT meter_600, ID FROM swimmer
What is the Status with a novelty of gen et sp, and the name is haplocanthosaurus?
CREATE TABLE table_41185 ("Name" text,"Novelty" text,"Status" text,"Authors" text,"Unit" text,"Location" text)
SELECT "Status" FROM table_41185 WHERE "Novelty" = 'gen et sp' AND "Name" = 'haplocanthosaurus'
What is the least value for week?
CREATE TABLE table_23916462_3 (week INTEGER)
SELECT MIN(week) FROM table_23916462_3
When was the game at Gillette Stadium that ended in a final score of 30-17?
CREATE TABLE table_name_37 (date VARCHAR,final_score VARCHAR,stadium VARCHAR)
SELECT date FROM table_name_37 WHERE final_score = "30-17" AND stadium = "gillette stadium"
What is the sum FG Pct of the player with more than 3 asst, a def reb of 30, and a 3FG Pct greater than 36.1?
CREATE TABLE table_7424 ("Player" text,"FG Pct" real,"3FGM" real,"3FGA" real,"3FG Pct" real,"FT Pct" real,"Off Reb" real,"Def Reb" real,"Total Reb" real,"Asst" real)
SELECT SUM("FG Pct") FROM table_7424 WHERE "Asst" > '3' AND "Def Reb" = '30' AND "3FG Pct" > '36.1'
I want the D 45 and D 42 of r 22
CREATE TABLE table_name_58 (d_45 VARCHAR,d_42 VARCHAR)
SELECT d_45 FROM table_name_58 WHERE d_42 = "r 22"
How much Attendance has Games smaller than 6, and a W-L-T of 3-2-0, and a Season smaller than 1948?
CREATE TABLE table_name_24 (attendance INTEGER,season VARCHAR,games VARCHAR,w_l_t VARCHAR)
SELECT SUM(attendance) FROM table_name_24 WHERE games < 6 AND w_l_t = "3-2-0" AND season < 1948
Posts using the ambiguous [unit] tag. Posts tagged [unit] but not tagged [unit-testing] or [testing]
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE TABLE Users (Id number,Reputation number,Creati...
SELECT Posts.Id, Posts.Title, Posts.Tags FROM Posts WHERE Posts.Tags LIKE '%<unit>%' AND NOT Posts.Tags LIKE '%<testing>%' AND NOT Posts.Tags LIKE '%<unit-testing>%'
how many patients whose diagnoses long title is pressure ulcer, hip and drug route is iv bolus?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE procedures (subject_id text,hadm_id 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.long_title = "Pressure ulcer, hip" AND prescriptions.route = "IV BOLUS"
what is AS
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_elapsed int,to_airport varchar)CREATE TABLE dual_carrier (ma...
SELECT DISTINCT airline_code FROM airline WHERE airline_code = 'AS'
What is the result from 2003 from the US Open?
CREATE TABLE table_name_80 (tournament VARCHAR)
SELECT 2003 FROM table_name_80 WHERE tournament = "us open"
How many yards did Davin Meggett have with more than 9 Rec.?
CREATE TABLE table_34230 ("Player" text,"Rec." real,"Yards" real,"Avg." real,"Long" real)
SELECT SUM("Yards") FROM table_34230 WHERE "Player" = 'davin meggett' AND "Rec." > '9'
Which Record has an Opponent of twins, and a Date of july 25?
CREATE TABLE table_name_10 (record VARCHAR,opponent VARCHAR,date VARCHAR)
SELECT record FROM table_name_10 WHERE opponent = "twins" AND date = "july 25"
What is the smallest number of wins for a top-25 value greater than 5 and more than 38 cuts?
CREATE TABLE table_name_52 (wins INTEGER,top_25 VARCHAR,cuts_made VARCHAR)
SELECT MIN(wins) FROM table_name_52 WHERE top_25 > 5 AND cuts_made > 38
Top Viewed Game Dev Questions.
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score n...
SELECT Title, Tags, ViewCount FROM Posts WHERE ViewCount > 1000 ORDER BY ViewCount DESC
let's count the number of times patient 006-133605 has had a volume (ml)-sodium bicarbonate in d5w premix 150 meq/1000 ml intake on the current hospital encounter.
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmen...
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-133605' AND patient.hospitaldischargetime IS NULL)) AND intakeoutput.c...
Gold of 0, and a Silver smaller than 3, and a Rank larger than 9, and a Total of 1 has how many numbers of bronze?
CREATE TABLE table_14507 ("Rank" real,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT COUNT("Bronze") FROM table_14507 WHERE "Gold" = '0' AND "Silver" < '3' AND "Rank" > '9' AND "Total" = '1'
Show the number of opening years for three churches that opened most recently in a bar chart. Bin the year into the weekday interval.
CREATE TABLE people (People_ID int,Name text,Country text,Is_Male text,Age int)CREATE TABLE wedding (Church_ID int,Male_ID int,Female_ID int,Year int)CREATE TABLE church (Church_ID int,Name text,Organized_by text,Open_Date int,Continuation_of text)
SELECT Open_Date, COUNT(Open_Date) FROM church ORDER BY Open_Date DESC LIMIT 3
When was the Titans founded?
CREATE TABLE table_27816698_2 (founded INTEGER,nickname VARCHAR)
SELECT MAX(founded) FROM table_27816698_2 WHERE nickname = "Titans"
what is the unabbreviated version of the open wound of scalp?
CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)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 (r...
SELECT d_icd_diagnoses.long_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'open wound of scalp' UNION SELECT d_icd_procedures.long_title FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'open wound of scalp'
give me flights from ATLANTA to BALTIMORE
CREATE TABLE code_description (code varchar,description text)CREATE TABLE airport (airport_code varchar,airport_name text,airport_location text,state_code varchar,country_name varchar,time_zone_code varchar,minimum_connect_time int)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_descript...
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 = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIM...
did patient 75658 have any results from the microbiology of the sputum a year before?
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance tex...
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 75658) AND microbiologyevents.spec_type_desc = 'sputum' AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 yea...
what was the cause of the most deaths ?
CREATE TABLE table_203_234 (id number,"description" text,"total" number,"poland" number,"baltic states(resettled in poland during war)" number,"resettled in poland during war(from ussr and romania)" number,"sudetendeutsch" number,"se europe\n(hungary,romania,yugoslavia & slovakia)" number)
SELECT "description" FROM table_203_234 ORDER BY "total" DESC LIMIT 1
What was the UDMR for 18-22/04/2009?
CREATE TABLE table_75384 ("Polling Firm" text,"Date" text,"PSD - PC" text,"UDMR" text,"Elena B\u0103sescu" text,"Others" text,"Undecided" text)
SELECT "UDMR" FROM table_75384 WHERE "Date" = '18-22/04/2009'
who was the head of the medici for the most years ?
CREATE TABLE table_203_421 (id number,"name" text,"from" text,"until" text,"relationship with predecessor" text)
SELECT "name" FROM table_203_421 ORDER BY "until" - "from" DESC LIMIT 1
For those employees who was hired before 2002-06-21, for employee_id, hire_date, visualize the trend, I want to sort by the X-axis from high to low please.
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 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),CO...
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE DESC
What is the Record when Buffalo is at Home?
CREATE TABLE table_77724 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text)
SELECT "Record" FROM table_77724 WHERE "Home" = 'buffalo'
count the number of patients whose admission year is less than 2138 and procedure short title is endosc destr stomach les?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2138" AND procedures.short_title = "Endosc destr stomach les"
Which Home team has an Away team of everton?
CREATE TABLE table_76119 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text)
SELECT "Home team" FROM table_76119 WHERE "Away team" = 'everton'
What are the full names of actors who had roles in more than 30 films?
CREATE TABLE city (city_id number,city text,country_id number,last_update time)CREATE TABLE film_actor (actor_id number,film_id number,last_update time)CREATE TABLE inventory (inventory_id number,film_id number,store_id number,last_update time)CREATE TABLE store (store_id number,manager_staff_id number,address_id numbe...
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id HAVING COUNT(*) > 30
Who published Star Citizen in 2014?
CREATE TABLE table_68681 ("Title" text,"Year" text,"Developer" text,"Publisher" text,"Platform" text)
SELECT "Publisher" FROM table_68681 WHERE "Year" = '2014' AND "Title" = 'star citizen'
Which athlete, has an 18.55 result
CREATE TABLE table_name_43 (athlete VARCHAR,result VARCHAR)
SELECT athlete FROM table_name_43 WHERE result = 18.55
List the range distroration for the ramsan-630
CREATE TABLE table_27615520_1 (form_factor VARCHAR,product_name VARCHAR)
SELECT form_factor FROM table_27615520_1 WHERE product_name = "RamSan-630"
who is the driver with the grid of 13?
CREATE TABLE table_51934 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Driver" FROM table_51934 WHERE "Grid" = '13'
Show the position of players and the corresponding number of players Visualize by bar chart, rank from high to low by the total number.
CREATE TABLE team (Team_id int,Name text)CREATE TABLE player (Player_ID int,Player text,Years_Played text,Total_WL text,Singles_WL text,Doubles_WL text,Team int)CREATE TABLE match_season (Season real,Player text,Position text,Country int,Team int,Draft_Pick_Number int,Draft_Class text,College text)CREATE TABLE country ...
SELECT Position, COUNT(*) FROM match_season GROUP BY Position ORDER BY COUNT(*) DESC
what were the top four most frequent laboratory tests since 3 years ago?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmen...
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 4
how much potassium chloride is prescribed the first time since 162 months ago to patient 27177?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)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 outputevents (row_id number,subject_id number,hadm_i...
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27177) AND prescriptions.drug = 'potassium chloride' AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-162 month') ORDER BY prescriptions.startdat...
What is the general classification at stage 18 that has a points classification of Tony Rominger?
CREATE TABLE table_70135 ("Stage" text,"Winner" text,"General classification" text,"Points classification" text,"Mountains classification" text,"Trofeo Fast Team" text)
SELECT "General classification" FROM table_70135 WHERE "Points classification" = 'tony rominger' AND "Stage" = '18'
What series number is the episode with production code bdf101?
CREATE TABLE table_28019988_2 (series__number INTEGER,production_code VARCHAR)
SELECT MAX(series__number) FROM table_28019988_2 WHERE production_code = "BDF101"
since 2105 has patient 025-44842 been prescribed nicoderm cq.
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE microlab (microlabid number,patientunitstayid number...
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 = '025-44842')) AND medication.drugname = 'nicoderm cq' AND STRFTIME('%y', me...
how many patients whose primary disease is st elevated myocardial infarction\cardiac cath and lab test fluid is blood?
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 diagnoses (subject_id text,hadm_id text,icd9_code text,sho...
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.fluid = "Blood"
Who was the conference player of the year when Alabama State was the tournament winner?
CREATE TABLE table_30824 ("Conference" text,"Regular Season Winner" text,"Conference Player of the Year" text,"Conference Tournament" text,"Tournament Venue (City)" text,"Tournament Winner" text)
SELECT "Conference Player of the Year" FROM table_30824 WHERE "Tournament Winner" = 'Alabama State'
What are all the employee ids and the names of the countries in which they work. Visualize by bar chart.
CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_...
SELECT COUNTRY_NAME, SUM(EMPLOYEE_ID) FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID JOIN locations AS T3 ON T2.LOCATION_ID = T3.LOCATION_ID JOIN countries AS T4 ON T3.COUNTRY_ID = T4.COUNTRY_ID GROUP BY COUNTRY_NAME
did patient 031-3355 have any microbiological test result since 12/2104?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,d...
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355')) AND STRFTIME('%y-%m', microlab.culturetakentime) >= '2104-12'
What is the skip with a second of Philippe Caux?
CREATE TABLE table_name_30 (skip VARCHAR,second VARCHAR)
SELECT skip FROM table_name_30 WHERE second = "philippe caux"
How many paper types did Ian Drolet design stamps on?
CREATE TABLE table_367 ("Date of Issue" text,"Theme" text,"Denomination" text,"Design" text,"Illustration" text,"Printing Process" text,"Paper Type" text,"First Day Cover Cancellation" text)
SELECT COUNT("Paper Type") FROM table_367 WHERE "Design" = 'Ian Drolet'
which country has the most #gm ?
CREATE TABLE table_203_663 (id number,"country" text,"zone" text,"national federation" text,"#gm" number,"#fide" number,"national championship" text)
SELECT "country" FROM table_203_663 ORDER BY "#gm" DESC LIMIT 1
What is the winning score of the tournament with Charles Coody as the runner-up?
CREATE TABLE table_7735 ("Date" text,"Tournament" text,"Winning score" text,"Margin of victory" text,"Runner(s)-up" text)
SELECT "Winning score" FROM table_7735 WHERE "Runner(s)-up" = 'charles coody'
Find the number of different states which banks are located at.
CREATE TABLE bank (state VARCHAR)
SELECT COUNT(DISTINCT state) FROM bank
what are all the date for gtc winners graeme mundy jamie smyth and gt3 winners hector lester tim mullen
CREATE TABLE table_13079788_3 (date VARCHAR,gtc_winner VARCHAR,gt3_winner VARCHAR)
SELECT date FROM table_13079788_3 WHERE gtc_winner = "Graeme Mundy Jamie Smyth" AND gt3_winner = "Hector Lester Tim Mullen"
What was the populati in 2000 for Panlicsian?
CREATE TABLE table_2144436_1 (population__2000_ INTEGER,barangay VARCHAR)
SELECT MIN(population__2000_) FROM table_2144436_1 WHERE barangay = "Panlicsian"
What is the number of bronze for Canada and silver is less than 0?
CREATE TABLE table_name_72 (bronze INTEGER,nation VARCHAR,silver VARCHAR)
SELECT SUM(bronze) FROM table_name_72 WHERE nation = "canada" AND silver < 0
What is the Time of the Belarus Player with a Rank larger than 2 and Notes of FB?
CREATE TABLE table_name_98 (time VARCHAR,country VARCHAR,rank VARCHAR,notes VARCHAR)
SELECT time FROM table_name_98 WHERE rank > 2 AND notes = "fb" AND country = "belarus"
[WIP] Who are the top answering users for a set of tags?.
CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text...
SELECT a.Id, a.ParentId, a.Score, a.OwnerUserId, q.Title, q.Tags, q.AnswerCount, q.FavoriteCount FROM Posts AS a INNER JOIN Posts AS q ON q.Id = a.ParentId INNER JOIN PostTags ON q.Id = PostTags.PostId INNER JOIN Users ON a.OwnerUserId = Users.Id WHERE PostTags.TagId IN (SELECT Id FROM Tags WHERE TagName IN (SELECT * F...
How many assessment notes are there in total?
CREATE TABLE ASSESSMENT_NOTES (Id VARCHAR)
SELECT COUNT(*) FROM ASSESSMENT_NOTES
Which country had the swimsuit score 9.67?
CREATE TABLE table_11884814_3 (country VARCHAR,swimsuit VARCHAR)
SELECT country FROM table_11884814_3 WHERE swimsuit = "9.67"
What game has 2 points?
CREATE TABLE table_name_58 (games INTEGER,points VARCHAR)
SELECT MAX(games) FROM table_name_58 WHERE points = 2
Show me about the distribution of ACC_Road and School_ID , and group by attribute ACC_Home in a bar chart, and display in descending by the X.
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 ACC_Road, School_ID FROM basketball_match GROUP BY ACC_Home, ACC_Road ORDER BY ACC_Road DESC
Which Size has an IHSAA Class of aa, and a Location of milan?
CREATE TABLE table_name_76 (size INTEGER,ihsaa_class VARCHAR,location VARCHAR)
SELECT SUM(size) FROM table_name_76 WHERE ihsaa_class = "aa" AND location = "milan"
What was the score on January 26?
CREATE TABLE table_46836 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "Score" FROM table_46836 WHERE "Date" = 'january 26'
Tags that are never used by themselves. This query shows all tags that are always used with another tag. This is a strong indication that the tag can't be stand-alone and might be a meta-tag.
CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidan...
WITH TagNames AS (SELECT t.Id FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.Id = pt.PostId AND p.PostTypeId = 1 WHERE p.Id NOT IN (SELECT p2.Id FROM Posts AS p2 INNER JOIN PostTags AS ptTarget ON p2.Id = ptTarget.PostId AND ptTarget.TagId = t.Id INNER JOIN PostTags AS ptNotTarge...
Who is team E when Jason Manning is Team F?
CREATE TABLE table_47508 ("Team A" text,"Team C" text,"Team D" text,"Team E" text,"Team F" text)
SELECT "Team E" FROM table_47508 WHERE "Team F" = 'jason manning'
What college(s) did the player(s) picked in round 4 with a pick number less than 98 play for?
CREATE TABLE table_name_20 (college VARCHAR,pick__number VARCHAR,round VARCHAR)
SELECT college FROM table_name_20 WHERE pick__number < 98 AND round = "round 4"
In the Datsun Twin 200 race, what was the fastest lap?
CREATE TABLE table_16146 ("Rd" real,"Name" text,"Pole Position" text,"Fastest Lap" text,"Winning driver" text,"Winning team" text,"Report" text)
SELECT "Fastest Lap" FROM table_16146 WHERE "Name" = 'Datsun Twin 200'