instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What is the division with wins of 2?
CREATE TABLE table_44184 ("Season" text,"Division" text,"Wins" text,"Ties" text,"Final Position" text)
SELECT "Division" FROM table_44184 WHERE "Wins" = '2'
What classes is Dr. Gary Saxonhouse teaching for the next semester ?
CREATE TABLE semester (semester_id int,semester varchar,year int)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREAT...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Gary Saxonhouse%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.o...
What is the home team of the game on February 3?
CREATE TABLE table_55392 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text)
SELECT "Home" FROM table_55392 WHERE "Date" = 'february 3'
What season has a 6th north finish and more than 21 points?
CREATE TABLE table_12041 ("Season" text,"T/OTL" real,"Points" real,"Finish" text,"Playoffs" text)
SELECT "Season" FROM table_12041 WHERE "Points" > '21' AND "Finish" = '6th north'
What was the result of the game with a record of 2 3 2 before week 8?
CREATE TABLE table_36170 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Game site" text,"Record" text)
SELECT "Result" FROM table_36170 WHERE "Week" < '8' AND "Record" = '2–3–2'
Find date_address_from and the sum of monthly_rental , and group by attribute other_details and bin date_address_from by weekday, and visualize them by a bar chart.
CREATE TABLE Ref_Address_Types (address_type_code VARCHAR(15),address_type_description VARCHAR(80))CREATE TABLE Students_in_Detention (student_id INTEGER,detention_id INTEGER,incident_id INTEGER)CREATE TABLE Student_Addresses (student_id INTEGER,address_id INTEGER,date_address_from DATETIME,date_address_to DATETIME,mon...
SELECT date_address_from, SUM(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
How many of the cmdlets are the 2008 version?
CREATE TABLE table_14465871_2 (cmdlets VARCHAR,version VARCHAR)
SELECT COUNT(cmdlets) FROM table_14465871_2 WHERE version = "2008"
give me the number of patients whose admission type is elective and procedure long title is other operations on heart and pericardium?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.long_title = "Other operations on heart and pericardium"
What is the largest number in attendance when the record is 1-1-0?
CREATE TABLE table_71502 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text,"Attendance" real)
SELECT MAX("Attendance") FROM table_71502 WHERE "Record" = '1-1-0'
Find the number of patients who were diagnosed with transient neonatal thrombocytopenia that had a drug type of additive.
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Transient neonatal thrombocytopenia" AND prescriptions.drug_type = "ADDITIVE"
What is the name of the member with a costume Role of monster?
CREATE TABLE table_53028 ("Name" text,"Real Name" text,"Birthdate" text,"Costume Role" text,"Defining characteristics" text)
SELECT "Name" FROM table_53028 WHERE "Costume Role" = 'monster'
provide the number of patients whose year of birth is less than 2146 and procedure icd9 code is 966?
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 text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2146" AND procedures.icd9_code = "966"
Which Losses have Wins smaller than 6, and a South West DFL of sandford?
CREATE TABLE table_60865 ("South West DFL" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real)
SELECT MIN("Losses") FROM table_60865 WHERE "Wins" < '6' AND "South West DFL" = 'sandford'
Which Position has Notes of 68.76 m?
CREATE TABLE table_13840 ("Year" real,"Competition" text,"Venue" text,"Position" text,"Notes" text)
SELECT "Position" FROM table_13840 WHERE "Notes" = '68.76 m'
What is the number of attendance with the pre-season game as the type of record?
CREATE TABLE table_24367 ("Type of Record" text,"Attendance" real,"Date/Year" text,"Stadium" text,"Result/Games" text)
SELECT COUNT("Attendance") FROM table_24367 WHERE "Type of Record" = 'Pre-season game'
What is Driver, when Position is 2nd, and when Season is 2001?
CREATE TABLE table_name_77 (driver VARCHAR,position VARCHAR,season VARCHAR)
SELECT driver FROM table_name_77 WHERE position = "2nd" AND season = 2001
Name the kerry # for others# is 44
CREATE TABLE table_21576 ("County" text,"Kerry%" text,"Kerry#" real,"Bush%" text,"Bush#" real,"Others%" text,"Others#" real)
SELECT "Kerry#" FROM table_21576 WHERE "Others#" = '44'
list the AA flights from DALLAS to SAN FRANCISCO
CREATE TABLE days (days_code varchar,day_name varchar)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE code_description (code varchar,description text)CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE date_day (month_number int,day_number int,year int,da...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = ...
For all employees who have the letters D or S in their first name, visualize a scatter chart about the correlation between manager_id and department_id .
CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal...
SELECT MANAGER_ID, DEPARTMENT_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
What is the title of season 2?
CREATE TABLE table_26570 ("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_26570 WHERE "No. in season" = '2'
Which circuit did alfa romeo win?
CREATE TABLE table_name_41 (circuit VARCHAR,winning_constructor VARCHAR)
SELECT circuit FROM table_name_41 WHERE winning_constructor = "alfa romeo"
who is the grand finalist when the grand finalists are jonathan loh, peterson poon, nathan santos?
CREATE TABLE table_66529 ("Year" real,"Champion" text,"Grand Finalist" text,"Champion Team Members" text,"Grand Finalists" text)
SELECT "Grand Finalist" FROM table_66529 WHERE "Grand Finalists" = 'jonathan loh, peterson poon, nathan santos'
On what Date is Sheffield Wednesday the Home team?
CREATE TABLE table_name_61 (date VARCHAR,home_team VARCHAR)
SELECT date FROM table_name_61 WHERE home_team = "sheffield wednesday"
count the number of patients whose diagnoses short title is food/vomit pneumonitis and lab test category is blood gas?
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 demographic (subject_id text,hadm_id t...
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 = "Food/vomit pneumonitis" AND lab."CATEGORY" = "Blood Gas"
What did the away team score at the game when the home team scored 7.11 (53)?
CREATE TABLE table_56641 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Home team" FROM table_56641 WHERE "Away team score" = '7.11 (53)'
Zanjan province of Iran Stackoverflow users.
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Body text,OwnerUserId numbe...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%arak%' ORDER BY Reputation DESC
count the number of hispanic or latino patients who have diagnoses icd9 code e9429.
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND diagnoses.icd9_code = "E9429"
what were the five procedures that were the most frequent?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 <= 5)
what is date of birth and religion of subject id 14755?
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 demographic.dob, demographic.religion FROM demographic WHERE demographic.subject_id = "14755"
A bar chart about the number of faluts for different fault description recorded in the logs, and could you list names in descending order?
CREATE TABLE Skills_Required_To_Fix (part_fault_id INTEGER,skill_id INTEGER)CREATE TABLE Maintenance_Engineers (engineer_id INTEGER,company_id INTEGER,first_name VARCHAR(50),last_name VARCHAR(50),other_details VARCHAR(255))CREATE TABLE Engineer_Skills (engineer_id INTEGER,skill_id INTEGER)CREATE TABLE Fault_Log_Parts (...
SELECT fault_description, COUNT(fault_description) FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY fault_description ORDER BY fault_description DESC
How many districts have an incumbent first elected in 1940?
CREATE TABLE table_18591 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT COUNT("District") FROM table_18591 WHERE "First elected" = '1940'
What was the score when philadelphia visited?
CREATE TABLE table_53165 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text)
SELECT "Score" FROM table_53165 WHERE "Visitor" = 'philadelphia'
Display a bar chart for what are the hometowns of gymnasts and the corresponding number of gymnasts?, show Hometown from low to high order.
CREATE TABLE people (People_ID int,Name text,Age real,Height real,Hometown text)CREATE TABLE gymnast (Gymnast_ID int,Floor_Exercise_Points real,Pommel_Horse_Points real,Rings_Points real,Vault_Points real,Parallel_Bars_Points real,Horizontal_Bar_Points real,Total_Points real)
SELECT Hometown, COUNT(*) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID GROUP BY T2.Hometown ORDER BY Hometown
Return a bar chart on how many engineers did each staff contact? List both the contact staff name and number of engineers contacted.
CREATE TABLE Maintenance_Contracts (maintenance_contract_id INTEGER,maintenance_contract_company_id INTEGER,contract_start_date DATETIME,contract_end_date DATETIME,other_contract_details VARCHAR(255))CREATE TABLE Skills (skill_id INTEGER,skill_code VARCHAR(20),skill_description VARCHAR(255))CREATE TABLE Fault_Log_Parts...
SELECT staff_name, COUNT(*) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id GROUP BY T1.staff_name
how much is the cost of a procedure called proximal gastrectomy?
CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id numbe...
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'procedures_icd' AND cost.event_id IN (SELECT procedures_icd.row_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'proximal gastrectomy'))
Number/score from answers and from questions for top users (including deleted users).
CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Tags (Id numbe...
SELECT p.OwnerUserId AS "user_link", p.OwnerDisplayName, SUM(p.Score) AS "total_score", COUNT(p.Id) AS "total_posts", SUM(CASE WHEN p.PostTypeId = 1 THEN 1 ELSE 0 END) AS "total_questions", SUM(CASE WHEN p.PostTypeId = 2 THEN 1 ELSE 0 END) AS "total_answers", SUM(CASE WHEN p.PostTypeId = 1 THEN p.Score ELSE 0 END) AS "...
how many players scored more than 10 goals ?
CREATE TABLE table_204_978 (id number,"position" number,"nation" number,"number" number,"name" text,"soproni liga" number,"uefa cup" number,"hungarian cup" number,"league cup" number,"total" number)
SELECT COUNT("name") FROM table_204_978 WHERE "total" > 10
Most viewed duplicates missing the 'Possible Duplicate' bit.
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 p.Score, p.Id AS "post_link", p.ViewCount, p.OwnerUserId AS "user_link", p.CreationDate FROM Posts AS p INNER JOIN PostHistory AS h ON h.PostId = p.Id WHERE NOT p.ClosedDate IS NULL AND p.ClosedDate = h.CreationDate AND h.PostHistoryTypeId = 10 AND h.Comment = '1' AND NOT p.Body LIKE '%<strong>Possible Duplicate...
How many winning songs were there with an english title of all for love?
CREATE TABLE table_1462 ("Season" text,"Winner" text,"Winning Song" text,"Winning Song (English Title)" text,"Debut Album" text)
SELECT COUNT("Winning Song") FROM table_1462 WHERE "Winning Song (English Title)" = 'All For Love'
What is the name of the college that is from a round greater than 3 with Gillis Wilson playing?
CREATE TABLE table_38436 ("Round" real,"Pick" real,"Player" text,"Position" text,"College" text)
SELECT "College" FROM table_38436 WHERE "Round" > '3' AND "Player" = 'gillis wilson'
Which lap number had Olivier Panis as a driver?
CREATE TABLE table_52341 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Laps" FROM table_52341 WHERE "Driver" = 'olivier panis'
before the 2000 olympic games what was johanna 's fastest 200m time ?
CREATE TABLE table_204_298 (id number,"year" number,"competition" text,"venue" text,"position" text,"event" text,"notes" number)
SELECT "notes" FROM table_204_298 WHERE "year" < 2000 AND "event" = '200 m' ORDER BY "notes" LIMIT 1
count the number of patients whose admission type is urgent and days of hospital stay is greater than 1?
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 WHERE demographic.admission_type = "URGENT" AND demographic.days_stay > "1"
what was the name of the drug that was prescribed to patient 25696 within 2 days after having had a sympath nerve inject nec procedure in 03/last year?
CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate time,drug text,dose_val_rx text,dose_unit_rx ...
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 = 25696 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = ...
Name the Height metres / ft of Floors of 05.0 n/a?
CREATE TABLE table_59046 ("Name" text,"Location" text,"Years as tallest" text,"Height metres / ft" text,"Floors" text)
SELECT "Height metres / ft" FROM table_59046 WHERE "Floors" = '05.0 n/a'
Show me the trend about the sum of monthly_rental over date_address_to , and group by attribute date_address_to with a line chart.
CREATE TABLE Detention (detention_id INTEGER,detention_type_code VARCHAR(10),teacher_id INTEGER,datetime_detention_start DATETIME,datetime_detention_end DATETIME,detention_summary VARCHAR(255),other_details VARCHAR(255))CREATE TABLE Ref_Incident_Type (incident_type_code VARCHAR(10),incident_type_description VARCHAR(80)...
SELECT date_address_to, SUM(monthly_rental) FROM Student_Addresses GROUP BY date_address_to ORDER BY monthly_rental DESC
What is the number of wins when scored was less than 26, and conceded was larger than 23?
CREATE TABLE table_63817 ("Position" real,"Team" text,"Played" real,"Wins" real,"Draws" real,"Losses" real,"Scored" real,"Conceded" real,"Points" real)
SELECT SUM("Wins") FROM table_63817 WHERE "Scored" < '26' AND "Conceded" > '23'
How many main stream browsers whose market share is at least 5 exist?
CREATE TABLE browser (market_share VARCHAR)
SELECT COUNT(*) FROM browser WHERE market_share >= 5
What is the total number of rank for the country of greece?
CREATE TABLE table_name_19 (rank VARCHAR,country VARCHAR)
SELECT COUNT(rank) FROM table_name_19 WHERE country = "greece"
how many hours have passed since patient 016-18575 received a antiarrhythmics - class iv antiarrhythmic procedure for the last time during their current hospital visit?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE cost (costid number,uniquepid text,patientheal...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-18575...
What is Diego Junqueira Gabriel Trujillo-Soler's opponent's score?
CREATE TABLE table_15136 ("Outcome" text,"Date" text,"Tournament" text,"Surface" text,"Partner" text,"Opponents" text,"Score" text)
SELECT "Score" FROM table_15136 WHERE "Opponents" = 'diego junqueira gabriel trujillo-soler'
What 1953 has 2 as a 1949, and 3 as 1952?
CREATE TABLE table_40818 ("1935" text,"1936" text,"1937" text,"1938" text,"1939" text,"1940" text,"1941" text,"1943" text,"1945" text,"1946" text,"1947" text,"1948" text,"1949" text,"1950" text,"1951" text,"1952" text,"1953" text)
SELECT "1953" FROM table_40818 WHERE "1949" = '2' AND "1952" = '3'
A bar chart that computes the total number of wines with a price is bigger than 100 Next, Bin the year into the weekday interval, rank y-axis from low to high order.
CREATE TABLE grapes (ID INTEGER,Grape TEXT,Color TEXT)CREATE TABLE wine (No INTEGER,Grape TEXT,Winery TEXT,Appelation TEXT,State TEXT,Name TEXT,Year INTEGER,Price INTEGER,Score INTEGER,Cases INTEGER,Drink TEXT)CREATE TABLE appellations (No INTEGER,Appelation TEXT,County TEXT,State TEXT,Area TEXT,isAVA TEXT)
SELECT Year, COUNT(Year) FROM wine WHERE Price > 100 ORDER BY COUNT(Year)
Is 413 required in all upper level classes ?
CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,total_credit int,total_gpa float,entered_as varchar,admit_term int,predicted_graduation_semester int,degree...
SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%topic0%' OR name LIKE '%topic0%') AND department = 'EECS'
Give me a pie to show the total number from different payment method code.
CREATE TABLE Order_Items (Order_Item_ID INTEGER,Order_ID INTEGER,Product_ID INTEGER,Order_Quantity VARCHAR(288),Other_Item_Details VARCHAR(255))CREATE TABLE Invoice_Items (Invoice_Item_ID INTEGER,Invoice_ID INTEGER,Order_ID INTEGER,Order_Item_ID INTEGER,Product_ID INTEGER,Order_Quantity INTEGER,Other_Item_Details VARCH...
SELECT payment_method_code, COUNT(*) FROM Invoices GROUP BY payment_method_code
Which institution was founded in 1932?
CREATE TABLE table_27816698_2 (institution VARCHAR,founded VARCHAR)
SELECT institution FROM table_27816698_2 WHERE founded = 1932
What is the lowest Total, when Year(s) Won is '1948 , 1950 , 1951 , 1953'?
CREATE TABLE table_name_58 (total INTEGER,year_s__won VARCHAR)
SELECT MIN(total) FROM table_name_58 WHERE year_s__won = "1948 , 1950 , 1951 , 1953"
On what date was the tournament played that eneded with a winning score of +6 (74-71-70-71=286) and margin of victory of 2 strokes, and with Arnold palmer as the runner-up?
CREATE TABLE table_40791 ("Date" text,"Tournament" text,"Winning score" text,"Margin of victory" text,"Runner(s)-up" text)
SELECT "Date" FROM table_40791 WHERE "Runner(s)-up" = 'arnold palmer' AND "Margin of victory" = '2 strokes' AND "Winning score" = '+6 (74-71-70-71=286)'
For each type of store, how many of them are there. Plot them as bar chart.
CREATE TABLE store_product (Store_ID int,Product_ID int)CREATE TABLE product (product_id int,product text,dimensions text,dpi real,pages_per_minute_color real,max_page_size text,interface text)CREATE TABLE store_district (Store_ID int,District_ID int)CREATE TABLE district (District_ID int,District_name text,Headquarter...
SELECT Type, COUNT(*) FROM store GROUP BY Type
What is the torque for Model of 2.0 bitdi (cr) dpf, in 2010 ?
CREATE TABLE table_38869 ("Model" text,"Years" text,"Engine" text,"Displ." text,"Power" text,"Torque" text)
SELECT "Torque" FROM table_38869 WHERE "Model" = '2.0 bitdi (cr) dpf' AND "Years" = '2010–'
What player went to DePaul University?
CREATE TABLE table_name_80 (player VARCHAR,college VARCHAR)
SELECT player FROM table_name_80 WHERE college = "depaul"
When 19th is the position what is the highest amount of poles?
CREATE TABLE table_25273 ("Year" real,"Class" text,"Team name" text,"Bike" text,"Riders" text,"Races" text,"Wins" real,"Podiums" real,"Poles" real,"F.laps" real,"Points" real,"Pos." text)
SELECT MAX("Poles") FROM table_25273 WHERE "Pos." = '19th'
What city of license has a value of k293bg for its call sign?
CREATE TABLE table_name_82 (city_of_license VARCHAR,call_sign VARCHAR)
SELECT city_of_license FROM table_name_82 WHERE call_sign = "k293bg"
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of hire_date and the average of salary bin hire_date by time, and order mean salary in descending order please.
CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID decimal(4,0))CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME var...
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(SALARY) DESC
Bar chart x axis location code y axis how many location code, and list x-axis in asc order please.
CREATE TABLE Ref_Calendar (Calendar_Date DATETIME,Day_Number INTEGER)CREATE TABLE Employees (Employee_ID INTEGER,Role_Code CHAR(15),Employee_Name VARCHAR(255),Gender_MFU CHAR(1),Date_of_Birth DATETIME,Other_Details VARCHAR(255))CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR(15),Document_Type_Name VARCHAR(255)...
SELECT Location_Code, COUNT(Location_Code) FROM Document_Locations GROUP BY Location_Code ORDER BY Location_Code
what is the only country to have a gdp per capita of 6,324 ?
CREATE TABLE table_203_296 (id number,"country" text,"total gdp (nominal)\n(billion us$)" text,"gdp per capita\n(us$,ppp)" text,"gdp growth,\n2007-2011\n(in %)" number,"hdi" text)
SELECT "country" FROM table_203_296 WHERE "gdp per capita\n(us$, ppp)" = 6324
what was the last value of a ph lab test of patient 006-77873 in 11/last year?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,ce...
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 = '006-77873')) AND lab.labname = 'ph' AND DATETIME(lab.labresulttime, 'start of year') = ...
Which Pick # has a League from of ontario hockey league, a Nationality of united states, and a Team from of brampton battalion?
CREATE TABLE table_name_61 (pick__number VARCHAR,team_from VARCHAR,league_from VARCHAR,nationality VARCHAR)
SELECT COUNT(pick__number) FROM table_name_61 WHERE league_from = "ontario hockey league" AND nationality = "united states" AND team_from = "brampton battalion"
what is maximum days of hospital stay of patients whose primary disease is stemi?
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 MAX(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "STEMI"
Who is the usual teacher for ARTDES 301 ?
CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE semester (semester_id int,semester varchar,year int)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE student (student_id int,lastname varchar,firstname varcha...
SELECT COUNT(instructor.name), instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'ARTDES' AND course.number = 301 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = ...
When is the Monsters of Rock show with 12 bands?
CREATE TABLE table_31803 ("Year" real,"Date" text,"Event" text,"Days" text,"Stages" text,"Acts" text)
SELECT "Date" FROM table_31803 WHERE "Event" = 'monsters of rock' AND "Acts" = '12 bands'
Of all the upper-level classes , which ones have 1 credits ?
CREATE TABLE jobs (job_id int,job_title varchar,description varchar,requirement varchar,city varchar,state varchar,country varchar,zip int)CREATE TABLE semester (semester_id int,semester varchar,year int)CREATE TABLE area (course_id int,area varchar)CREATE TABLE course_offering (offering_id int,course_id int,semester i...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.credits = 1 AND program_course.category LIKE 'ULCS'
Is there a project for 489 ?
CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday varchar,wednesday varchar,thursday varchar,friday varchar,saturday varchar,sunday varchar,has_final_project varchar,has_final_exam varchar,textbook varchar,class_address varch...
SELECT DISTINCT has_projects FROM course WHERE department = 'EECS' AND number = 489
Find all comedies produced in year 2015
CREATE TABLE company (id int,name text,country_code varchar)CREATE TABLE copyright (id int,msid int,cid int)CREATE TABLE producer (pid int,gender text,name text,nationality text,birth_city text,birth_year int)CREATE TABLE cast (id int,msid int,aid int,role text)CREATE TABLE made_by (id int,msid int,pid int)CREATE TABLE...
SELECT movie.title FROM classification, genre, movie WHERE genre.genre = 'comedies' AND genre.gid = classification.gid AND movie.mid = classification.msid AND movie.release_year = 2015
what patient 011-31229's age is in their first hospital visit?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE treatment (treatmentid number,patientunitstayid numbe...
SELECT patient.age FROM patient WHERE patient.uniquepid = '011-31229' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1
did patient 010-9756 go in for a t3 lab test during this year?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime 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,ce...
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-9756')) AND lab.labname = 't3' AND DATETIME(lab.labresulttime, 'start of year') = DA...
What are the names and opening hours of the tourist attractions that can be accessed by bus or walk?
CREATE TABLE tourist_attraction_features (tourist_attraction_id number,feature_id number)CREATE TABLE shops (shop_id number,shop_details text)CREATE TABLE street_markets (market_id number,market_details text)CREATE TABLE visits (visit_id number,tourist_attraction_id number,tourist_id number,visit_date time,visit_detail...
SELECT name, opening_hours FROM tourist_attractions WHERE how_to_get_there = "bus" OR how_to_get_there = "walk"
What is the country that the player with a score of 70-69=139 from?
CREATE TABLE table_48690 ("Place" text,"Player" text,"Country" text,"Score" text,"To par" text)
SELECT "Country" FROM table_48690 WHERE "Score" = '70-69=139'
Name the lfop 5/11/09 with opinion way of 5/11/09 of 2% and lpsos 3/14/09 of 2%
CREATE TABLE table_name_23 (ifop_5_11_09 VARCHAR,opinionway_5_11_09 VARCHAR,ipsos_3_14_09 VARCHAR)
SELECT ifop_5_11_09 FROM table_name_23 WHERE opinionway_5_11_09 = "2%" AND ipsos_3_14_09 = "2%"
Who used Gordini Straight-6 in 1956?
CREATE TABLE table_name_93 (entrant VARCHAR,engine VARCHAR,year VARCHAR)
SELECT entrant FROM table_name_93 WHERE engine = "gordini straight-6" AND year = 1956
procalcitonin level >= 3 ng / ml
CREATE TABLE table_train_51 ("id" int,"active_infection" bool,"procalcitonin" int,"oliguria" bool,"receiving_vasopressor" bool,"metabolic_acidosis" bool,"colonized_with_a_multi_drug_resistant_organism" bool,"hypoperfusion" bool,"central_venous_oxygen_saturation_scvo2" int,"venous_to_arterial_co2_gap_dco2" int,"lactate"...
SELECT * FROM table_train_51 WHERE procalcitonin >= 3
Stacked bar of took office and how many took office colored by Minister, and sort Y from low to high order.
CREATE TABLE party (Party_ID int,Minister text,Took_office text,Left_office text,Region_ID int,Party_name text)CREATE TABLE party_events (Event_ID int,Event_Name text,Party_ID int,Member_in_charge_ID int)CREATE TABLE region (Region_ID int,Region_name text,Date text,Label text,Format text,Catalogue text)CREATE TABLE mem...
SELECT Took_office, COUNT(Took_office) FROM party GROUP BY Minister ORDER BY COUNT(Took_office)
What is the fixed charge for the user with a unit/time range of i-2: peak (18:30-22:30)?
CREATE TABLE table_27714 ("User" text,"Unit (kWh)/Time range" text,"Tariff (Rs. /kWh)" text,"Fixed Charge (Rs. /kWh)" text,"Fuel Adjustment Charge (% of Total Energy Charge)" text,"Max. Demand Charge (Rs. /kVA)" text)
SELECT "Fixed Charge ( Rs. /kWh)" FROM table_27714 WHERE "Unit (kWh)/Time range" = 'I-2: Peak (18:30-22:30)'
Name the state and federal when property taxes is 17,199,210
CREATE TABLE table_11608735_3 (state_ VARCHAR,_federal VARCHAR,property_taxes VARCHAR)
SELECT state_ & _federal FROM table_11608735_3 WHERE property_taxes = "17,199,210"
How many trains in each name category, give me the result with a bar chart, and could you show from low to high by the the number of name?
CREATE TABLE manager (Manager_ID int,Name text,Country text,Working_year_starts text,Age int,Level int)CREATE TABLE train (Train_ID int,Train_Num text,Name text,From text,Arrival text,Railway_ID int)CREATE TABLE railway (Railway_ID int,Railway text,Builder text,Built text,Wheels text,Location text,ObjectNumber text)CRE...
SELECT Name, COUNT(Name) FROM train GROUP BY Name ORDER BY COUNT(Name)
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 first_name and commission_pct , I want to show by the Y-axis from high to low.
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 decimal(10,0))CREATE TABLE regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE locations (LOCATION_ID decimal(4,0)...
SELECT FIRST_NAME, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY COMMISSION_PCT DESC
What episode had a run time of 24:25?
CREATE TABLE table_1579922_1 (episode VARCHAR,run_time VARCHAR)
SELECT episode FROM table_1579922_1 WHERE run_time = "24:25"
unaccepted id questions by creationdate, score.
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE PostLinks (Id number,CreationDate time,PostId number,RelatedPostId number,LinkTypeId number)CREATE TABLE PostHistoryTypes (Id number,Name text)CREAT...
SELECT p.Id, Score, Title, 'http://travel.stackexchange.com/questions/' + CAST(p.Id AS VARCHAR(10)) AS link FROM Posts AS p WHERE DeletionDate IS NULL AND ClosedDate IS NULL AND Tags LIKE '%identify%' AND AcceptedAnswerId IS NULL AND Score <= 2 AND CreationDate <= DATEADD(mm, -2, GETDATE()) ORDER BY CreationDate, Score
For a particular tag get the Avg and StDev of score - suspicious scores are likely to have * BOTH HIGH AVERAGE AND LOW STD DEV * of score (e.g. they routinely upvote each of their own posts x times). To filter out noise look for > 10 posts and high average as persistent cheaters are likely to be... persistent!. Helps f...
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 SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,C...
SELECT OwnerUserId, COUNT(Posts.Id) AS NumPosts, SUM(Posts.Score) AS SumScore, AVG(CAST(Posts.Score AS FLOAT)) AS AvgScore, STDEV(Posts.Score) AS StdDevScore, AVG(CAST(Posts.Score AS FLOAT)) - STDEV(Posts.Score) AS "avg-stdev" FROM Posts WHERE Posts.OwnerUserId IN (3123370, 3605516, 3915549, 4831567) AND PostTypeId = 2...
how many hours it has been since the last time patient 012-31752 was diagnosed with nutritional deficiency during this hospital visit?
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 intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabe...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnosis.diagnosistime)) FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-31752...
Where was the home match against FK Rudar Ugljevik played?
CREATE TABLE table_29728596_1 (location VARCHAR,away_team VARCHAR)
SELECT location FROM table_29728596_1 WHERE away_team = "FK Rudar Ugljevik"
what is admission type and procedure icd9 code of subject id 2560?
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 demographic.admission_type, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "2560"
provide the number of patients whose admission type is elective and procedure icd9 code is 4611?
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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,do...
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 = "4611"
In what year of school is the forward Iman McFarland?
CREATE TABLE table_name_90 (year VARCHAR,position VARCHAR,name VARCHAR)
SELECT year FROM table_name_90 WHERE position = "forward" AND name = "iman mcfarland"
Which elevation groundstation has a capacity in persons/hour larger than 820, and a Name or route of lager 1, and a slope length smaller than 336?
CREATE TABLE table_79055 ("Name or route" text,"type" text,"elevation groundstation" real,"elevation mountainstation" real,"slope length" real,"capacity in persons/hour" real,"construction year(s)" text)
SELECT AVG("elevation groundstation") FROM table_79055 WHERE "capacity in persons/hour" > '820' AND "Name or route" = 'lager 1' AND "slope length" < '336'
What were the Feb temperatures in East Stroudsburg?
CREATE TABLE table_name_63 (feb VARCHAR,city VARCHAR)
SELECT feb FROM table_name_63 WHERE city = "east stroudsburg"
If the track is the Wisconsin State Fair Park Speedway and the winning driver is Wally Dallenbach, what was the location?
CREATE TABLE table_2691 ("Rnd" real,"Date" text,"Race Name" text,"Length" text,"Track" text,"Location" text,"Pole Position" text,"Winning Driver" text)
SELECT "Location" FROM table_2691 WHERE "Winning Driver" = 'Wally Dallenbach' AND "Track" = 'Wisconsin State Fair Park Speedway'
what film did the actor star in after street angel ?
CREATE TABLE table_204_707 (id number,"year" number,"english title" text,"chinese title" text,"director" text,"role" text)
SELECT "english title" FROM table_204_707 WHERE id = (SELECT id FROM table_204_707 WHERE "english title" = 'street angel') + 1
List the names of aircrafts and the number of times it won matches by a bar chart, could you list in asc by the Aircraft?
CREATE TABLE aircraft (Aircraft_ID int(11),Aircraft varchar(50),Description varchar(50),Max_Gross_Weight varchar(50),Total_disk_area varchar(50),Max_disk_Loading varchar(50))CREATE TABLE match (Round real,Location text,Country text,Date text,Fastest_Qualifying text,Winning_Pilot text,Winning_Aircraft text)CREATE TABLE ...
SELECT Aircraft, COUNT(*) FROM aircraft AS T1 JOIN match AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY Aircraft
when was the last time until 4 years ago that patient 021-240586 received the procedure of external pacemaker?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE cost (costid number,uniquepid text,patientheal...
SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-240586')) AND treatment.treatmentname = 'external pacemaker' ...