instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
All questions by a specific user.
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 Id AS "post_link", Title, Score, ViewCount, AnswerCount, Tags FROM Posts WHERE (PostTypeId = 1) AND (OwnerUserId = '##userid##') ORDER BY Id
Name the MDE course which is easiest .
CREATE TABLE area (course_id int,area varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE course (course_id int,name varchar,department varchar,number varchar,credits varchar,advisory_requirement varchar,enforced_requirement varchar,description varchar,num_semesters int,num_enrolled ...
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_cou...
How many diffrent dorm amenities are there?
CREATE TABLE has_amenity (dormid number,amenid number)CREATE TABLE dorm_amenity (amenid number,amenity_name text)CREATE TABLE dorm (dormid number,dorm_name text,student_capacity number,gender text)CREATE TABLE lives_in (stuid number,dormid number,room_number number)CREATE TABLE student (stuid number,lname text,fname te...
SELECT COUNT(*) FROM dorm_amenity
provide the number of patients whose diagnoses short title is long-term use of aspirin and drug route is iv bolus?
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 text,formulary_drug_cd text,route text,drug_dose 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 = "Long-term use of aspirin" AND prescriptions.route = "IV BOLUS"
What was the term of Hon Peter Morris?
CREATE TABLE table_58411 ("Member" text,"Party" text,"Electorate" text,"State" text,"Term in office" text)
SELECT "Term in office" FROM table_58411 WHERE "Member" = 'hon peter morris'
For those records from the products and each product's manufacturer, a bar chart shows the distribution of founder and the sum of manufacturer , and group by attribute founder.
CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)
SELECT Founder, SUM(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
mention the diagnosis short title of diagnosis icd9 code 3671.
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 demographic (subject_id text,hadm_id text,name text,marital...
SELECT diagnoses.short_title FROM diagnoses WHERE diagnoses.icd9_code = "3671"
Show me about the distribution of ACC_Regular_Season and School_ID in a bar chart, rank from low to high 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 ACC_Regular_Season, School_ID FROM basketball_match ORDER BY School_ID
What was the violent crime rate in the city where the robbery rate was 201.4?
CREATE TABLE table_22190 ("State" text,"City" text,"Population" real,"Violent Crime" text,"Murder and Non-Negligent Manslaughter" text,"Forcible Rape" text,"Robbery" text,"Aggravated Assault" text,"Property Crime" text,"Burglary" text,"Larceny-Theft" text,"Motor Vehicle Theft" text)
SELECT "Violent Crime" FROM table_22190 WHERE "Robbery" = '201.4'
what is the original airdate for garfield episode 2 the wise man
CREATE TABLE table_22394 ("Episode" text,"Garfield Episode 1" text,"U.S. Acres Episode" text,"Garfield Episode 2" text,"Original Airdate" text)
SELECT "Original Airdate" FROM table_22394 WHERE "Garfield Episode 2" = 'The Wise Man'
Among patients admitted to emergency room, how many of them were born before 2184?
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 WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.dob_year < "2184"
What are all details of the students who registered but did not attend any course?
CREATE TABLE students (student_id number,student_details text)CREATE TABLE people_addresses (person_address_id number,person_id number,address_id number,date_from time,date_to time)CREATE TABLE people (person_id number,first_name text,middle_name text,last_name text,cell_mobile_number text,email_address text,login_name...
SELECT * FROM student_course_registrations WHERE NOT student_id IN (SELECT student_id FROM student_course_attendance)
Who was the republican candidate in the race with incumbent thelma drake?
CREATE TABLE table_17503169_1 (republican VARCHAR,incumbent VARCHAR)
SELECT republican FROM table_17503169_1 WHERE incumbent = "Thelma Drake"
What is Heat, when Mark is 6.69?
CREATE TABLE table_name_42 (heat VARCHAR,mark VARCHAR)
SELECT heat FROM table_name_42 WHERE mark = "6.69"
In what place is the artist Midnight Band with a draw larger than 2 and less than 139 points.
CREATE TABLE table_name_7 (place VARCHAR,artist VARCHAR,draw VARCHAR,points VARCHAR)
SELECT place FROM table_name_7 WHERE draw > 2 AND points < 139 AND artist = "midnight band"
If the Cuatro Ca adas municipality percentage is 252, what are all the San Antonio de Lomer o municipality percentage?
CREATE TABLE table_19998428_3 (san_antonio_de_lomerío_municipality___percentage_ VARCHAR,cuatro_cañadas_municipality___percentage_ VARCHAR)
SELECT san_antonio_de_lomerío_municipality___percentage_ FROM table_19998428_3 WHERE cuatro_cañadas_municipality___percentage_ = "252"
When did Charles III die?
CREATE TABLE table_56476 ("Name" text,"Date of birth" text,"Date of death" text,"Reign" text,"Relationship with predecessor" text)
SELECT "Date of death" FROM table_56476 WHERE "Name" = 'charles iii'
give me the number of patients whose days of hospital stay is greater than 3 and lab test category is chemistry?
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,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_fla...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "3" AND lab."CATEGORY" = "Chemistry"
provide the number of patients whose procedure icd9 code is 3607?
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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "3607"
when was patient 99747 first prescribed any medication on the dialys route during the previous month?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,va...
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99747) AND prescriptions.route = 'dialys' AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY pr...
How many clubs have won 6 games?
CREATE TABLE table_12886178_5 (club VARCHAR,won VARCHAR)
SELECT COUNT(club) FROM table_12886178_5 WHERE won = "6"
Name the location attendance for game more than 54 on february 25
CREATE TABLE table_53794 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "Location Attendance" FROM table_53794 WHERE "Game" > '54' AND "Date" = 'february 25'
provide me with the top four most common intake in 2102?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,syst...
SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%intake%' AND STRFTIME('%y', intakeoutput.intakeoutputtime) = '2102' GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 4
What is the highest gold with 1 silver, and more than 1 altogether?
CREATE TABLE table_12468 ("Rank" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MAX("Gold") FROM table_12468 WHERE "Silver" = '1' AND "Total" > '1'
How many years was the total 402?
CREATE TABLE table_19522 ("Ranking" real,"Nationality" text,"Name" text,"Position" text,"Years" text,"League" real,"Cup" real,"Europe" real,"Others" real,"Total" real)
SELECT COUNT("Years") FROM table_19522 WHERE "Total" = '402'
how many days have elapsed since patient 15447 last received an intake of d5w on the current intensive care unit visit?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)C...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', inputevents_cv.charttime)) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15447) AND icustays.outtime IS NULL) ...
What is the IHSAA class of Centerville, which plays IHSAA class AA football?
CREATE TABLE table_name_92 (ihsaa_class VARCHAR,ihsaa_football_class VARCHAR,school VARCHAR)
SELECT ihsaa_class FROM table_name_92 WHERE ihsaa_football_class = "aa" AND school = "centerville"
What is the fastest lap with pole position of gilles villeneuve?
CREATE TABLE table_16723 ("Rnd" real,"Race" text,"Date" text,"Location" text,"Pole Position" text,"Fastest Lap" text,"Race Winner" text,"Constructor" text,"Report" text)
SELECT "Fastest Lap" FROM table_16723 WHERE "Pole Position" = 'Gilles Villeneuve'
what is the number of patients whose ethnicity is white - russian and diagnoses long title is unspecified septicemia?
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 WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND diagnoses.long_title = "Unspecified septicemia"
how much longer is the 20th tour de france stage than the 19th ?
CREATE TABLE table_203_475 (id number,"stage" number,"date" text,"route" text,"terrain" text,"length" text,"winner" text)
SELECT (SELECT "length" FROM table_203_475 WHERE "stage" = 20) - (SELECT "length" FROM table_203_475 WHERE "stage" = 19)
What region is the host university of southern california located?
CREATE TABLE table_name_1 (region VARCHAR,host VARCHAR)
SELECT region FROM table_name_1 WHERE host = "university of southern california"
what was the first sputum microbiology test performed in 05/last year for patient 54281?
CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,chartt...
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 54281) AND microbiologyevents.spec_type_desc = 'sputum' AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start o...
Who is the athlete who was picked before round 9, had an overall draft pick after number 143 and plays the position of db?
CREATE TABLE table_name_23 (player VARCHAR,position VARCHAR,round VARCHAR,overall VARCHAR)
SELECT player FROM table_name_23 WHERE round < 9 AND overall > 143 AND position = "db"
how many patients stayed in hospital more than 0 days and diagnosed with pulmonary collapse?
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 WHERE demographic.days_stay > "0" AND diagnoses.long_title = "Pulmonary collapse"
the previous year, what was the three most frequent drugs prescribed to patients within the same hospital visit after being diagnosed with dka?
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 intakeoutput (intakeoutputid number,patientunitstayid number,c...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'dka' AND DATETI...
Which qual has rank of more than 28 and a grid number that is bigger than 23?
CREATE TABLE table_11376 ("Grid" real,"Constructor" text,"Qual" real,"Rank" real,"Laps" real,"Time/Retired" text)
SELECT "Qual" FROM table_11376 WHERE "Rank" > '28' AND "Grid" > '23'
Questions closed as off topic on not constructive.
CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance t...
SELECT * FROM Posts AS Questions WHERE Questions.PostTypeId = 1 AND Questions.Tags LIKE '%<' + '##tagname:string##' + '>%' OR (Questions.Title LIKE '%' + '##topic:string##' + '%' OR Questions.Tags LIKE '%<' + '##topic:string##' + '>%' OR Questions.Body LIKE '%' + '##topic:string##' + '%') AND YEAR(Questions.CreationDat...
What suburb/town has school years of k-6, was founded before 1875, and has Ashfield Public School as its school?
CREATE TABLE table_59508 ("School" text,"Suburb/Town" text,"Years" text,"Founded" real,"Website" text)
SELECT "Suburb/Town" FROM table_59508 WHERE "Years" = 'k-6' AND "Founded" < '1875' AND "School" = 'ashfield public school'
What is the 2008-09 result has Masters as the event?
CREATE TABLE table_name_58 (event VARCHAR)
SELECT 2008 AS _09 FROM table_name_58 WHERE event = "masters"
when was bobbie phillips first role in tv ?
CREATE TABLE table_202_178 (id number,"year" text,"title" text,"role" text,"notes" text)
SELECT MIN("year") FROM table_202_178
What are the notes for South Africa?
CREATE TABLE table_name_8 (notes VARCHAR,country VARCHAR)
SELECT notes FROM table_name_8 WHERE country = "south africa"
What date did mehmet okur (24) have the most points?
CREATE TABLE table_name_14 (date VARCHAR,high_points VARCHAR)
SELECT date FROM table_name_14 WHERE high_points = "mehmet okur (24)"
Give the number of patients who are diagnosed with hypospadias and have their lab test as abnormal.
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 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Hypospadias" AND lab.flag = "abnormal"
Find all posts where a certain user has edited and included a certain keyword.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskStates (Id number,Name text,Description text)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId n...
SELECT DISTINCT PostHistory.PostId AS "post_link" FROM PostHistory LEFT JOIN Posts ON Posts.Id = PostHistory.PostId WHERE PostHistoryTypeId = 5 AND Text LIKE '%' + '##keyword:string##' + '%' AND OwnerUserId = '##UserId##' AND Posts.CreationDate > '##date##'
How many Events have a Top-10 larger than 6, and a Top-5 smaller than 8?
CREATE TABLE table_name_80 (events VARCHAR,top_10 VARCHAR,top_5 VARCHAR)
SELECT COUNT(events) FROM table_name_80 WHERE top_10 > 6 AND top_5 < 8
What is Points, when Series is Queensland Formula Ford Championship, and when Position is 1st?
CREATE TABLE table_45824 ("Season" real,"Series" text,"Points" text,"Position" text,"Driver" text)
SELECT "Points" FROM table_45824 WHERE "Series" = 'queensland formula ford championship' AND "Position" = '1st'
Which Raison Blue has the highest nicotine?
CREATE TABLE table_38189 ("Name" text,"Size" text,"Price" text,"Quantity" real,"Released" text,"Nicotine" real)
SELECT MAX("Nicotine") FROM table_38189 WHERE "Name" = 'raison blue'
when does patient 10425 have received a urine microbiology test for the first time in 09/last year?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABL...
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10425) AND microbiologyevents.spec_type_desc = 'urine' AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of...
What was the name of the epiode written by Gary M. Goodrich?
CREATE TABLE table_26554 ("No. in series" real,"No. in season" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" real)
SELECT "Title" FROM table_26554 WHERE "Written by" = 'Gary M. Goodrich'
What is the pole position of the Hungarian Grand Prix?
CREATE TABLE table_name_41 (pole_position VARCHAR,grand_prix VARCHAR)
SELECT pole_position FROM table_name_41 WHERE grand_prix = "hungarian grand prix"
What is the lowest number of bronze of the nation with more than 13 total medals, more than 10 gold medals, and less than 22 silvers?
CREATE TABLE table_61172 ("Rank" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MIN("Bronze") FROM table_61172 WHERE "Total" > '13' AND "Gold" > '10' AND "Silver" < '22'
When the wins is 3, what is the maximum races?
CREATE TABLE table_1654 ("Season" text,"Series" text,"Team Name" text,"Races" real,"Poles" real,"Wins" real,"Points" real,"Final Placing" text)
SELECT MAX("Races") FROM table_1654 WHERE "Wins" = '3'
are or become pregnant
CREATE TABLE table_train_11 ("id" int,"pregnancy_or_lactation" bool,"severe_sepsis" bool,"active_infection" bool,"heart_disease" bool,"body_weight" float,"septic_shock" bool,"serum_aminotransferase_level_alt_ast" int,"NOUSE" float)
SELECT * FROM table_train_11 WHERE pregnancy_or_lactation = 1
When hossein askari is the stage winner who is the malaysian rider classification ?
CREATE TABLE table_19868 ("Stage" real,"Stage winner" text,"General classification" text,"Points classification" text,"Mountains classification" text,"Malaysian rider classification" text,"Team classification" text)
SELECT "Malaysian rider classification" FROM table_19868 WHERE "Stage winner" = 'Hossein Askari'
What is the smallest all around when the total is 19.85 and the hoop is less than 9.85?
CREATE TABLE table_name_70 (all_around INTEGER,total VARCHAR,hoop VARCHAR)
SELECT MIN(all_around) FROM table_name_70 WHERE total = 19.85 AND hoop < 9.85
What class is easier if the choice is between EECS 555 and EECS 651 ?
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 int,good_feedback int,tough_tests int,heavy_papers int,cares_for_students int,heavy_assignments int,respe...
SELECT DISTINCT course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (course.number = 555 OR course.number = 651) AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN course AS COURSEalias1 ON ...
What is the email of the student with first name 'Emma' and last name 'Rohan'?
CREATE TABLE Students (email_address VARCHAR,first_name VARCHAR,last_name VARCHAR)
SELECT email_address FROM Students WHERE first_name = "Emma" AND last_name = "Rohan"
What's the score of Game 2?
CREATE TABLE table_name_73 (score VARCHAR,game VARCHAR)
SELECT score FROM table_name_73 WHERE game = 2
how much does it cost patient 73423 to stay in hospital in their last hospital visit?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE labevents (row_id number,subject_id number,hadm_id n...
SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73423 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)
What win method has a time of 2:32?
CREATE TABLE table_name_71 (method VARCHAR,time VARCHAR)
SELECT method FROM table_name_71 WHERE time = "2:32"
Which Conceded has Draws smaller than 5, and a Position larger than 6?
CREATE TABLE table_name_39 (conceded INTEGER,draws VARCHAR,position VARCHAR)
SELECT SUM(conceded) FROM table_name_39 WHERE draws < 5 AND position > 6
What are the names and scores of all wines?
CREATE TABLE grapes (id number,grape text,color text)CREATE TABLE appellations (no number,appelation text,county text,state text,area text,isava text)CREATE TABLE wine (no number,grape text,winery text,appelation text,state text,name text,year number,price number,score number,cases number,drink text)
SELECT name, score FROM wine
What is the lowest minutes a goalkeeper with 13 games played has?
CREATE TABLE table_70248 ("Player" text,"Club" text,"Games Played" real,"Minutes" real,"Goals Against" real,"GA Average" real,"Wins" real,"Loses" real)
SELECT MIN("Minutes") FROM table_70248 WHERE "Games Played" = '13'
What royal house did Shaokang belong to?
CREATE TABLE table_46031 ("Type" text,"Name" text,"Title" text,"Royal house" text,"From" text)
SELECT "Royal house" FROM table_46031 WHERE "Name" = 'shaokang'
when was the last time when patient 46528 was prescribed sevelamer and erythromycin at the same time in 04/2102?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE labevents (row_id number,subject_id number,hadm_id n...
SELECT t1.startdate FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'sevelamer' AND admissions.subject_id = 46528 AND STRFTIME('%y-%m', prescriptions.startdate) = '2102-04') AS t1 JOIN (SELECT admissi...
Which rank is Hawthorn?
CREATE TABLE table_67711 ("Rank" real,"Games" real,"Player" text,"Club/Clubs" text,"Career span" text)
SELECT "Rank" FROM table_67711 WHERE "Club/Clubs" = 'hawthorn'
For each movie that received more than 3 reviews, what is the average rating. Show scatter chart.
CREATE TABLE Movie (mID int,title text,year int,director text)CREATE TABLE Reviewer (rID int,name text)CREATE TABLE Rating (rID int,mID int,stars int,ratingDate date)
SELECT mID, AVG(stars) FROM Rating GROUP BY mID
Bar chart of the number of course name from each course name
CREATE TABLE Candidates (candidate_id INTEGER,candidate_details VARCHAR(255))CREATE TABLE Student_Course_Attendance (student_id INTEGER,course_id INTEGER,date_of_attendance DATETIME)CREATE TABLE People_Addresses (person_address_id INTEGER,person_id INTEGER,address_id INTEGER,date_from DATETIME,date_to DATETIME)CREATE T...
SELECT course_name, COUNT(course_name) FROM Courses GROUP BY course_name
What is High Assists, when Date is 'March 10'?
CREATE TABLE table_46397 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "High assists" FROM table_46397 WHERE "Date" = 'march 10'
What's the HPO4 2 that has less than 89.3 as an H2PO 4 and 3.02 10 5 as the PO4 3?
CREATE TABLE table_13627 ("[A] (mol/L)" text,"[H 3 PO 4 ]/[A] (%)" text,"[H 2 PO 4 \u2212 ]/[A] (%)" real,"[HPO 4 2\u2212 ]/[A] (%)" text,"[PO 4 3\u2212 ]/[A] (%)" text)
SELECT "[HPO 4 2\u2212 ]/[A] (%)" FROM table_13627 WHERE "[H 2 PO 4 \u2212 ]/[A] (%)" < '89.3' AND "[PO 4 3\u2212 ]/[A] (%)" = '3.02×10 −5'
Which Attendance has a Home of djurg rdens if, and a Round of 53?
CREATE TABLE table_name_54 (attendance INTEGER,home VARCHAR,round VARCHAR)
SELECT MAX(attendance) FROM table_name_54 WHERE home = "djurgårdens if" AND round = 53
How many number of lakes are there in the Valdez-Cordova (CA) area?
CREATE TABLE table_17978052_2 (_number_s_lake_and_gnis_query_link INTEGER,borough_or_census_area VARCHAR)
SELECT MIN(_number_s_lake_and_gnis_query_link) FROM table_17978052_2 WHERE borough_or_census_area = "Valdez-Cordova (CA)"
What's the name of the competition in 8th position?
CREATE TABLE table_11721 ("Year" real,"Competition" text,"Venue" text,"Position" text,"Event" text)
SELECT "Competition" FROM table_11721 WHERE "Position" = '8th'
Acceptance of my answers by hour of the day.
CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Comments (Id number,PostId number,Sc...
WITH CTE AS (SELECT ROW_NUMBER() OVER (ORDER BY Id) - 1 AS N FROM Posts LIMIT 24) SELECT CTE.N, SUM(CASE WHEN Q.AcceptedAnswerId = A.Id THEN 1 ELSE 0 END) AS Acc, SUM(CASE WHEN Q.AcceptedAnswerId != A.Id THEN 1 ELSE 0 END) AS NonAcc FROM CTE LEFT JOIN Posts AS A ON TIME_TO_STR(A.CreationDate, '%h') = CTE.N LEFT JOIN Po...
What date did Footscray play and Away game?
CREATE TABLE table_name_24 (date VARCHAR,away_team VARCHAR)
SELECT date FROM table_name_24 WHERE away_team = "footscray"
What are the allergy types and how many allergies correspond to each one?
CREATE TABLE has_allergy (stuid number,allergy text)CREATE TABLE allergy_type (allergy text,allergytype text)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)
SELECT allergytype, COUNT(*) FROM allergy_type GROUP BY allergytype
among patients tested for joint fluid, how many of them had acute nephritis nec?
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.short_title = "Acute nephritis NEC" AND lab.fluid = "Joint Fluid"
Show different carriers of phones together with the number of phones with each carrier Plot them as bar chart, show by the Y-axis in desc.
CREATE TABLE phone_market (Market_ID int,Phone_ID text,Num_of_stock int)CREATE TABLE market (Market_ID int,District text,Num_of_employees int,Num_of_shops real,Ranking int)CREATE TABLE phone (Name text,Phone_ID int,Memory_in_G int,Carrier text,Price real)
SELECT Carrier, COUNT(*) FROM phone GROUP BY Carrier ORDER BY COUNT(*) DESC
What is the score when the to par was 5, for Peter Jacobsen?
CREATE TABLE table_name_9 (score INTEGER,to_par VARCHAR,player VARCHAR)
SELECT SUM(score) FROM table_name_9 WHERE to_par = "–5" AND player = "peter jacobsen"
how many short film roles has he acted in ?
CREATE TABLE table_203_710 (id number,"genre" text,"year" number,"title" text,"episode" text,"role" text,"notes" text)
SELECT COUNT(*) FROM table_203_710 WHERE "genre" = 'short film'
For what round was the opponent nikola iri du an vemi ?
CREATE TABLE table_12092 ("Edition" text,"Round" text,"Date" text,"Partnering" text,"Against" text,"Surface" text,"Opponents" text,"Result" text)
SELECT "Round" FROM table_12092 WHERE "Opponents" = 'nikola ćirić dušan vemić'
Lowest Voted Question With Highest Voted Answer.
CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE T...
SELECT Score, Id AS "post_link", Title FROM Posts WHERE (Score < -10) ORDER BY Score
What is the Against when the drawn is 5?
CREATE TABLE table_75776 ("Position" real,"Team" text,"Points" real,"Played" real,"Drawn" real,"Lost" real,"Against" real,"Difference" text)
SELECT "Against" FROM table_75776 WHERE "Drawn" = '5'
Who has a DCSF number of 3373?
CREATE TABLE table_36866 ("Name" text,"Faith" text,"Type" text,"Intake" real,"DCSF number" real,"Ofsted number" real)
SELECT "Name" FROM table_36866 WHERE "DCSF number" = '3373'
Who was the away team against the home team Sheffield United?
CREATE TABLE table_name_18 (away_team VARCHAR,home_team VARCHAR)
SELECT away_team FROM table_name_18 WHERE home_team = "sheffield united"
What is the score on october 7?
CREATE TABLE table_name_95 (score VARCHAR,date VARCHAR)
SELECT score FROM table_name_95 WHERE date = "october 7"
Who is the owner with a frequency of 0 101.1 fm?
CREATE TABLE table_5780 ("Call sign" text,"Frequency" text,"City of License" text,"Owner" text,"Format" text)
SELECT "Owner" FROM table_5780 WHERE "Frequency" = '0 101.1 fm'
Where the built as is DLG-23, what is the class?
CREATE TABLE table_name_98 (class VARCHAR,built_as VARCHAR)
SELECT class FROM table_name_98 WHERE built_as = "dlg-23"
What is Left Office, when Party is Vacant (1999-2001)?
CREATE TABLE table_76835 ("Name" text,"Took Office" text,"Left Office" text,"President" text,"Party" text)
SELECT "Left Office" FROM table_76835 WHERE "Party" = 'vacant (1999-2001)'
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of last_name and employee_id , could you show EMPLOYEE_ID in ascending order?
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 LAST_NAME, 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
which year had the top percentage in romanian population ?
CREATE TABLE table_203_355 (id number,"year" number,"total" number,"romanians" text,"hungarians" text,"roma" text)
SELECT "year" FROM table_203_355 ORDER BY "romanians" DESC LIMIT 1
How many silvers have a Nation of hungary, and a Rank larger than 10?
CREATE TABLE table_79954 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT COUNT("Silver") FROM table_79954 WHERE "Nation" = 'hungary' AND "Rank" > '10'
How many results does the California 29 voting district have?
CREATE TABLE table_18526 ("District" text,"Incumbent" text,"Party" text,"First elected" text,"Result" text,"Candidates" text)
SELECT COUNT("Result") FROM table_18526 WHERE "District" = 'California 29'
what was the last laboratory test that patient 8814 received during the first hospital visit?
CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location te...
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT labevents.itemid FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8814 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) ORDER BY labevents.charttime DES...
What time did the game start on saturday, april 20?
CREATE TABLE table_26868 ("Week" real,"Date" text,"Kickoff" text,"Opponent" text,"Final score" text,"Team record" text,"Game site" text,"Attendance" real)
SELECT "Kickoff" FROM table_26868 WHERE "Date" = 'Saturday, April 20'
What is the earliest season with more than 14 races and more than 4 podiums?
CREATE TABLE table_name_72 (season INTEGER,races VARCHAR,podiums VARCHAR)
SELECT MIN(season) FROM table_name_72 WHERE races > 14 AND podiums > 4
How much January has a Game smaller than 37, and an Opponent of detroit red wings?
CREATE TABLE table_48117 ("Game" real,"January" real,"Opponent" text,"Score" text,"Record" text)
SELECT COUNT("January") FROM table_48117 WHERE "Game" < '37' AND "Opponent" = 'detroit red wings'
What is the name of the player from Cod?
CREATE TABLE table_55289 ("Name" text,"Country" text,"Status" text,"Moving to" text,"Transfer window" text,"Transfer fee" text)
SELECT "Name" FROM table_55289 WHERE "Country" = 'cod'
Questions where several different users offered a bounty.
CREATE TABLE Comments (Id number,PostId number,Score number,Text text,CreationDate time,UserDisplayName text,UserId number,ContentLicense text)CREATE TABLE PostsWithDeleted (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,Ow...
SELECT RANK() OVER (ORDER BY COUNT(DISTINCT bs.UserId) DESC) AS Rank, COUNT(DISTINCT bs.UserId) AS "number_of_users", COUNT(bs.Id) AS "number_of_bounties", SUM(bs.BountyAmount) AS "total_amount", p.Id AS "post_link", p.Score, p.AnswerCount, p.OwnerUserId AS "user_link", p.Tags, 'site://posts/' + CAST(p.Id AS TEXT) + '/...
What is the pick # for player wes lysack?
CREATE TABLE table_21321804_1 (pick__number VARCHAR,player VARCHAR)
SELECT pick__number FROM table_21321804_1 WHERE player = "Wes Lysack"