instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What campuses are in Los Angeles county?
CREATE TABLE csu_fees (campus number,year number,campusfee number)CREATE TABLE campuses (id number,campus text,location text,county text,year number)CREATE TABLE degrees (year number,campus number,degrees number)CREATE TABLE faculty (campus number,year number,faculty number)CREATE TABLE enrollments (campus number,year ...
SELECT campus FROM campuses WHERE county = "Los Angeles"
Which round has 4 clubs involved?
CREATE TABLE table_63654 ("Round" text,"Clubs remaining" real,"Clubs involved" real,"Winners from previous round" text,"New entries this round" text,"Leagues entering at this round" text)
SELECT "Round" FROM table_63654 WHERE "Clubs involved" = '4'
What is the largest 1st LBSC number with a LBSC Name of northcote?
CREATE TABLE table_name_23 (lbsc_name VARCHAR)
SELECT MAX(1 AS st_lbsc_no) FROM table_name_23 WHERE lbsc_name = "northcote"
How many patients with aortic valve insuffiency ortic valve replacement /sda as their primary disease had abnormal delta lab test results?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND lab.flag = "delta"
give me the number of patients whose admission type is urgent and procedure short title is lap periton adhesiolysis?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.short_title = "Lap periton adhesiolysis"
what is maximum age of patients whose gender is m and ethnicity is black/haitian?
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 diagnoses (subject_id text,hadm_id text,icd9_code text,sho...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.ethnicity = "BLACK/HAITIAN"
What is every value for periselene if period is 4.947432?
CREATE TABLE table_23783 ("Epoch (UTC)" text,"Periselene (km)" text,"Aposelene (km)" text,"Eccentricity" text,"Inclination (deg) (to Moon equator)" text,"Period (h)" text)
SELECT "Periselene (km)" FROM table_23783 WHERE "Period (h)" = '4.947432'
What is the area (in km2) for the village of Paquetville, with a population over 706?
CREATE TABLE table_name_89 (area_km_2 INTEGER,population VARCHAR,status VARCHAR,official_name VARCHAR)
SELECT AVG(area_km_2) FROM table_name_89 WHERE status = "village" AND official_name = "paquetville" AND population > 706
Who was team #1 on 9 September 2006?
CREATE TABLE table_73183 ("Date" text,"Team #1" text,"Res." text,"Team #2" text,"Competition" text,"Attendance" real,"Remarks" text)
SELECT "Team #1" FROM table_73183 WHERE "Date" = '9 September 2006'
Name the M809 series for short wheelbase and M939 series of M931/932
CREATE TABLE table_6013 ("Type" text,"wheelbase" text,"M39 series" text,"M809 series" text,"M939 series" text)
SELECT "M809 series" FROM table_6013 WHERE "wheelbase" = 'short' AND "M939 series" = 'm931/932'
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, a scatter chart shows the correlation between commission_pct and manager_id .
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 job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID dec...
SELECT COMMISSION_PCT, MANAGER_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
What was the attendance at Corio Oval?
CREATE TABLE table_56173 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Crowd" FROM table_56173 WHERE "Venue" = 'corio oval'
Alex Winckler wrote the film, who was the director?
CREATE TABLE table_name_35 (director_s_ VARCHAR,writer_s_ VARCHAR)
SELECT director_s_ FROM table_name_35 WHERE writer_s_ = "alex winckler"
show me the number of patients whose lab test category is chemistry and diagnoses short title is hematoma complic proc.
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 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Hematoma complic proc" AND lab."CATEGORY" = "Chemistry"
In 2007 what category won?
CREATE TABLE table_54078 ("Year" real,"Category" text,"Character" text,"For The Show" text,"Result" text)
SELECT "Category" FROM table_54078 WHERE "Result" = 'won' AND "Year" < '2007'
which township in pope county , arkansas has the least amount of water area ?
CREATE TABLE table_203_510 (id number,"township" text,"fips" number,"population\ncenter" text,"population" number,"population\ndensity\n(/mi2)" number,"population\ndensity\n(/km2)" number,"land area\n(mi2)" number,"land area\n(km2)" number,"water area\n(mi2)" number,"water area\n(km2)" number,"geographic coordinates" t...
SELECT "township" FROM table_203_510 WHERE "water area\n(mi2)" = (SELECT MIN("water area\n(mi2)") FROM table_203_510)
Which last names are both used by customers and by staff?
CREATE TABLE staff (staff_id number,staff_address_id number,nickname text,first_name text,middle_name text,last_name text,date_of_birth time,date_joined_staff time,date_left_staff time)CREATE TABLE customer_payments (customer_id number,datetime_payment time,payment_method_code text,amount_payment number)CREATE TABLE cu...
SELECT last_name FROM customers INTERSECT SELECT last_name FROM staff
Name the assists for 157 games
CREATE TABLE table_17309500_1 (assists VARCHAR,games VARCHAR)
SELECT assists FROM table_17309500_1 WHERE games = 157
WHAT IS THE YEAR WITH DARI, AND TITLE osama ( )?
CREATE TABLE table_name_38 (year__ceremony_ VARCHAR,language_s_ VARCHAR,original_title VARCHAR)
SELECT year__ceremony_ FROM table_name_38 WHERE language_s_ = "dari" AND original_title = "osama (أسامة)"
acute liver failure
CREATE TABLE table_test_29 ("id" int,"bleeding" int,"left_ventricular_ejection_fraction_lvef" int,"systolic_blood_pressure_sbp" int,"hemoglobin_a1c_hba1c" float,"heart_disease" bool,"trauma" bool,"renal_disease" bool,"creatinine_clearance_cl" float,"hemorrhagic_stroke" bool,"platelet_count" float,"surgery" bool,"thromb...
SELECT * FROM table_test_29 WHERE liver_disease = 1
List the order id, customer id for orders in Cancelled status, ordered by their order dates.
CREATE TABLE product_suppliers (product_id number,supplier_id number,date_supplied_from time,date_supplied_to time,total_amount_purchased text,total_value_purchased number)CREATE TABLE department_stores (dept_store_id number,dept_store_chain_id number,store_name text,store_address text,store_phone text,store_email text...
SELECT order_id, customer_id FROM customer_orders WHERE order_status_code = "Cancelled" ORDER BY order_date
What is the total number of Silver when Bronze was smaller than 1 with a total smaller than 2 in Bulgaria?
CREATE TABLE table_name_6 (silver VARCHAR,nation VARCHAR,bronze VARCHAR,total VARCHAR)
SELECT COUNT(silver) FROM table_name_6 WHERE bronze < 1 AND total < 2 AND nation = "bulgaria"
when did patient 19040's last intake since 680 days ago occur?
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 admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_locat...
SELECT 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 = 19040)) AND DATETIME(inputevents_cv.charttime) >= DATETIME(CURRENT_TIME(), '-680 day') ORDER...
give me the number of patients whose lab test name is glucose, csf?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Glucose, CSF"
what was the first operation time in 2105 for patient 73693?
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE microbiolog...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73693) AND STRFTIME('%y', procedures_icd.charttime) = '2105' ORDER BY procedures_icd.charttime LIMIT 1
A bar chart shows the distribution of Sex and the sum of Height , and group by attribute Sex, show in ascending by the bars.
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 ORDER BY Sex
What is the strongs transliteration of the hebrew word ?
CREATE TABLE table_1242447_1 (strongs_transliteration VARCHAR,hebrew_word VARCHAR)
SELECT strongs_transliteration FROM table_1242447_1 WHERE hebrew_word = "יוֹחָנָן"
What was the Goal Difference for Postion 22?
CREATE TABLE table_44271 ("Position" real,"Team" text,"Played" real,"Drawn" real,"Lost" real,"Goals For" real,"Goals Against" real,"Goal Difference" text,"Points 1" text)
SELECT "Goal Difference" FROM table_44271 WHERE "Position" = '22'
What is the format for the United States dated July 23, 2002?
CREATE TABLE table_name_84 (format VARCHAR,region VARCHAR,date VARCHAR)
SELECT format FROM table_name_84 WHERE region = "united states" AND date = "july 23, 2002"
how many times did imma clopes compete ?
CREATE TABLE table_204_503 (id number,"year" number,"competition" text,"venue" text,"position" text,"notes" text)
SELECT COUNT(*) FROM table_204_503
what percentile is the magnesium value of 2.1 in the same age group as patient 010-25029 in the first hospital encounter?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissio...
SELECT DISTINCT t1.c1 FROM (SELECT lab.labresult, PERCENT_RANK() OVER (ORDER BY lab.labresult) AS c1 FROM lab WHERE lab.labname = 'magnesium' AND lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age = (SELECT patient.age FROM patient WHERE patient.uniquepid = '010-25029' AND NOT pat...
What is the number of patients who had replacement of tube or enterostomy device of small intestine that had a hematology lab test category?
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 procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Replacement of tube or enterostomy device of small intestine" AND lab."CATEGORY" = "Hematology"
what were the four most common intakes this year?
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)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_typ...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT inputevents_cv.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM inputevents_cv WHERE DATETIME(inputevents_cv.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY inputevents_cv.it...
what were the names of the output that patient 43779 had first on this month/15?
CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value 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 text,l...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT outputevents.itemid FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 43779)) AND DATETIME(outputevents.charttim...
What is the census ranking for the parish with an area larger than 243.31 square km?
CREATE TABLE table_44582 ("Official Name" text,"Status" text,"Area km 2" real,"Population" real,"Census Ranking" text)
SELECT "Census Ranking" FROM table_44582 WHERE "Area km 2" > '243.31'
In how many different years was the warship that weights 1130 tons built?
CREATE TABLE table_26175 ("Warship" text,"tons (L.ton)" real,"Horse- power" real,"Speed (Knots)" text,"Armour (Inch)" text,"Main Artillery" text,"Built Year" real)
SELECT COUNT("Built Year") FROM table_26175 WHERE "tons ( L.ton )" = '1130'
Total upvotes on questions, per day.
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe text,Views number,UpVotes number,DownVotes number,ProfileImageUrl text,EmailHash text,AccountId number)CREATE T...
SELECT v.CreationDate, QuestionUpVotes = COUNT(*) FROM Votes AS v INNER JOIN Posts AS p ON p.Id = v.PostId WHERE p.PostTypeId = 1 AND v.VoteTypeId = 2 AND v.CreationDate BETWEEN @startDate AND @endDate GROUP BY v.CreationDate ORDER BY v.CreationDate
What was the school/club team whose season was in 2012 and were acquired via trade?
CREATE TABLE table_20091 ("Name" text,"Position" text,"Number" real,"School/Club Team" text,"Season" text,"Acquisition via" text)
SELECT "School/Club Team" FROM table_20091 WHERE "Season" = '2012' AND "Acquisition via" = 'Trade'
count the number of patients whose admission type is elective and procedure icd9 code is 3972?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.icd9_code = "3972"
What is the proportion of each customer's move in date? Show me the bar chart, sort X from low to high order please.
CREATE TABLE Timed_Locations_of_Things (thing_id INTEGER,Date_and_Time DATETIME,Location_Code CHAR(15))CREATE TABLE Services (service_id INTEGER,organization_id INTEGER,service_type_code CHAR(15),service_details VARCHAR(255))CREATE TABLE Customers (customer_id INTEGER,customer_details VARCHAR(255))CREATE TABLE Customer...
SELECT date_moved_in, COUNT(date_moved_in) FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id GROUP BY date_moved_in ORDER BY date_moved_in
what is the school that hosts jim goodman
CREATE TABLE table_35492 ("Round" real,"Pick" real,"Player" text,"Position" text,"School/Club Team" text)
SELECT "School/Club Team" FROM table_35492 WHERE "Player" = 'jim goodman'
All users with selected rep.
CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE Posts (Id number,...
SELECT * FROM Users WHERE Reputation >= '##Reputation:Int##' ORDER BY Reputation DESC
List the names of all the distinct product names in alphabetical order?
CREATE TABLE problem_category_codes (problem_category_code text,problem_category_description text)CREATE TABLE problem_status_codes (problem_status_code text,problem_status_description text)CREATE TABLE product (product_id number,product_name text,product_details text)CREATE TABLE problems (problem_id number,product_id...
SELECT DISTINCT product_name FROM product ORDER BY product_name
Whice race ended with a DNF?
CREATE TABLE table_name_98 (race VARCHAR,position VARCHAR)
SELECT race FROM table_name_98 WHERE position = "dnf"
Group and count the job id for all employees whose salary is smaller than any salary of those employees whose job title is MK_MAN for visualizing a bar chart, and could you rank by the y axis in ascending please?
CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STAT...
SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE SALARY < (SELECT MIN(SALARY) FROM employees WHERE JOB_ID = 'MK_MAN') GROUP BY JOB_ID ORDER BY COUNT(JOB_ID)
What is the highest number of gold medals when the silver is less than 0?
CREATE TABLE table_name_57 (gold INTEGER,silver INTEGER)
SELECT MAX(gold) FROM table_name_57 WHERE silver < 0
how much does the cost of a candidiasis of lung diagnosis cost?
CREATE TABLE diagnoses_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 t...
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'diagnoses_icd' AND cost.event_id IN (SELECT diagnoses_icd.row_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'candidiasis of lung'))
What is the normal temperature of Abbotsford, British Columbia?
CREATE TABLE table_14388 ("City" text,"Highest temperature recorded or forecast" text,"Date achieved or projected" text,"Normal temperature" text,"Deviation from normal" text)
SELECT "Normal temperature" FROM table_14388 WHERE "City" = 'abbotsford, british columbia'
how many patients of hispanic or latino ethnicity are diagnosed with drug induced delirium?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethnicity text,expire_flag...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND diagnoses.long_title = "Drug-induced delirium"
how many days has it been since patient 25733 was last tested for bicarbonate during the current hospital visit?
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 outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE patients (row_...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'bicarbonate') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25733 AND admissi...
data% tag answer count (2014 - today).
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate t...
SELECT t.TagName, SUM(q.AnswerCount) AS answCnt FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id INNER JOIN Users AS ua ON ua.Id = a.OwnerUserId INNER JOIN PostTags AS pt ON pt.PostId = q.Id INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE q.Id != a.Id AND q.OwnerUserId != a.OwnerUserId AND q.CreationDat...
Show me about the distribution of date_address_to and the amount of date_address_to , and group by attribute other_details and bin date_address_to by weekday in a bar chart.
CREATE TABLE Assessment_Notes (notes_id INTEGER,student_id INTEGER,teacher_id INTEGER,date_of_notes DATETIME,text_of_notes VARCHAR(255),other_details VARCHAR(255))CREATE TABLE Teachers (teacher_id INTEGER,address_id INTEGER,first_name VARCHAR(80),middle_name VARCHAR(80),last_name VARCHAR(80),gender VARCHAR(1),cell_mobi...
SELECT date_address_to, COUNT(date_address_to) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
When his record was 15 1 1 (1) where did he fight?
CREATE TABLE table_48835 ("Res." text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Time" text,"Location" text)
SELECT "Location" FROM table_48835 WHERE "Record" = '15–1–1 (1)'
Give the number of patients aged below 83 years who had the drug code fent100t?
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 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "83" AND prescriptions.formulary_drug_cd = "FENT100T"
show me all the available flights from BALTIMORE to DALLAS with economy fares
CREATE TABLE aircraft (aircraft_code varchar,aircraft_description varchar,manufacturer varchar,basic_type varchar,engines int,propulsion varchar,wide_body varchar,wing_span int,length int,weight int,capacity int,pay_load int,cruising_speed int,range_miles int,pressurized varchar)CREATE TABLE food_service (meal_code tex...
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, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND fare_basis.economy = 'YES' AND fare.fare_basis...
What is the team 2 for team 1 of Valletta?
CREATE TABLE table_55526 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text)
SELECT "Team 2" FROM table_55526 WHERE "Team 1" = 'valletta'
What is the population estimate for the place that gad a 18496 million euro gdp?
CREATE TABLE table_16241 ("Province" text,"Population (2004 estimate)" real,"Area (km\u00b2)" real,"Density" text,"GDP (2003,PPS in mil. \u20ac)" real,"GDP per cap. (2003,in \u20ac)" real)
SELECT "Population (2004 estimate)" FROM table_16241 WHERE "GDP (2003, PPS in mil. \u20ac )" = '18496'
Name the maximum leagure for 0 scottish cup
CREATE TABLE table_1723 ("Player" text,"League" real,"Scottish Cup" real,"League Cup" real,"Challenge Cup" real,"Total" real)
SELECT MAX("League") FROM table_1723 WHERE "Scottish Cup" = '0'
What are the total number of credits offered by each department.
CREATE TABLE STUDENT (STU_NUM int,STU_LNAME varchar(15),STU_FNAME varchar(15),STU_INIT varchar(1),STU_DOB datetime,STU_HRS int,STU_CLASS varchar(2),STU_GPA float(8),STU_TRANSFER numeric,DEPT_CODE varchar(18),STU_PHONE varchar(4),PROF_NUM int)CREATE TABLE CLASS (CLASS_CODE varchar(5),CRS_CODE varchar(10),CLASS_SECTION v...
SELECT DEPT_CODE, SUM(T1.CRS_CREDIT) FROM COURSE AS T1 JOIN CLASS AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY T1.DEPT_CODE
What is the earliest year for Alabama with a pick under 26?
CREATE TABLE table_name_78 (year INTEGER,college VARCHAR,pick VARCHAR)
SELECT MIN(year) FROM table_name_78 WHERE college = "alabama" AND pick < 26
What was the date when the record was 1-0?
CREATE TABLE table_23870 ("Game" real,"Date" text,"Opponent" text,"Result" text,"Tar Heels points" real,"Opponents" real,"Record" text)
SELECT "Date" FROM table_23870 WHERE "Record" = '1-0'
What is the average FAC/LC apps with a CL G greater than 0, less than 33 PL apps, a FAC/LC G of 0, and less than 2 FA YC?
CREATE TABLE table_name_46 (fac___lc_apps INTEGER,fa_yc VARCHAR,fac___lc_g VARCHAR,cl_g VARCHAR,pl_apps VARCHAR)
SELECT AVG(fac___lc_apps) FROM table_name_46 WHERE cl_g > 0 AND pl_apps < 33 AND fac___lc_g = 0 AND fa_yc < 2
If the rings number is 60.000, what is the number for the vault?
CREATE TABLE table_18662026_1 (vault VARCHAR,rings VARCHAR)
SELECT COUNT(vault) FROM table_18662026_1 WHERE rings = "60.000"
What was album of the year after 2009?
CREATE TABLE table_14417 ("Year" real,"Award" text,"Category" text,"Nominated Work" text,"Result" text)
SELECT "Result" FROM table_14417 WHERE "Year" > '2009' AND "Category" = 'album of the year'
When Platense was the away team on 16 August 2008 how many people attended the game?
CREATE TABLE table_name_29 (attendance VARCHAR,date VARCHAR,away VARCHAR)
SELECT attendance FROM table_name_29 WHERE date = "16 august 2008" AND away = "platense"
What is the place of the player from Spain?
CREATE TABLE table_name_64 (place VARCHAR,country VARCHAR)
SELECT place FROM table_name_64 WHERE country = "spain"
What is the total number of bronzes with totals under 4 and ranks of 10?
CREATE TABLE table_9504 ("Rank" text,"Nation" text,"Gold" text,"Silver" text,"Bronze" real,"Total" real)
SELECT COUNT("Bronze") FROM table_9504 WHERE "Total" < '4' AND "Rank" = '10'
How many attended on may 6?
CREATE TABLE table_name_85 (attendance VARCHAR,date VARCHAR)
SELECT COUNT(attendance) FROM table_name_85 WHERE date = "may 6"
When 380 g/mi (236 g/km) is the dirty electric grid rocky mountains (denver) what is the u.s national average electric mix?
CREATE TABLE table_27012 ("Vehicle" text,"Operating mode" text,"EPA rated All-electric range" text,"EPA rated combined fuel economy" text,"Clean electric grid California (San Francisco)" text,"U.S. national average electric mix" text,"Dirty electric grid Rocky Mountains (Denver)" text)
SELECT "U.S. national average electric mix" FROM table_27012 WHERE "Dirty electric grid Rocky Mountains (Denver)" = '380 g/mi (236 g/km)'
What is the name of the game that has been played the most?
CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE video_games (gameid number,gname text,gtype text)CREATE TABLE sportsinfo (stuid number,sportname text,hoursperweek number,gamesplayed number,onscholarship text)CREATE TABLE plays_games (s...
SELECT gname FROM plays_games AS T1 JOIN video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid ORDER BY SUM(hours_played) DESC LIMIT 1
Show the locations shared by shops with open year later than 2012 and shops with open year before 2008.
CREATE TABLE device (device_id number,device text,carrier text,package_version text,applications text,software_platform text)CREATE TABLE shop (shop_id number,shop_name text,location text,open_date text,open_year number)CREATE TABLE stock (shop_id number,device_id number,quantity number)
SELECT location FROM shop WHERE open_year > 2012 INTERSECT SELECT location FROM shop WHERE open_year < 2008
Show the authors of their total submissions with a bar chart, and display by the x axis in asc.
CREATE TABLE Acceptance (Submission_ID int,Workshop_ID int,Result text)CREATE TABLE submission (Submission_ID int,Scores real,Author text,College text)CREATE TABLE workshop (Workshop_ID int,Date text,Venue text,Name text)
SELECT Author, COUNT(Author) FROM submission GROUP BY Author ORDER BY Author
What type of car does Jeff Fuller drive?
CREATE TABLE table_24634 ("Team" text,"Car(s)" text,"#" real,"Driver(s)" text,"Primary Sponsor(s)" text,"Listed Owner(s)" text,"Crew Chief" text)
SELECT "Car(s)" FROM table_24634 WHERE "Driver(s)" = 'Jeff Fuller'
Which Home has an Opponent of br ndby?
CREATE TABLE table_6712 ("Season" text,"Competition" text,"Round" text,"Opponent" text,"Home" text,"Away" text,"Agg." text)
SELECT "Home" FROM table_6712 WHERE "Opponent" = 'brøndby'
Where did the home team score 14.13 (97)?
CREATE TABLE table_10537 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Venue" FROM table_10537 WHERE "Home team score" = '14.13 (97)'
Tell me the average gold for moldova and bronze less than 1
CREATE TABLE table_51649 ("Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT AVG("Gold") FROM table_51649 WHERE "Nation" = 'moldova' AND "Bronze" < '1'
when did patient 10425 first had the jackson pratt #2 output until 12/30/2105?
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 admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,disch...
SELECT outputevents.charttime FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10425)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'jack...
Count those days and in which zip code was the min dew point lower than any day in zip code 94107 using a bar graph, could you order X in desc order?
CREATE TABLE trip (id INTEGER,duration INTEGER,start_date TEXT,start_station_name TEXT,start_station_id INTEGER,end_date TEXT,end_station_name TEXT,end_station_id INTEGER,bike_id INTEGER,subscription_type TEXT,zip_code INTEGER)CREATE TABLE weather (date TEXT,max_temperature_f INTEGER,mean_temperature_f INTEGER,min_temp...
SELECT date, COUNT(date) FROM weather WHERE min_dew_point_f < (SELECT MIN(min_dew_point_f) FROM weather WHERE zip_code = 94107) GROUP BY date ORDER BY date DESC
Average votes for all popular tags.
CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Tags text,Ans...
SELECT TagName, CNT, Score FROM (SELECT TagName, COUNT(*) AS CNT, AVG(CAST(Score AS FLOAT)) AS Score FROM (SELECT p.Id, T.TagName, p.Score FROM Posts AS p INNER JOIN PostTags AS pt ON pt.PostId = p.Id INNER JOIN Tags AS t ON t.Id = pt.TagId) AS t1 GROUP BY TagName) AS t2 WHERE CNT > 30000 ORDER BY Score DESC
what is the name of the drug patient 60180 was prescribed within 2 days after having received a inj/inf platelet inhibit procedure in 09/2104.
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 diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE labevents (row_id number,...
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 = 60180 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = ...
What is the average number of gold medals won by Brazil for entries with more than 1 bronze medal but a total smaller than 4?
CREATE TABLE table_58831 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT AVG("Gold") FROM table_58831 WHERE "Total" < '4' AND "Nation" = 'brazil' AND "Bronze" > '1'
For those employees who did not have any job in the past, draw a bar chart about the distribution of job_id and the average of manager_id , and group by attribute job_id, rank by the bar in ascending.
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 employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME...
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID
how many patients whose primary disease is coronary artery disease\coronary artery bypass graft; myomectomy/sda and days of hospital stay is greater than 0?
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 WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT; MYOMECTOMY/SDA" AND demographic.days_stay > "0"
What was the score of the game on October 20 with a decision of Lundqvist?
CREATE TABLE table_name_42 (score VARCHAR,decision VARCHAR,october VARCHAR)
SELECT score FROM table_name_42 WHERE decision = "lundqvist" AND october = "20"
What music is in the film before 1963?
CREATE TABLE table_name_53 (music VARCHAR,year INTEGER)
SELECT music FROM table_name_53 WHERE year < 1963
What is Date, when Catalog is EPC 81436?
CREATE TABLE table_48240 ("Region" text,"Date" text,"Label" text,"Format" text,"Catalog" text)
SELECT "Date" FROM table_48240 WHERE "Catalog" = 'epc 81436'
diastolic blood pressure between 65 and 100 mm hg
CREATE TABLE table_train_274 ("id" int,"gender" string,"serum_bicarbonate" int,"randomization_bg" int,"positive_serum" bool,"diabetic_ketoacidosis" bool,"urinary_ketones" bool,"diastolic_blood_pressure_dbp" int,"heart_rate" int,"body_mass_index_bmi" float,"age" float,"NOUSE" float)
SELECT * FROM table_train_274 WHERE diastolic_blood_pressure_dbp >= 65 AND diastolic_blood_pressure_dbp <= 100
Show how many rank from each rank
CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))CREATE TABLE Faculty_Participates_in (FacID INTEGER,actid INTEGER)CREATE TABLE Participates_in (stuid INTEGER,actid INTEGER)CREATE TABLE Activity (actid INTEGER,activity_...
SELECT Rank, COUNT(Rank) FROM Faculty GROUP BY Rank
how many of timberline lodge 's lifts were installed after 2000 ?
CREATE TABLE table_204_907 (id number,"lift name" text,"type" text,"top\nelevation\n(ft)" number,"bottom\nelevation" number,"vertical\nrise" number,"length\n(ft)" number,"slope\n(%)" text,"capacity\n(rides/hr)" number,"speed\n(ft/min)" number,"lift\nmanufacturer" text,"year\ninstalled" number)
SELECT COUNT("lift name") FROM table_204_907 WHERE "year\ninstalled" > 2000
i would like to know the flights from DENVER to PITTSBURGH leaving on monday
CREATE TABLE code_description (code varchar,description text)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time int,connections int,departure_time int,dual_carrier text,flight_days text,flight_id int,flight_number int,from_airport varchar,meal_code text,stops int,time...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND date_day.day_number = 21 AND date_day.month_number = 2 AN...
morning flight from ATLANTA to PHILADELPHIA
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 class_of_service...
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 = 'PHILA...
when was the last time when patient 25965 was prescribed syringe (chemo) and chlorhexidine gluconate 0.12% oral rinse at the same time until 08/2105?
CREATE TABLE icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid number,intime time,outtime time)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount...
SELECT t1.startdate FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'syringe (chemo)' AND admissions.subject_id = 25965 AND STRFTIME('%y-%m', prescriptions.startdate) <= '2105-08') AS t1 JOIN (SELECT ...
what was the number of patients who had a cholesterol, ldl, calculated lab test until 2100?
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 icustays (row_id number,subject_id number,hadm_id number,icustay_id number,first_careunit text,last_careunit text,first_wardid number,last_wardid nu...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'cholesterol, ldl, calculated') AND STRFTIME('%y', labevents.charttime) <= '2100')
how many times have the endosc remove bile stone procedure been performed since 3 years ago?
CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE procedures_icd (row_id number,subject_i...
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 = 'endosc remove bile stone') AND DATETIME(procedures_icd.charttime) >= DATETIME(CURRENT_TIME(), '-3 year')
How films are produced by each studio?
CREATE TABLE market (market_id number,country text,number_cities number)CREATE TABLE film (film_id number,title text,studio text,director text,gross_in_dollar number)CREATE TABLE film_market_estimation (estimation_id number,low_estimate number,high_estimate number,film_id number,type text,market_id number,year number)
SELECT studio, COUNT(*) FROM film GROUP BY studio
when is the first time patient 007-2001 had a minimum of rdw in 01/last year?
CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,l...
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-2001')) AND lab.labname = 'rdw' AND DATETIME(lab.labresulttime, 'start of year'...
What upper level ENSCEN classes are available Fall semester ?
CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE jobs (job_id int,job_title varchar,description varchar,r...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ENSCEN' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Fall...
what is the maximum round for gt3 winner hector lester tim mullen and pole position of jonny cocker paul drayson
CREATE TABLE table_17968 ("Round" real,"Circuit" text,"Date" text,"Length" text,"Pole Position" text,"GT3 Winner" text,"GTC Winner" text)
SELECT MAX("Round") FROM table_17968 WHERE "GT3 Winner" = 'Hector Lester Tim Mullen' AND "Pole Position" = 'Jonny Cocker Paul Drayson'
What team(s) did they play on april 23?
CREATE TABLE table_1624 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text)
SELECT "Team" FROM table_1624 WHERE "Date" = 'April 23'
impaired renal function , defined as serum creatinine >= 125 umol / l ( >= 1.4 mg / dl ) for male and >= 110 umol / l ( >= 1.24 mg / dl ) for female
CREATE TABLE table_dev_55 ("id" int,"gender" string,"serum_potassium_abnormality" float,"hemoglobin_a1c_hba1c" float,"body_weight" float,"renal_disease" bool,"serum_creatinine" float,"body_mass_index_bmi" float,"NOUSE" float)
SELECT * FROM table_dev_55 WHERE renal_disease = 1 OR ((serum_creatinine >= 1.4 AND gender = 'male') OR (serum_creatinine >= 1.24 AND gender = 'female'))