instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
What is the last name of each student who is not allergic to any type of food? Count them with a bar chart, I want to rank in ascending by the bar.
CREATE TABLE Has_Allergy (StuID INTEGER,Allergy VARCHAR(20))CREATE TABLE Allergy_Type (Allergy VARCHAR(20),AllergyType VARCHAR(20))CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))
SELECT LName, COUNT(LName) FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_Allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.AllergyType = "food") GROUP BY LName ORDER BY LName
What is the average no opinion score during 1954 November that is more favorable than 35?
CREATE TABLE table_9922 ("Date" text,"Favorable" real,"No Opinion" real,"Unfavorable" real,"Net Favorable" text)
SELECT AVG("No Opinion") FROM table_9922 WHERE "Date" = '1954 november' AND "Favorable" > '35'
What was the score of the game when Maurice Williams (7) had the high assists?
CREATE TABLE table_name_8 (score VARCHAR,high_assists VARCHAR)
SELECT score FROM table_name_8 WHERE high_assists = "maurice williams (7)"
how many times was patient 49176 prescribed erythromycin on the current hospital encounter?
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 patients (row_id number,subject_id number,gender text,dob time,dod time)C...
SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 49176 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'erythromycin'
Which pens has 1 tries and matt alexander as a player with conv of 4?
CREATE TABLE table_name_38 (pens VARCHAR,conv VARCHAR,tries VARCHAR,player VARCHAR)
SELECT pens FROM table_name_38 WHERE tries = "1" AND player = "matt alexander" AND conv = "4"
What event (Extra) in 2002 did the competitor compete in and place 8th?
CREATE TABLE table_name_80 (extra VARCHAR,year VARCHAR,result VARCHAR)
SELECT extra FROM table_name_80 WHERE year = 2002 AND result = "8th"
Which team had a manager replaced by Ebrahim Talebi?
CREATE TABLE table_22297140_3 (team VARCHAR,replaced_by VARCHAR)
SELECT team FROM table_22297140_3 WHERE replaced_by = "Ebrahim Talebi"
Name the total number of rank for 348cc petty manx
CREATE TABLE table_57295 ("Rank" real,"Rider" text,"Team" text,"Speed" text,"Time" text)
SELECT COUNT("Rank") FROM table_57295 WHERE "Team" = '348cc petty manx'
How many goals did coe get?
CREATE TABLE table_name_80 (goals INTEGER,name VARCHAR)
SELECT MIN(goals) FROM table_name_80 WHERE name = "coe"
how many players are not a junior ?
CREATE TABLE table_204_526 (id number,"name" text,"#" number,"position" text,"height" text,"weight" number,"year" text,"home town" text,"high school" text)
SELECT COUNT("name") FROM table_204_526 WHERE "year" <> 'junior'
Which Round has a Player of damon jones?
CREATE TABLE table_51067 ("Round" real,"Pick" real,"Player" text,"Position" text,"College" text)
SELECT SUM("Round") FROM table_51067 WHERE "Player" = 'damon jones'
What is the nation who won 1 bronze in the Olympics during 1924 1928?
CREATE TABLE table_22355_20 (nation VARCHAR,olympics VARCHAR,bronze VARCHAR)
SELECT nation FROM table_22355_20 WHERE olympics = "1924–1928" AND bronze = 1
what year was itoh 's only victory at the 10,000 m distance .
CREATE TABLE table_203_215 (id number,"year" number,"competition" text,"venue" text,"position" text,"event" text,"notes" text)
SELECT "year" FROM table_203_215 WHERE "position" = 1 AND "event" = '10,000m'
what is the fa cup goals when total apps is 10 (4)?
CREATE TABLE table_name_12 (fa_cup_goals INTEGER,total_apps VARCHAR)
SELECT SUM(fa_cup_goals) FROM table_name_12 WHERE total_apps = "10 (4)"
In how many different cities are banks located?
CREATE TABLE loan (loan_id text,loan_type text,cust_id text,branch_id text,amount number)CREATE TABLE customer (cust_id text,cust_name text,acc_type text,acc_bal number,no_of_loans number,credit_score number,branch_id number,state text)CREATE TABLE bank (branch_id number,bname text,no_of_customers number,city text,stat...
SELECT COUNT(DISTINCT city) FROM bank
Show me a pie chart for what is total number of show times per dat for each cinema?
CREATE TABLE film (Film_ID int,Rank_in_series int,Number_in_season int,Title text,Directed_by text,Original_air_date text,Production_code text)CREATE TABLE schedule (Cinema_ID int,Film_ID int,Date text,Show_times_per_day int,Price float)CREATE TABLE cinema (Cinema_ID int,Name text,Openning_year int,Capacity int,Locatio...
SELECT Name, SUM(T1.Show_times_per_day) FROM schedule AS T1 JOIN cinema AS T2 ON T1.Cinema_ID = T2.Cinema_ID GROUP BY T1.Cinema_ID
What are the planed nuclear power plants and their located countries?
CREATE TABLE nuclear_power_plants (id text,name text,latitude text,longitude text,country text,status text,reactortype text,reactormodel text,constructionstartat text,operationalfrom text,operationalto text,capacity text,lastupdatedat text,source text)
SELECT name, country FROM nuclear_power_plants WHERE status = "Planned"
how many patients were prescribed the drug 0.9% sodium chloride within 2 months after having been diagnosed with diarrhea a year before?
CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE patients (row_id number,subject_id number,gender tex...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'diarrhea') AND DAT...
give me the number of patients whose primary disease is abdominal pain and year of death is less than or equal to 2186?
CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,sho...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL PAIN" AND demographic.dod_year <= "2186.0"
For those employees who was hired before 2002-06-21, show me about the distribution of hire_date and the average of salary bin hire_date by weekday in a bar chart, and display in descending by the Y-axis please.
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 departments (DEPARTMENT_ID decimal(4,0),DEPARTMENT_NAME varchar(30),MANAGER_ID decimal(6,0),LOCATION_ID ...
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(SALARY) DESC
What courses can I take in the Spring or Summer semester to satisfy my MDE requirement ?
CREATE TABLE area (course_id int,area varchar)CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE semester (semester_id int,semester varchar,year int)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE program_course (program_id int,course_id int,workload int,categ...
SELECT DISTINCT COURSEalias0.department, COURSEalias0.name, COURSEalias0.number, SEMESTERalias0.semester FROM (SELECT course_id FROM student_record WHERE earn_credit = 'Y' AND student_id = 1) AS DERIVED_TABLEalias0, course AS COURSEalias0, course_offering AS COURSE_OFFERINGalias0, program_course AS PROGRAM_COURSEalias0...
I want the sum of gold for silver being less than 0
CREATE TABLE table_58614 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT SUM("Gold") FROM table_58614 WHERE "Silver" < '0'
Name the opponent with round of 1 and time of n/a
CREATE TABLE table_name_37 (opponent VARCHAR,round VARCHAR,time VARCHAR)
SELECT opponent FROM table_name_37 WHERE round = "1" AND time = "n/a"
Bar graph to show meter_100 from different meter 700, list meter_100 in asc order.
CREATE TABLE record (ID int,Result text,Swimmer_ID int,Event_ID int)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 te...
SELECT meter_700, meter_100 FROM swimmer ORDER BY meter_100
What is the score of the game that resulted in a 15-9 record?
CREATE TABLE table_68603 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" text,"Record" text)
SELECT "Score" FROM table_68603 WHERE "Record" = '15-9'
Show the names of customers who have both an order in completed status and an order in part status.
CREATE TABLE customers (customer_name VARCHAR,customer_id VARCHAR)CREATE TABLE customer_orders (customer_id VARCHAR,order_status_code VARCHAR)
SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Completed' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Part'
What was the attendance for the game played at 3:31?
CREATE TABLE table_33452 ("Game" real,"Date" text,"Location" text,"Time" text,"Attendance" real)
SELECT "Attendance" FROM table_33452 WHERE "Time" = '3:31'
what were the four most frequently ordered lab tests for patients who had previously received cv cath plcmt w guidance in the same month, until 2104?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE d_items (row_id number,itemid number,label text,linksto t...
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_i...
What is Title, when TV Companions Featured is 'K-9'?
CREATE TABLE table_46142 ("Title" text,"Author" text,"ISBN UK" text,"ISBN US" text,"TV companions featured" text)
SELECT "Title" FROM table_46142 WHERE "TV companions featured" = 'k-9'
all flights from LONG BEACH to PHOENIX
CREATE TABLE airline (airline_code varchar,airline_name text,note text)CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)CREATE TABLE code_description (code varchar,description text)CREATE ...
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 = 'LONG BEACH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHO...
what were the first outputs of patient 027-62948 until 1285 days ago?
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 medication (medicationid number,patientunitstayid number,drugn...
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-62948')) AND intakeoutput.cellpath LIKE '%output%' AND D...
Which 2002 has a 2013 of 2 4?
CREATE TABLE table_name_37 (Id VARCHAR)
SELECT 2002 FROM table_name_37 WHERE 2013 = "2–4"
Number of questions including deleted ones.
CREATE TABLE TagSynonyms (Id number,SourceTagName text,TargetTagName text,CreationDate time,OwnerUserId number,AutoRenameCount number,LastAutoRename time,Score number,ApprovedByUserId number,ApprovalDate time)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE Post...
SELECT COUNT(*) FROM Posts WHERE (PostTypeId = 1)
in 2008 in track and field events how long did it take for dayron robles to run the 110 m hurdles when he broke the world record .
CREATE TABLE table_203_102 (id number,"event" text,"performance" text,"athlete" text,"nation" text,"place" text,"date" text)
SELECT "performance" FROM table_203_102 WHERE "athlete" = 'dayron robles' AND "event" = '110 m hurdles'
What is the average grid when the laps are smaller than 14 and Reine Wisell is the driver?
CREATE TABLE table_57120 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT AVG("Grid") FROM table_57120 WHERE "Laps" < '14' AND "Driver" = 'reine wisell'
Show the police force shared by counties with location on the east and west.
CREATE TABLE county_public_safety (Police_force VARCHAR,LOCATION VARCHAR)
SELECT Police_force FROM county_public_safety WHERE LOCATION = "East" INTERSECT SELECT Police_force FROM county_public_safety WHERE LOCATION = "West"
What was the away team at mcg?
CREATE TABLE table_55284 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Away team" FROM table_55284 WHERE "Venue" = 'mcg'
show me all flights from ATLANTA to SAN FRANCISCO which leave the day after tomorrow after 1700 o'clock pm
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 date_day (month_number int,...
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 ((date_day.day_number = 20 AND date_day.month_number = 1 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time...
Which Lead has a Skip of mike mcewen?
CREATE TABLE table_name_73 (lead VARCHAR,skip VARCHAR)
SELECT lead FROM table_name_73 WHERE skip = "mike mcewen"
How much 1991-1992 has a 1989-90 of 36, and an Average of 0.8250000000000001?
CREATE TABLE table_78874 ("Team" text,"Average" real,"Points" real,"Played" real,"1989-90" text,"1990-91" text,"1991-1992" real)
SELECT COUNT("1991-1992") FROM table_78874 WHERE "1989-90" = '36' AND "Average" = '0.8250000000000001'
What are the names of the different bank branches, and what are their total loan amounts. Show bar chart.
CREATE TABLE customer (cust_ID varchar(3),cust_name varchar(20),acc_type char(1),acc_bal int,no_of_loans int,credit_score int,branch_ID int,state varchar(20))CREATE TABLE loan (loan_ID varchar(3),loan_type varchar(15),cust_ID varchar(3),branch_ID varchar(3),amount int)CREATE TABLE bank (branch_ID int,bname varchar(20),...
SELECT bname, SUM(amount) FROM bank AS T1 JOIN loan AS T2 ON T1.branch_ID = T2.branch_ID GROUP BY T1.bname
Show all artist name, age, and country ordered by the yeared they joined.
CREATE TABLE exhibition_record (exhibition_id number,date text,attendance number)CREATE TABLE artist (artist_id number,name text,country text,year_join number,age number)CREATE TABLE exhibition (exhibition_id number,year number,theme text,artist_id number,ticket_price number)
SELECT name, age, country FROM artist ORDER BY year_join
how many patients whose year of death is less than or equal to 2112 and drug code is kcl40/1000d5ns?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2112.0" AND prescriptions.formulary_drug_cd = "KCL40/1000D5NS"
What is the losses average when the against is greater than 1255 and wins is 0 and the draws less than 0?
CREATE TABLE table_41897 ("Ballarat FL" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real)
SELECT AVG("Losses") FROM table_41897 WHERE "Against" > '1255' AND "Wins" = '0' AND "Draws" < '0'
what was the 'output' patient 033-3992 got today for the first time?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE patient (...
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-3992')) AND intakeoutput.cellpath LIKE '%output%' AND DA...
What is Robert Dirk's nationality?
CREATE TABLE table_2850912_3 (nationality VARCHAR,player VARCHAR)
SELECT nationality FROM table_2850912_3 WHERE player = "Robert Dirk"
tell me the admission type and diagnoses icd9 code for patient anna johnson.
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text...
SELECT demographic.admission_type, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Anna Johnson"
what is the name of the last team on this chart ?
CREATE TABLE table_204_448 (id number,"team" text,"winners" number,"runners-up" number,"years won" text,"years runner-up" text)
SELECT "team" FROM table_204_448 ORDER BY id DESC LIMIT 1
Progress towards Popular Question, Notable Question, and Famous Question.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE Votes (Id number,PostId number,VoteTypeId number,UserId number,CreationDate time,BountyAmount number)CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE Sug...
SELECT Id AS "post_link", ViewCount, CAST(CAST(CAST(ViewCount AS FLOAT) / 10 AS INT) AS TEXT(5)) + '%' AS Popular, CAST(CAST(CAST(ViewCount AS FLOAT) / 25 AS INT) AS TEXT(5)) + '%' AS Notable, CAST(CAST(CAST(ViewCount AS FLOAT) / 100 AS INT) AS TEXT(5)) + '%' AS Famous FROM Posts WHERE PostTypeId = 1 AND OwnerUserId = ...
How many games have an Attendance of 19,190?
CREATE TABLE table_name_52 (game VARCHAR,attendance VARCHAR)
SELECT COUNT(game) FROM table_name_52 WHERE attendance = 19 OFFSET 190
what is patient 018-86978's height for the first time in 08/this year?
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 patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '018-86978') AND NOT patient.admissionheight IS NULL AND DATETIME(patient.unitadmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-...
Which Result has a Venue of away, and a Game smaller than 43, and an Opponent of bournemouth?
CREATE TABLE table_62817 ("Game" real,"Date" text,"Opponent" text,"Venue" text,"Result" text,"Attendance" real)
SELECT "Result" FROM table_62817 WHERE "Venue" = 'away' AND "Game" < '43' AND "Opponent" = 'bournemouth'
What is the designation for the m.tech (e.c.e) qualification?
CREATE TABLE table_44283 ("College code" text,"Faculty name" text,"Designation" text,"Qualification" text,"Department" text,"Experience" text)
SELECT "Designation" FROM table_44283 WHERE "Qualification" = 'm.tech (e.c.e)'
what flights go from BOSTON to ATLANTA
CREATE TABLE month (month_number int,month_name text)CREATE TABLE compartment_class (compartment varchar,class_type varchar)CREATE TABLE state (state_code text,state_name text,country_name text)CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name...
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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA...
What is the lowest total points Karine Tr cy has with a less than 12 place?
CREATE TABLE table_name_84 (total_points INTEGER,artist VARCHAR,place VARCHAR)
SELECT MIN(total_points) FROM table_name_84 WHERE artist = "karine trécy" AND place < 12
What is the lowest attendance for week 11?
CREATE TABLE table_name_46 (attendance INTEGER,week VARCHAR)
SELECT MIN(attendance) FROM table_name_46 WHERE week = 11
How many is the high assist total for players from panama?
CREATE TABLE table_29743928_3 (assists INTEGER,country VARCHAR)
SELECT MAX(assists) FROM table_29743928_3 WHERE country = "Panama"
Who was the writer of the episode number in series 4?
CREATE TABLE table_16581695_2 (written_by VARCHAR,no_in_series VARCHAR)
SELECT written_by FROM table_16581695_2 WHERE no_in_series = "4"
i need a listing of flights from ST. PETERSBURG FLORIDA to TACOMA WASHINGTON leaving tomorrow and i would like to have a stopover in MILWAUKEE please
CREATE TABLE restriction (restriction_code text,advance_purchase int,stopovers text,saturday_stay_required text,minimum_stay int,maximum_stay int,application text,no_discounts text)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, date_day, days, flight, flight_stop, state AS STATE_0, state AS STATE_1 WHERE ((CITY_2.city_code = AIRPORT_SERVICE_2.cit...
When was the game at Princes Park?
CREATE TABLE table_11863 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Date" FROM table_11863 WHERE "Venue" = 'princes park'
Name the sepal width when sepal length is 6.5 and petal width is 2.2
CREATE TABLE table_10477224_1 (sepal_width VARCHAR,sepal_length VARCHAR,petal_width VARCHAR)
SELECT sepal_width FROM table_10477224_1 WHERE sepal_length = "6.5" AND petal_width = "2.2"
What are the maximum points defended when points won are smaller than 720.0?
CREATE TABLE table_3810 ("Sd" real,"Rk" real,"Player" text,"Points" real,"Points defending" real,"Points won" real,"New points" real,"Status" text)
SELECT MAX("Points defending") FROM table_3810 WHERE "Points won" < '720.0'
Worst questions that weren't deleted (yet).
CREATE TABLE SuggestedEdits (Id number,PostId number,CreationDate time,ApprovalDate time,RejectionDate time,OwnerUserId number,Comment text,Text text,Title text,Tags text,RevisionGUID other)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body...
SELECT Score, Id AS "post_link", Body FROM Posts WHERE PostTypeId = 1 AND Score < 0 ORDER BY Score LIMIT 1000
what is the name of the diagnosis of patient 59049 first was received during the previous year?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE microbiologyevents (row_id number,subject_id number,...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT diagnoses_icd.icd9_code FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 59049) AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(C...
After taking what courses can I take BA 415 ?
CREATE TABLE program_course (program_id int,course_id int,workload int,category varchar)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...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT...
What is Tie no, when Home Team is 'Hull City'?
CREATE TABLE table_61640 ("Tie no" text,"Home team" text,"Score" text,"Away team" text,"Date" text)
SELECT "Tie no" FROM table_61640 WHERE "Home team" = 'hull city'
what is the name of patient 27465's first intake on the last icu visit?
CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE 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,lin...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT inputevents_cv.itemid 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 = 27465) AND NOT icustays.outtime IS N...
Which incumbent was in the 24th district?
CREATE TABLE table_38664 ("District" text,"Incumbent" text,"Party" text,"Elected" real,"Status" text)
SELECT "Incumbent" FROM table_38664 WHERE "District" = '24th'
How many people in the crowd with Away team of geelong?
CREATE TABLE table_11052 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT COUNT("Crowd") FROM table_11052 WHERE "Away team" = 'geelong'
Percentage of the total rep of users with 'monica' substring (only active in the last 2 months).
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE ReviewRejectionReasons (Id number,Name text,Description text,PostTypeId number)CREATE TABLE Users...
WITH Raw AS (SELECT OwnerUserId AS UserId FROM Posts WHERE CreationDate > DATEADD(d, -60, CURRENT_TIMESTAMP()) AND OwnerUserId > 0 UNION SELECT UserId FROM Comments WHERE CreationDate > DATEADD(d, -60, CURRENT_TIMESTAMP()) AND UserId > 0), Raw2 AS (SELECT UserId FROM Raw GROUP BY UserId), Raw3 AS (SELECT SUM(Users.Repu...
Which company has a market value of 147.4?
CREATE TABLE table_1542 ("Rank" real,"Company" text,"Headquarters" text,"Industry" text,"Sales (billion $)" text,"Profits (billion $)" text,"Assets (billion $)" text,"Market Value (billion $)" text)
SELECT "Company" FROM table_1542 WHERE "Market Value (billion $)" = '147.4'
What is the lowest heat number for a swimmer with a time of 2:34.94?
CREATE TABLE table_66284 ("Heat" real,"Lane" real,"Name" text,"Nationality" text,"Time" text)
SELECT MIN("Heat") FROM table_66284 WHERE "Time" = '2:34.94'
Which driver had a time off course?
CREATE TABLE table_54337 ("Driver" text,"Team" text,"Laps" real,"Time/Retired" text,"Grid" text,"Points" real)
SELECT "Driver" FROM table_54337 WHERE "Time/Retired" = 'off course'
what is the cost of a drug, lisinopril 20 mg po tabs?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicm...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'lisinopril 20 mg po tabs')
How many people in the total region when there are more than 6,406 in Fitzroy, 27,017 in Livinstonge, and less than 58,382 in Rochhampton?
CREATE TABLE table_69207 ("Year" real,"Total Region" real,"Rockhampton" real,"Livingstone" real,"Fitzroy" real,"Mt Morgan" real)
SELECT COUNT("Total Region") FROM table_69207 WHERE "Fitzroy" > '6,406' AND "Livingstone" = '27,017' AND "Rockhampton" < '58,382'
what is the discharge location of Edward Castillo?
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 demographic.discharge_location FROM demographic WHERE demographic.name = "Edward Castillo"
How many episodes had 9.90 million viewers?
CREATE TABLE table_435 ("Series #" real,"Season #" real,"Episode title" text,"Writer(s)" text,"Director" text,"U.S. viewers (millions)" text,"Original air date" text)
SELECT COUNT("Episode title") FROM table_435 WHERE "U.S. viewers (millions)" = '9.90'
On what date did the match against Flavio Cipolla, played on a clay surface, occur?
CREATE TABLE table_name_58 (date VARCHAR,surface VARCHAR,opponent_in_the_final VARCHAR)
SELECT date FROM table_name_58 WHERE surface = "clay" AND opponent_in_the_final = "flavio cipolla"
this year was there any microbiology test result for patient 025-19271?
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 microlab (microlabid number,patientunitstayid number,culturesite text,orga...
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-19271')) AND DATETIME(microlab.culturetakentime, 'start of year') = DATETI...
What is the highest Markatal, when Municipality is Leirv k, and when Inhabitants Per Km is greater than 79?
CREATE TABLE table_46969 ("Municipality" text,"Population" real,"Inhabitants per km\u00b2" real,"Area (in km\u00b2)" real,"Markatal" real,"Island" text,"Region" text)
SELECT MAX("Markatal") FROM table_46969 WHERE "Municipality" = 'leirvík' AND "Inhabitants per km\u00b2" > '79'
what are the number of times france is listed on this chart ?
CREATE TABLE table_204_136 (id number,"year" number,"final" text,"semi" text)
SELECT COUNT(*) FROM table_204_136 WHERE "final" = 'france'
When was the Jamaica Classic Tournament?
CREATE TABLE table_9839 ("Date" text,"Tournament" text,"Winning score" text,"Margin of victory" text,"Runner(s)-up" text)
SELECT "Date" FROM table_9839 WHERE "Tournament" = 'the jamaica classic'
Do I need to take any classes before taking MACROMOL 536 ?
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 COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT...
What is the average total number of passengers of airports that are associated with aircraft 'Robinson R-22'?
CREATE TABLE airport_aircraft (Aircraft_ID VARCHAR,Airport_ID VARCHAR)CREATE TABLE aircraft (Aircraft_ID VARCHAR,Aircraft VARCHAR)CREATE TABLE airport (Total_Passengers INTEGER,Airport_ID VARCHAR)
SELECT AVG(T3.Total_Passengers) FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T1.Aircraft = "Robinson R-22"
What is the value in 2008 for the US Open?
CREATE TABLE table_15062 ("Tournament" text,"2007" text,"2008" text,"2009" text,"Career Win-Loss" text)
SELECT "2008" FROM table_15062 WHERE "Tournament" = 'us open'
What is the grid value which has Time/Retired value of accident?
CREATE TABLE table_name_57 (grid VARCHAR,time_retired VARCHAR)
SELECT grid FROM table_name_57 WHERE time_retired = "accident"
WHAT IS THE RESULT WITH A SCORE OF 70-73?
CREATE TABLE table_name_81 (result VARCHAR,score VARCHAR)
SELECT result FROM table_name_81 WHERE score = "70-73"
Which Game has a November of 22?
CREATE TABLE table_name_32 (game INTEGER,november VARCHAR)
SELECT SUM(game) FROM table_name_32 WHERE november = 22
What pick did George Rosso get drafted when the overall was less than 296?
CREATE TABLE table_76253 ("Round" real,"Pick" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT COUNT("Pick") FROM table_76253 WHERE "Name" = 'george rosso' AND "Overall" < '296'
Find distinct cities of address of students?
CREATE TABLE addresses (address_id number,line_1 text,line_2 text,city text,zip_postcode text,state_province_county text,country text)CREATE TABLE courses (course_id text,course_name text,course_description text,other_details text)CREATE TABLE people_addresses (person_address_id number,person_id number,address_id numbe...
SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id
Bar chart of the number of planned delivery date from each planned delivery date, display from high to low by the y-axis.
CREATE TABLE Customers (Customer_ID VARCHAR(100),Address_ID INTEGER,Customer_Name VARCHAR(255),Customer_Phone VARCHAR(255),Customer_Email_Address VARCHAR(255),Other_Details VARCHAR(255))CREATE TABLE Customer_Orders (Order_ID INTEGER,Customer_ID INTEGER,Store_ID INTEGER,Order_Date DATETIME,Planned_Delivery_Date DATETIME...
SELECT Planned_Delivery_Date, COUNT(Planned_Delivery_Date) FROM Bookings ORDER BY COUNT(Planned_Delivery_Date) DESC
What is Record, when Opponent is San Francisco Warriors?
CREATE TABLE table_45430 ("Date" text,"H/A/N" text,"Opponent" text,"Score" text,"Record" text)
SELECT "Record" FROM table_45430 WHERE "Opponent" = 'san francisco warriors'
Bar graph to show the average of product price from different product category code, and I want to display by the Y-axis in ascending.
CREATE TABLE Staff (staff_id INTEGER,gender VARCHAR(1),first_name VARCHAR(80),last_name VARCHAR(80),email_address VARCHAR(255),phone_number VARCHAR(80))CREATE TABLE Customers (customer_id INTEGER,customer_type_code VARCHAR(20),address_line_1 VARCHAR(80),address_line_2 VARCHAR(80),town_city VARCHAR(80),state VARCHAR(80)...
SELECT product_category_code, AVG(product_price) FROM Products GROUP BY product_category_code ORDER BY AVG(product_price)
What was the team's record after week 7 with 28,161 attending?
CREATE TABLE table_4854 ("Week" real,"Opponent" text,"Result" text,"Stadium" text,"Record" text,"Attenmdance" text)
SELECT "Record" FROM table_4854 WHERE "Week" > '7' AND "Attenmdance" = '28,161'
until 42 months ago, list the daily average heartrate of patient 015-67291.
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 AVG(vitalperiodic.heartrate) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-67291')) AND NOT vitalperiodic.heartrate IS NULL...
What was the title of the episode written by Julia Newton in series 48?
CREATE TABLE table_2468961_4 (title VARCHAR,written_by VARCHAR,no_in_series VARCHAR)
SELECT title FROM table_2468961_4 WHERE written_by = "Julia Newton" AND no_in_series = 48
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 bar chart shows the distribution of hire_date and the average of manager_id bin hire_date by time, and order by the Y in asc.
CREATE TABLE employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JOB_ID varchar(10),SALARY decimal(8,2),COMMISSION_PCT decimal(2,2),MANAGER_ID decimal(6,0),DEPARTMENT_ID decimal(4,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),S...
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(MANAGER_ID)
Name the opponent for 10-04-2007
CREATE TABLE table_name_46 (opponent VARCHAR,date VARCHAR)
SELECT opponent FROM table_name_46 WHERE date = "10-04-2007"
How many assists did the player who had 121 rebounds have?
CREATE TABLE table_27141 ("Player" text,"Minutes" real,"Field Goals" real,"Rebounds" real,"Assists" real,"Steals" real,"Blocks" real,"Points" real)
SELECT MAX("Assists") FROM table_27141 WHERE "Rebounds" = '121'
Count the number of patients with diagnosis icd9 code 5570 and with drug type base.
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "5570" AND prescriptions.drug_type = "BASE"