instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
Which Opponents have a Partnering of alessandro motti, and a Date of 12 september 2005?
CREATE TABLE table_name_60 (opponents VARCHAR,partnering VARCHAR,date VARCHAR)
SELECT opponents FROM table_name_60 WHERE partnering = "alessandro motti" AND date = "12 september 2005"
How to create an Image file from dataURL and save it?.
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE CloseAsOffTopicReasonTyp...
SELECT Ans.CreationDate, Qus.Tags, Qus.Title, Qus.ViewCount, Ans.Score, Ans.Id, Qus.AcceptedAnswerId FROM Posts AS Qus LEFT JOIN Posts AS Ans ON Qus.Id = Ans.ParentId WHERE Ans.OwnerUserId = 5720148 ORDER BY Ans.CreationDate DESC
How many same release titles are there in the table?
CREATE TABLE torrents (groupname text,totalsnatched number,artist text,groupyear number,releasetype text,groupid number,id number)CREATE TABLE tags (index number,id number,tag text)
SELECT COUNT(*) FROM (SELECT groupname FROM torrents GROUP BY groupname HAVING COUNT(*) > 1)
how many employers have at least 300 employees ?
CREATE TABLE table_203_737 (id number,"#" number,"employer" text,"# of employees" number)
SELECT COUNT("employer") FROM table_203_737 WHERE "# of employees" >= 300
What is the Project Name with a Country that is kazakhstan and a Peak that is 150?
CREATE TABLE table_75368 ("Country" text,"Project Name" text,"Year startup" text,"Operator" text,"Peak" text)
SELECT "Project Name" FROM table_75368 WHERE "Country" = 'kazakhstan' AND "Peak" = '150'
Which Week had a Result of w 10-0, and an Attendance smaller than 58,571?
CREATE TABLE table_name_5 (week VARCHAR,result VARCHAR,attendance VARCHAR)
SELECT COUNT(week) FROM table_name_5 WHERE result = "w 10-0" AND attendance < 58 OFFSET 571
What is the nationality of the journalist with the largest number of years working?
CREATE TABLE news_report (journalist_id number,event_id number,work_type text)CREATE TABLE journalist (journalist_id number,name text,nationality text,age text,years_working number)CREATE TABLE event (event_id number,date text,venue text,name text,event_attendance number)
SELECT nationality FROM journalist ORDER BY years_working DESC LIMIT 1
Name the most ending with
CREATE TABLE table_1879 ("Sl no" real,"Name of the prabandham" text,"Starting from" real,"Ending with" real,"Number of pasurams" real,"Sung by" text)
SELECT MAX("Ending with") FROM table_1879
What is the fewest Al Ahly wins for El Zamalek wins of 0 and 0 draws?
CREATE TABLE table_13861 ("Competition" text,"Total" real,"Al Ahly wins" real,"Draws" real,"El Zamalek wins" real)
SELECT MIN("Al Ahly wins") FROM table_13861 WHERE "Draws" = '0' AND "El Zamalek wins" < '0'
For those records from the products and each product's manufacturer, give me the comparison about code over the name , and group by attribute headquarter by a bar chart, and sort x-axis in descending order.
CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Name DESC
Which Title has an Appointed by of Millard Fillmore?
CREATE TABLE table_name_21 (title VARCHAR,appointed_by VARCHAR)
SELECT title FROM table_name_21 WHERE appointed_by = "millard fillmore"
Who is the driver for team Coll Racing with more than 206 points?
CREATE TABLE table_36662 ("Season" real,"Driver" text,"Team" text,"Tyre" text,"Points" real)
SELECT "Driver" FROM table_36662 WHERE "Team" = 'collé racing' AND "Points" > '206'
For those employees who did not have any job in the past, show me about the distribution of hire_date and the sum of employee_id bin hire_date by time in a bar chart, and sort by the y-axis in descending.
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,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),COMMISSION_PCT decimal(2,2),MANAGE...
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(EMPLOYEE_ID) DESC
what were the first ast (sgot) from patient 010-20205 in 08/last year?
CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnos...
SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-20205')) AND lab.labname = 'ast (sgot)' AND DATETIME(lab.labresulttime, 'start of y...
What was the result of the UEFA Euro 2008 Qualifying competition?
CREATE TABLE table_54538 ("Date" text,"Venue" text,"Score" text,"Result" text,"Competition" text)
SELECT "Result" FROM table_54538 WHERE "Competition" = 'uefa euro 2008 qualifying'
Count the number of budget codes.
CREATE TABLE ref_document_types (document_type_code text,document_type_name text,document_type_description text)CREATE TABLE documents_with_expenses (document_id number,budget_type_code text,document_details text)CREATE TABLE accounts (account_id number,statement_id number,account_details text)CREATE TABLE documents (d...
SELECT COUNT(*) FROM ref_budget_codes
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of email and manager_id , and show by the y axis in desc.
CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DA...
SELECT EMAIL, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID DESC
let me know the number of patients on ih route of drug administration who have diagnoses icd9 code 81201.
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "81201" AND prescriptions.route = "IH"
how many coronar arteriogr-1 cath procedures has been performed until 2 years ago?
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 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 ...
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'coronar arteriogr-1 cath') AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-2 year')
Number of Posts by Number of Users.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE ...
SELECT Posts, COUNT(*) AS Qty FROM (SELECT OwnerUserId, COUNT(OwnerUserId) AS Posts FROM Posts AS P WHERE P.PostTypeId = 1 OR P.PostTypeId = 2 GROUP BY OwnerUserId) AS SUB WHERE Posts > 0 GROUP BY Posts ORDER BY Posts
Name the assists for 157 games
CREATE TABLE table_21497 ("Season" text,"Games" real,"GS" real,"Points" text,"Rebounds" text,"Assists" text,"Blocks" text,"Steals" text,"Turnovers" text)
SELECT "Assists" FROM table_21497 WHERE "Games" = '157'
What is the FCC info of the translator with an Irmo, South Carolina city license?
CREATE TABLE table_name_51 (fcc_info VARCHAR,city_of_license VARCHAR)
SELECT fcc_info FROM table_name_51 WHERE city_of_license = "irmo, south carolina"
Compare the total salary by each hire date (bin it into month interval) of employees using a bar chart, and show in ascending by the total number.
CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_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 countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID d...
SELECT HIRE_DATE, SUM(SALARY) FROM employees ORDER BY SUM(SALARY)
What is the total number of losses for the Team of Montreal with Goals For larger than 29?
CREATE TABLE table_name_50 (losses VARCHAR,goals_for VARCHAR,team VARCHAR)
SELECT COUNT(losses) FROM table_name_50 WHERE goals_for > 29 AND team = "montreal"
What is the gayndah when perry is 304?
CREATE TABLE table_12526990_1 (gayndah INTEGER,perry VARCHAR)
SELECT MAX(gayndah) FROM table_12526990_1 WHERE perry = 304
Who is every main presenter for the Estonia region/country?
CREATE TABLE table_24224647_2 (main_presenter VARCHAR,region_country VARCHAR)
SELECT main_presenter FROM table_24224647_2 WHERE region_country = "Estonia"
What was the resolution of the fight against steve schneider?
CREATE TABLE table_48596 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text)
SELECT "Res." FROM table_48596 WHERE "Opponent" = 'steve schneider'
How did the team place when they did not qualify for the Concaf Champions Cup but made it to Round of 16 in the U.S. Open Cup?
CREATE TABLE table_16857_2 (mls_cup_playoffs VARCHAR,concacaf_champions_cup___champions_league VARCHAR,us_open_cup VARCHAR)
SELECT mls_cup_playoffs FROM table_16857_2 WHERE concacaf_champions_cup___champions_league = "Did not qualify" AND us_open_cup = "Round of 16"
provide the number of patients whose diagnoses long title is insomnia, unspecified and drug type is additive?
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 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 = "Insomnia, unspecified" AND prescriptions.drug_type = "ADDITIVE"
Inform me of what 's needed for a CS-LSA degree .
CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE student_record (student_id int,course_id int,semester int,grade varchar,how varchar,transfer_source varchar,earn_cre...
SELECT DISTINCT program_requirement.additional_req, program_requirement.category, program_requirement.min_credit, program.name FROM program, program_requirement WHERE program.name LIKE '%CS-LSA%' AND program.program_id = program_requirement.program_id
who are the participants that wear clothing in 33-23-36
CREATE TABLE table_29584 ("Represent" real,"Contestant" text,"Age" real,"Sizes" text,"Height" text,"Hometown" text,"Agency" text)
SELECT "Contestant" FROM table_29584 WHERE "Sizes" = '33-23-36'
How many of 3:26.00 have a championship record?
CREATE TABLE table_23987362_2 (world_record VARCHAR)
SELECT COUNT(3) AS :2600 FROM table_23987362_2 WHERE world_record = "Championship record"
what is the play when the company is cyprus theatre organisation?
CREATE TABLE table_name_61 (play VARCHAR,company VARCHAR)
SELECT play FROM table_name_61 WHERE company = "cyprus theatre organisation"
Short comment with thanks askdiff.
CREATE TABLE FlagTypes (Id number,Name text,Description text)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 PostTags (PostId number,TagId number)CREATE TABLE Review...
SELECT 'https://apple.stackexchange.com/questions/' + CAST(PostId AS TEXT), Text, Score, Comments.CreationDate, Users.DisplayName, Users.Reputation FROM Comments INNER JOIN Users ON Comments.UserId = Users.Id WHERE LENGTH(Text) < 20 AND (Text LIKE '%thanks%' OR Text LIKE '%welcome%' OR Text LIKE '%works%') ORDER BY Cre...
What's the record of Barbados?
CREATE TABLE table_14050 ("Event" text,"Record" text,"Nationality" text,"Date" text,"Games" text)
SELECT "Record" FROM table_14050 WHERE "Nationality" = 'barbados'
What is Part 4, when Part 2 is 'hlj p'?
CREATE TABLE table_name_65 (part_4 VARCHAR,part_2 VARCHAR)
SELECT part_4 FROM table_name_65 WHERE part_2 = "hljóp"
what airlines have BUSINESS class
CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)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_spe...
SELECT DISTINCT airline.airline_code FROM airline, fare, fare_basis, flight, flight_fare WHERE fare_basis.class_type = 'BUSINESS' AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.airline_code = airline.airline_code AND flight.flight_id = flight_fare.flight_id
find the name of subject id 65652.
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text...
SELECT demographic.name FROM demographic WHERE demographic.subject_id = "65652"
Show all fires caused by campfires in Texas.
CREATE TABLE fires (fire_year number,discovery_date number,discovery_doy number,discovery_time text,stat_cause_code number,stat_cause_descr text,cont_date text,cont_doy text,cont_time text,fire_size number,fire_size_class text,latitude number,longitude number,owner_code number,owner_descr text,state text,county text,fi...
SELECT * FROM fires WHERE state = "TX" AND stat_cause_descr LIKE "Campfire"
Name the maximum number of disc for bill gereghty
CREATE TABLE table_15430606_1 (no_disc INTEGER,directed_by VARCHAR)
SELECT MAX(no_disc) FROM table_15430606_1 WHERE directed_by = "Bill Gereghty"
how many patients got dialysis access surgery two times during the previous year?
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,systemicsystolic number,systemicdiastolic number,systemicmean number,obs...
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 = 'dialysis access surgery' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(),...
When 52 is the ends won what is the skip(club)?
CREATE TABLE table_4216 ("Skip (Club)" text,"W" real,"L" real,"PF" real,"PA" real,"Ends Won" real,"Ends Lost" real,"Blank Ends" real,"Stolen Ends" real)
SELECT "Skip (Club)" FROM table_4216 WHERE "Ends Won" = '52'
Name the Home team of tranmere rovers?
CREATE TABLE table_name_14 (date VARCHAR,home_team VARCHAR)
SELECT date FROM table_name_14 WHERE home_team = "tranmere rovers"
The school nicknamed the wildcats has what sum of enrollment?
CREATE TABLE table_33202 ("Institution" text,"Location" text,"Founded" real,"Affiliation" text,"Enrollment" real,"Team Nickname" text)
SELECT SUM("Enrollment") FROM table_33202 WHERE "Team Nickname" = 'wildcats'
What was the total enrollment 08-09 of Franklin County?
CREATE TABLE table_63669 ("School" text,"City" text,"Team Name" text,"Enrollment 08-09" real,"IHSAA Class" text,"IHSAA Class Football" text,"County" text,"Year Joined (Or Joining)" real,"Previous Conference" text)
SELECT COUNT("Enrollment 08-09") FROM table_63669 WHERE "School" = 'franklin county'
Which Format has a Label of eagle eye media, a Catalogue number(s) of , and a Country of united states?
CREATE TABLE table_name_33 (format VARCHAR,country VARCHAR,label VARCHAR,catalogue_number_s_ VARCHAR)
SELECT format FROM table_name_33 WHERE label = "eagle eye media" AND catalogue_number_s_ = "—" AND country = "united states"
When did the person born 24 September 1851 pass away?
CREATE TABLE table_77831 ("Name" text,"Date of Birth" text,"Date of Death" text,"Age at Time of Disaster" text,"Age at Time of Death" text)
SELECT "Date of Death" FROM table_77831 WHERE "Date of Birth" = '24 september 1851'
What solvent has a boiling point of 100 103 c?
CREATE TABLE table_name_55 (solvent VARCHAR,boiling_point VARCHAR)
SELECT solvent FROM table_name_55 WHERE boiling_point = "100–103 °c"
Who was the opponent with a score of 141 102?
CREATE TABLE table_name_97 (opponent VARCHAR,score VARCHAR)
SELECT opponent FROM table_name_97 WHERE score = "141–102"
Which class has more than 15 people in the class?
CREATE TABLE table_name_83 (class VARCHAR,number_in_class INTEGER)
SELECT class FROM table_name_83 WHERE number_in_class > 15
What is the time/retired for thierry boutsen?
CREATE TABLE table_name_92 (time_retired VARCHAR,driver VARCHAR)
SELECT time_retired FROM table_name_92 WHERE driver = "thierry boutsen"
how many patients aged below 83 years had the drug code albu5250?
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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "83" AND prescriptions.formulary_drug_cd = "ALBU5250"
What is the name of the location and ship type in the Gulf of Mexico that entered service in 1999?
CREATE TABLE table_37191 ("Name" text,"Type" text,"Entered service" text,"Water depth" text,"Location" text,"Customer" text)
SELECT "Name" FROM table_37191 WHERE "Location" = 'gulf of mexico' AND "Type" = 'ship' AND "Entered service" = '1999'
Which year has most matches?
CREATE TABLE football_data (season text,datetime time,div text,country text,league text,referee text,hometeam text,awayteam text,fthg number,ftag number,ftr text,hthg number,htag number,htr text,psh number,psd number,psa number,b365h number,b365d number,b365a number,lbh number,lbd number,lba number,bwh number,bwd numbe...
SELECT year FROM betfront GROUP BY year ORDER BY COUNT(*) DESC LIMIT 1
provide the number of patients whose item id is 51214 and lab test abnormal status is delta.
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51214" AND lab.flag = "delta"
how many airport with rank being 4
CREATE TABLE table_19026 ("Rank" real,"Airport" text,"Total Passengers" real,"% Change 2005/2006" text,"International Passengers" real,"Domestic Passengers" real,"Transit Passengers" real,"Aircraft Movements" real,"Freight (Metric Tonnes)" real)
SELECT COUNT("Airport") FROM table_19026 WHERE "Rank" = '4'
What year is United States school/club team from Arkansas play in Toronto
CREATE TABLE table_31535 ("Player" text,"Nationality" text,"Position" text,"Years in Toronto" text,"School/Club Team" text)
SELECT "Years in Toronto" FROM table_31535 WHERE "Nationality" = 'united states' AND "School/Club Team" = 'arkansas'
Which home team played against Los Angeles in game 1?
CREATE TABLE table_49635 ("Game" text,"Date" text,"Home Team" text,"Result" text,"Road Team" text)
SELECT "Home Team" FROM table_49635 WHERE "Road Team" = 'los angeles' AND "Game" = 'game 1'
Which candidates are from the Missouri 3 district?
CREATE TABLE table_1341586_26 (candidates VARCHAR,district VARCHAR)
SELECT candidates FROM table_1341586_26 WHERE district = "Missouri 3"
what is maximum age of patients whose admission type is urgent and insurance is government?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.insurance = "Government"
What are the top 10 countries with most number of operational plants?
CREATE TABLE nuclear_power_plants (id text,name text,latitude text,longitude text,country text,status text,reactortype text,reactormodel text,constructionstartat text,operationalfrom text,operationalto text,capacity text,lastupdatedat text,source text)
SELECT country FROM nuclear_power_plants WHERE status = "Operational" GROUP BY country ORDER BY COUNT(name) DESC LIMIT 10
has patient 006-205326 undergone any medical procedure in a year before?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,...
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-205326')) AND DATETIME(treatment.treatmenttime, 'start of year') = DATET...
How many University founded in 1863?
CREATE TABLE table_2004 ("Institution" text,"Location" text,"Founded" real,"Affiliation" text,"Enrollment" real,"Year Joined" real,"Nickname" text,"Conference" text)
SELECT COUNT("Enrollment") FROM table_2004 WHERE "Founded" = '1863'
What is the total of quantity rebuilt if the type is 1B N2T and the railway number is 88, 118?
CREATE TABLE table_name_4 (quantity_rebuilt VARCHAR,type VARCHAR,railway_number_s_ VARCHAR)
SELECT COUNT(quantity_rebuilt) FROM table_name_4 WHERE type = "1b n2t" AND railway_number_s_ = "88, 118"
What is the number of companies for each headquarter? Visualize by bar chart, and could you order by the total number in ascending?
CREATE TABLE employment (Company_ID int,People_ID int,Year_working int)CREATE TABLE people (People_ID int,Age int,Name text,Nationality text,Graduation_College text)CREATE TABLE company (Company_ID real,Name text,Headquarters text,Industry text,Sales_in_Billion real,Profits_in_Billion real,Assets_in_Billion real,Market...
SELECT Headquarters, COUNT(Headquarters) FROM company GROUP BY Headquarters ORDER BY COUNT(Headquarters)
show all train numbers and names ordered by their time from early to late.
CREATE TABLE train (train_number VARCHAR,name VARCHAR,TIME VARCHAR)
SELECT train_number, name FROM train ORDER BY TIME
What club scored 143 goals?
CREATE TABLE table_66788 ("Rank" text,"Goals" text,"Player" text,"Club" text,"Season" text)
SELECT "Club" FROM table_66788 WHERE "Goals" = '143'
Which year did enrolled Gambier members leave?
CREATE TABLE table_73910 ("Institution" text,"Location (all in Ohio)" text,"Nickname" text,"Founded" real,"Type" text,"Enrollment" text,"Joined" real,"Left" real,"Current Conference" text)
SELECT MIN("Left") FROM table_73910 WHERE "Location (all in Ohio)" = 'Gambier'
A bar chart for giveing me the number of the descriptions of the service types that cost more than 100, and sort x-axis from high to low order please.
CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID INTEGER,Address_ID INTEGER,Currency_Code CHAR(15),Marketing_Region_Code CHAR(15),Store_Name VARCHAR(255),Store_Phone VARCHAR(255),Store_Email_Address VARCHAR(255),Other_Details VARCHAR(255))CREATE TABLE Customer_Orders (Order_ID INTEGER,Customer_ID INTEGER,Store_ID ...
SELECT Service_Type_Description, COUNT(Service_Type_Description) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100 GROUP BY Service_Type_Description ORDER BY Service_Type_Description DESC
how many patients are admitted in clinic referral/premature and diagnosed with primary disease left femur fracture?
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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.diagnosis = "LEFT FEMUR FRACTURE"
severe renal, lung and liver disease
CREATE TABLE table_test_5 ("id" int,"systemic_lupus_erythematosus" bool,"anemia" bool,"gender" string,"pregnancy_or_lactation" bool,"serum_potassium" float,"hemoglobin_a1c_hba1c" float,"heart_disease" bool,"renal_disease" bool,"creatinine_clearance_cl" float,"estimated_glomerular_filtration_rate_egfr" int,"chronic_infl...
SELECT * FROM table_test_5 WHERE renal_disease = 1 OR lung_disease = 1 OR liver_disease = 1
Show the names of artworks in ascending order of the year they are nominated in.
CREATE TABLE festival_detail (festival_id number,festival_name text,chair_name text,location text,year number,num_of_audience number)CREATE TABLE artwork (artwork_id number,type text,name text)CREATE TABLE nomination (artwork_id number,festival_id number,result text)
SELECT T2.name FROM nomination AS T1 JOIN artwork AS T2 ON T1.artwork_id = T2.artwork_id JOIN festival_detail AS T3 ON T1.festival_id = T3.festival_id ORDER BY T3.year
For those employees who was hired before 2002-06-21, for commission_pct, hire_date, visualize the trend.
CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,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 (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE...
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE HIRE_DATE < '2002-06-21'
What is the title of the episode watched by 0.88 million U.S. viewers?
CREATE TABLE table_30682 ("No. in series" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"U.S. viewers (million)" text)
SELECT "Title" FROM table_30682 WHERE "U.S. viewers (million)" = '0.88'
what is the drug that patient 54386 was prescribed with within 2 days after having undergone entral infus nutrit sub on the last hospital encounter?
CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)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,language text,marital_status ...
SELECT t2.drug FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 54386 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = ...
Who are the players that played for the jazz from 1979-86
CREATE TABLE table_16857 ("Player" text,"No." real,"Nationality" text,"Position" text,"Years for Jazz" text,"School/Club Team" text)
SELECT "Player" FROM table_16857 WHERE "Years for Jazz" = '1979-86'
what would be the maximum daily number of patients diagnosed with fall from chair in this year?
CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance text,language text,marital_status text,ethnicity text,age number)C...
SELECT MAX(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'fall from chair') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 's...
how many municipalities exist in the province of cadiz ?
CREATE TABLE table_203_3 (id number,"province" text,"capital" text,"population" number,"density" text,"municipalities" text,"legal districts" number)
SELECT "municipalities" FROM table_203_3 WHERE "province" = 'cadiz'
In what county is the entry that has a Construction Completed date of 07/19/2000 and a Listed date of 09/21/1984 located?
CREATE TABLE table_55864 ("CERCLIS ID" text,"Name" text,"County" text,"Proposed" text,"Listed" text,"Construction completed" text,"Partially deleted" text,"Deleted" text)
SELECT "County" FROM table_55864 WHERE "Listed" = '09/21/1984' AND "Construction completed" = '07/19/2000'
What is the T4 Place Player with a Score of more than 66?
CREATE TABLE table_name_1 (player VARCHAR,score VARCHAR,place VARCHAR)
SELECT player FROM table_name_1 WHERE score > 66 AND place = "t4"
What is the sum of t ( m), when Technology is MJ?
CREATE TABLE table_45893 ("Technology" text,"\u03b7 (%)" real,"V OC (V)" text,"I SC (A)" text,"W/m\u00b2" text,"t (\u00b5m)" real)
SELECT SUM("t (\u00b5m)") FROM table_45893 WHERE "Technology" = 'mj'
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of email and employee_id , order y-axis from high to low order.
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 departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANA...
SELECT EMAIL, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMPLOYEE_ID DESC
the 1984 paralympics had a total ranking of 5th , in what other year did the ranking fall above 6th ?
CREATE TABLE table_204_374 (id number,"event" text,"gold" number,"silver" number,"bronze" number,"total" number,"ranking" text)
SELECT "event" FROM table_204_374 WHERE "event" <> '1984 winter paralympics' AND "ranking" < 6
What was the home team that played at Corio Oval?
CREATE TABLE table_name_15 (home_team VARCHAR,venue VARCHAR)
SELECT home_team FROM table_name_15 WHERE venue = "corio oval"
What was the Date of Country of United States?
CREATE TABLE table_52127 ("Country" text,"Date" text,"Label" text,"Format" text,"Catalogue" text)
SELECT "Date" FROM table_52127 WHERE "Country" = 'united states'
What is the lowest ranking for Paul Mctiernan?
CREATE TABLE table_69466 ("Ranking" real,"Nationality" text,"Name" text,"Years" text,"Goals" real)
SELECT MIN("Ranking") FROM table_69466 WHERE "Name" = 'paul mctiernan'
What is the best time for marcus marshall?
CREATE TABLE table_34672 ("Name" text,"Team" text,"Qual 1" text,"Qual 2" text,"Best" real)
SELECT AVG("Best") FROM table_34672 WHERE "Name" = 'marcus marshall'
In games where st kilda was the away team, what was the smallest crowd?
CREATE TABLE table_name_68 (crowd INTEGER,away_team VARCHAR)
SELECT MIN(crowd) FROM table_name_68 WHERE away_team = "st kilda"
Name the districk for larry mcdonald
CREATE TABLE table_72380 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "District" FROM table_72380 WHERE "Incumbent" = 'Larry McDonald'
what is the name of the first song listed on this chart ?
CREATE TABLE table_203_862 (id number,"draw" number,"artist" text,"song" text,"points" number,"place" text)
SELECT "song" FROM table_203_862 WHERE id = 1
On what Date was the Result of the game W 30 15?
CREATE TABLE table_47758 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" text)
SELECT "Date" FROM table_47758 WHERE "Result" = 'w 30–15'
calculate the maximum age of married patients who are aged 45 years or more.
CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.age >= "45"
A bar chart for what are the number of the facility codes of the apartments with more than four bedrooms?, and sort in ascending by the the number of facility code.
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 INTEGER,facility_code CHAR(15))CREATE TABLE ...
SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code ORDER BY COUNT(facility_code)
questions only tagged with merge.
CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate tim...
SELECT Id AS "post_link" FROM Posts WHERE PostTypeId = 1 AND Tags LIKE '<cognito-forms>'
Which Location has a Method of decision (unanimous), and Res of win x?
CREATE TABLE table_name_99 (location VARCHAR,method VARCHAR,res VARCHAR)
SELECT location FROM table_name_99 WHERE method = "decision (unanimous)" AND res = "win x"
How many classes in the Fall and Winter term are 500 -level classes ?
CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE gsi (course_offering_id int,student_id int)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 i...
SELECT COUNT(DISTINCT course.course_id, semester.semester) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'department0' AND course.number BETWEEN 500 AND 500 + 100 AND semester.semester IN ('FA', 'WN') AND semester.semester_id = course_offering.semester...
What is the sum of q > 1 when q > 1.05 is bigger than 18,233, and a q > 1.4 less than 112, and q > 1.1 is 13,266?
CREATE TABLE table_44420 ("q > 1" real,"q > 1.05" real,"q > 1.1" real,"q > 1.2" real,"q > 1.3" real,"q > 1.4" real)
SELECT COUNT("q > 1") FROM table_44420 WHERE "q > 1.05" > '18,233' AND "q > 1.4" < '112' AND "q > 1.1" = '13,266'
Which 92.5 holds the world record?
CREATE TABLE table_8026 ("World Record" text,"Press" text,"92.5" text,"Hans W\u00f6lpert" text,"Mannheim (GER)" text)
SELECT "World Record" FROM table_8026 WHERE "Press" = '92.5'
A bar chart for listing the number of the names of patients who have made appointments, I want to display x-axis in desc order.
CREATE TABLE Physician (EmployeeID INTEGER,Name VARCHAR(30),Position VARCHAR(30),SSN INTEGER)CREATE TABLE On_Call (Nurse INTEGER,BlockFloor INTEGER,BlockCode INTEGER,OnCallStart DATETIME,OnCallEnd DATETIME)CREATE TABLE Appointment (AppointmentID INTEGER,Patient INTEGER,PrepNurse INTEGER,Physician INTEGER,Start DATETIME...
SELECT Name, COUNT(Name) FROM Appointment AS T1 JOIN Patient AS T2 ON T1.Patient = T2.SSN GROUP BY Name ORDER BY Name DESC
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, find hire_date and the amount of hire_date bin hire_date by time, and visualize them by a bar chart.
CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25)...
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40