instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
how many days has it been since patient 83182 alendronate sodium was first prescribed in the current hospital encounter?
CREATE TABLE d_labitems (row_id number,itemid number,label 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 number,intime time,outtime time)CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', prescriptions.startdate)) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83182 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'alendronate sodium' ORDER BY prescriptions.st...
Which opponent has a Date of july 27?
CREATE TABLE table_67057 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text)
SELECT "Opponent" FROM table_67057 WHERE "Date" = 'july 27'
Name the most pos for west bromwich albion club
CREATE TABLE table_226619_12 (pos INTEGER,club VARCHAR)
SELECT MAX(pos) FROM table_226619_12 WHERE club = "West Bromwich Albion"
What is the largest number for tropical Lows for the 1990 91 season with more than 10 tropical cyclones?
CREATE TABLE table_name_13 (tropical_lows INTEGER,season VARCHAR,tropical_cyclones VARCHAR)
SELECT MAX(tropical_lows) FROM table_name_13 WHERE season = "1990–91" AND tropical_cyclones > 10
Name the english name for
CREATE TABLE table_23568 ("English Name" text,"Simplified" text,"Traditional" text,"Pinyin" text,"Foochow" text,"Area" real,"Population" real,"Density" real)
SELECT "English Name" FROM table_23568 WHERE "Traditional" = '福鼎市'
What is the location/attendance with a 26-11 record?
CREATE TABLE table_name_95 (location_attendance VARCHAR,record VARCHAR)
SELECT location_attendance FROM table_name_95 WHERE record = "26-11"
What team has 33 starts?
CREATE TABLE table_71264 ("Year" real,"Manufacturer" text,"Start" text,"Finish" text,"Team" text)
SELECT "Team" FROM table_71264 WHERE "Start" = '33'
what is the ingesting method of nicotine lozenge?
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 DISTINCT prescriptions.route FROM prescriptions WHERE prescriptions.drug = 'nicotine lozenge'
ground transportation MINNEAPOLIS
CREATE TABLE city (city_code varchar,city_name varchar,state_code varchar,country_name varchar,time_zone_code varchar)CREATE TABLE food_service (meal_code text,meal_number int,compartment text,meal_description varchar)CREATE TABLE date_day (month_number int,day_number int,year int,day_name varchar)CREATE TABLE flight_s...
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'MINNEAPOLIS' AND ground_service.city_code = city.city_code
What is overall rank when viewers are at 6.59 million?
CREATE TABLE table_20522228_2 (rank__overall_ VARCHAR,viewers__millions_ VARCHAR)
SELECT rank__overall_ FROM table_20522228_2 WHERE viewers__millions_ = "6.59"
What is the highest heat of the athlete from spain with a lane less than 7?
CREATE TABLE table_63041 ("Heat" real,"Lane" real,"Name" text,"Nationality" text,"Time" text)
SELECT MAX("Heat") FROM table_63041 WHERE "Nationality" = 'spain' AND "Lane" < '7'
What's the Sanskrit word for month with Thai name ?
CREATE TABLE table_2243 ("English name" text,"Thai name" text,"Abbr." text,"Transcription" text,"Sanskrit word" text,"Zodiac sign" text)
SELECT "Sanskrit word" FROM table_2243 WHERE "Thai name" = 'มกราคม'
What is the total number of 3rd place finishes for racers with 0 titles?
CREATE TABLE table_name_31 (titles INTEGER)
SELECT SUM(3 AS rd_pl) FROM table_name_31 WHERE titles < 0
From the total number of patients treated with acetylcysteine 20%, calculate the number of those who had a hospital stay of more than 8 days
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE diagnoses (subject_id text,hadm_id tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "8" AND prescriptions.drug = "Acetylcysteine 20%"
What is the sum of numbers that had a type of Driving Van Trailer?
CREATE TABLE table_40899 ("Class" text,"Type" text,"Built" text,"Number" real,"Withdrawn" real)
SELECT SUM("Number") FROM table_40899 WHERE "Type" = 'driving van trailer'
Which Year started is the lowest one that has a Number of cars larger than 7, and a Car # of 100?
CREATE TABLE table_name_30 (year_started INTEGER,number_of_cars VARCHAR,car__number VARCHAR)
SELECT MIN(year_started) FROM table_name_30 WHERE number_of_cars > 7 AND car__number = "100"
What activities does Clear Channel Entertainment Facilitation Limited engage in?
CREATE TABLE table_1756264_2 (description_of_activities VARCHAR,company_name VARCHAR)
SELECT description_of_activities FROM table_1756264_2 WHERE company_name = "CLEAR CHANNEL ENTERTAINMENT FACILITATION LIMITED"
What is the province where the soccer statium is terrain #2 of complexe sportif claude-robillard?
CREATE TABLE table_29454 ("University" text,"Varsity Name" text,"City" text,"Province" text,"Founded" real,"Soccer Stadium" text,"Stadium Capacity" real)
SELECT "Province" FROM table_29454 WHERE "Soccer Stadium" = 'terrain #2 of Complexe sportif Claude-Robillard'
What date was the winner the new york jets and a Result of 30 28?
CREATE TABLE table_name_67 (date VARCHAR,winner VARCHAR,result VARCHAR)
SELECT date FROM table_name_67 WHERE winner = "new york jets" AND result = "30–28"
Give me the comparison about the average of meter_100 over the Nationality , and group by attribute Nationality by a bar chart, display in asc by the Nationality.
CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE swimmer (ID int,name text,Nationality text,meter_100 real,meter_200 text,meter_300 text,meter_400 text,meter_500 text,meter_600 text,meter_700 text,Time text)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Ev...
SELECT Nationality, AVG(meter_100) FROM swimmer GROUP BY Nationality ORDER BY Nationality
Find the total student enrollment for different affiliation type schools Plot them as bar chart, display by the sum enrollment from low to high.
CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Percent int,All_Home text,All_Road text,All_Neutral text)CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,En...
SELECT Affiliation, SUM(Enrollment) FROM university GROUP BY Affiliation ORDER BY SUM(Enrollment)
Show the county name and population of all counties.
CREATE TABLE election (election_id number,counties_represented text,district number,delegate text,party number,first_elected number,committee text)CREATE TABLE party (party_id number,year number,party text,governor text,lieutenant_governor text,comptroller text,attorney_general text,us_senate text)CREATE TABLE county (...
SELECT county_name, population FROM county
What is re-elected Incumbent Jerry Costello's First elected date?
CREATE TABLE table_78701 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Results" text)
SELECT MIN("First elected") FROM table_78701 WHERE "Results" = 're-elected' AND "Incumbent" = 'jerry costello'
Find the names of customers who have bought by at least three distinct products.
CREATE TABLE order_items (order_item_id number,order_id number,product_id number)CREATE TABLE department_store_chain (dept_store_chain_id number,dept_store_chain_name text)CREATE TABLE suppliers (supplier_id number,supplier_name text,supplier_phone text)CREATE TABLE supplier_addresses (supplier_id number,address_id num...
SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_id HAVING COUNT(DISTINCT T3.product_id) >= 3
Name the least podiums for 9th position
CREATE TABLE table_27632 ("Season" real,"Series" text,"Team" text,"Races" real,"Wins" real,"Poles" real,"F/Laps" real,"Podiums" real,"Points" real,"Position" text)
SELECT MIN("Podiums") FROM table_27632 WHERE "Position" = '9th'
What is the total number of every ship type by categorizing by nationality?, and could you sort in desc by the the number of type please?
CREATE TABLE ship (Ship_ID int,Name text,Type text,Nationality text,Tonnage int)CREATE TABLE mission (Mission_ID int,Ship_ID int,Code text,Launched_Year int,Location text,Speed_knots int,Fate text)
SELECT Type, COUNT(Type) FROM ship GROUP BY Nationality, Type ORDER BY COUNT(Type) DESC
please give me a list of flights leaving BOSTON going to PITTSBURGH
CREATE TABLE equipment_sequence (aircraft_code_sequence varchar,aircraft_code varchar)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE compartment_class (compartment varchar,class_type varchar)CREATE TABLE...
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 = 'PITTSBU...
What is the Date when the result is *non-conference game. #rankings from ap poll .?
CREATE TABLE table_77126 ("Date" text,"Opponent#" text,"Site" text,"Result" text,"Attendance" text)
SELECT "Date" FROM table_77126 WHERE "Result" = '*non-conference game. #rankings from ap poll .'
What is the highest price of product, grouped by product type? Show a bar chart, and order names from low to high order.
CREATE TABLE Staff (staff_id INTEGER,staff_gender VARCHAR(1),staff_name VARCHAR(80))CREATE TABLE Order_Items (order_item_id INTEGER,order_id INTEGER,product_id INTEGER)CREATE TABLE Customer_Orders (order_id INTEGER,customer_id INTEGER,order_status_code VARCHAR(10),order_date DATETIME)CREATE TABLE Addresses (address_id ...
SELECT product_type_code, MAX(product_price) FROM Products GROUP BY product_type_code ORDER BY product_type_code
the model 2 and the model 2e have what type of cpu ?
CREATE TABLE table_204_451 (id number,"component" text,"model 01" text,"model 01+" text,"model 02" text,"model e2" text,"model 2+ (pre-production)" text,"model 03 (china copy)" text)
SELECT "model 02" FROM table_204_451 WHERE "component" = 'cpu'
What is the Home with a Visitor of chicago, and a Series with 3 2?
CREATE TABLE table_name_82 (home VARCHAR,visitor VARCHAR,series VARCHAR)
SELECT home FROM table_name_82 WHERE visitor = "chicago" AND series = "3 – 2"
What was the number of Personal Staff Units Killed?
CREATE TABLE table_56583 ("Unit" text,"Complement" text,"Killed" text,"Wounded" text,"Missing" text)
SELECT "Killed" FROM table_56583 WHERE "Unit" = 'personal staff'
Plot a scatter chart, low estimate by high_estimate.
CREATE TABLE film (Film_ID int,Title text,Studio text,Director text,Gross_in_dollar int)CREATE TABLE film_market_estimation (Estimation_ID int,Low_Estimate real,High_Estimate real,Film_ID int,Type text,Market_ID int,Year int)CREATE TABLE market (Market_ID int,Country text,Number_cities int)
SELECT Low_Estimate, High_Estimate FROM film_market_estimation
For those records from the products and each product's manufacturer, a bar chart shows the distribution of name and code , and group by attribute headquarter, and could you sort in desc by the Name?
CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Name DESC
What college, junior, or club team did defence player Rory Fitzpatrick play for?
CREATE TABLE table_37712 ("Round" real,"Player" text,"Position" text,"Nationality" text,"College/Junior/Club Team" text)
SELECT "College/Junior/Club Team" FROM table_37712 WHERE "Position" = 'defence' AND "Player" = 'rory fitzpatrick'
is there an afternoon flight from CHARLOTTE to MINNEAPOLIS around 2pm
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 dual_carrier (main_airline ...
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 (((flight.departure_time <= 1430 AND flight.departure_time >= 1330) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MINNEAPOLIS' AND f...
Which attribute definitions have attribute value 0? Give me the attribute name and attribute ID.
CREATE TABLE attribute_definitions (attribute_id number,attribute_name text,attribute_data_type text)CREATE TABLE catalogs (catalog_id number,catalog_name text,catalog_publisher text,date_of_publication time,date_of_latest_revision time)CREATE TABLE catalog_contents_additional_attributes (catalog_entry_id number,catalo...
SELECT t1.attribute_name, t1.attribute_id FROM attribute_definitions AS t1 JOIN catalog_contents_additional_attributes AS t2 ON t1.attribute_id = t2.attribute_id WHERE t2.attribute_value = 0
how many days has it been since patient 016-9636 first received an intake of ns on the current icu visit?
CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE lab (labid number,patientunitstayid number,labna...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid =...
what is the difference in attendance between the game on july 7th and the game on july 8th ?
CREATE TABLE table_204_147 (id number,"#" number,"date" text,"opponent" text,"score" text,"win" text,"loss" text,"save" text,"attendance" number,"record" text)
SELECT ABS((SELECT "attendance" FROM table_204_147 WHERE "date" = 'july 7') - (SELECT "attendance" FROM table_204_147 WHERE "date" = 'july 8'))
Show the trend about the average of the number of attendance at home games change over the years, bin year into year interval, sort x axis from high to low order.
CREATE TABLE player_college (player_id TEXT,college_id TEXT,year INTEGER)CREATE TABLE batting (player_id TEXT,year INTEGER,stint INTEGER,team_id TEXT,league_id TEXT,g INTEGER,ab NUMERIC,r NUMERIC,h NUMERIC,double NUMERIC,triple NUMERIC,hr NUMERIC,rbi NUMERIC,sb NUMERIC,cs NUMERIC,bb NUMERIC,so NUMERIC,ibb NUMERIC,hbp N...
SELECT year, AVG(attendance) FROM home_game ORDER BY year DESC
How many laps have a Time/Retired of +1:35.553?
CREATE TABLE table_name_84 (laps VARCHAR,time_retired VARCHAR)
SELECT COUNT(laps) FROM table_name_84 WHERE time_retired = "+1:35.553"
What is the name of the tournament played 13 November 2000?
CREATE TABLE table_name_35 (tournament VARCHAR,date VARCHAR)
SELECT tournament FROM table_name_35 WHERE date = "13 november 2000"
what nation was next to great britain in total medal count ?
CREATE TABLE table_203_175 (id number,"rank" text,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number)
SELECT "nation" FROM table_203_175 WHERE "total" < (SELECT "total" FROM table_203_175 WHERE "nation" = 'great britain') ORDER BY "total" DESC LIMIT 1
in which month were more games played - september or october ?
CREATE TABLE table_204_615 (id number,"date" text,"opponent" text,"result" text,"goal scorers (season goals)" text,"goalie saves" text,"attendance" text)
SELECT "date" FROM table_204_615 WHERE "date" IN (9, 10) GROUP BY "date" ORDER BY COUNT(*) DESC LIMIT 1
Are there upper elective classes next semester that do not meet on Friday ?
CREATE TABLE program_course (program_id int,course_id int,workload int,category varchar)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE semester (semester_id int,semester varchar,year int)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comm...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course_offering.friday = 'N' AND course.course_id = course_offering.course_id AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'FA' ...
What draws are the lowest when wins are larger than 18?
CREATE TABLE table_12446 ("Mininera DFL" text,"Wins" real,"Byes" real,"Losses" real,"Draws" real,"Against" real)
SELECT MIN("Draws") FROM table_12446 WHERE "Wins" > '18'
How many games are played for all football games by students on scholarship?
CREATE TABLE video_games (gameid number,gname text,gtype text)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE plays_games (stuid number,gameid number,hours_played number)CREATE TABLE sportsinfo (stuid number,sportname text,hoursperweek...
SELECT SUM(gamesplayed) FROM sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y'
Who did the most high rebounds on April 6?
CREATE TABLE table_27756314_11 (high_rebounds VARCHAR,date VARCHAR)
SELECT high_rebounds FROM table_27756314_11 WHERE date = "April 6"
What class is hardest ?
CREATE TABLE course (course_id int,name varchar,department varchar,number varchar,credits varchar,advisory_requirement varchar,enforced_requirement varchar,description varchar,num_semesters int,num_enrolled int,has_discussion varchar,has_lab varchar,has_projects varchar,has_exams varchar,num_reviews int,clarity_score i...
SELECT DISTINCT course.name, course.number, program_course.workload FROM course, program_course WHERE course.department = 'EECS' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MAX(PROGRAM_COURSEalias1.workload) FROM course AS COURSEalias1, program_course AS PROGRAM_COURSEalias1 WH...
What is the overall number of the player from Utah with a pick # higher than 7?
CREATE TABLE table_36979 ("Round" real,"Pick #" real,"Overall" real,"Name" text,"Position" text,"College" text)
SELECT SUM("Overall") FROM table_36979 WHERE "College" = 'utah' AND "Pick #" < '7'
which tournament rewarded the most money for first prize ?
CREATE TABLE table_203_531 (id number,"date" text,"tournament" text,"location" text,"winner" text,"score" text,"1st prize ($)" number)
SELECT "tournament" FROM table_203_531 ORDER BY "1st prize ($)" DESC LIMIT 1
What is the least number of penalties he got when his point total was over 1419 in more than 98 games?
CREATE TABLE table_78731 ("Played" real,"Drawn" real,"Lost" real,"Winning %" real,"Tries" real,"Conversions" real,"Penalties" real,"s Drop goal" real,"Points total" real)
SELECT MIN("Penalties") FROM table_78731 WHERE "Points total" = '1419' AND "Played" > '98'
Tell me the number of patients who died in or before 2174 and had drug code osel75.
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 <= "2174.0" AND prescriptions.formulary_drug_cd = "OSEL75"
What is Injured, when Country is 'Afghanistan'?
CREATE TABLE table_name_21 (injured VARCHAR,country VARCHAR)
SELECT injured FROM table_name_21 WHERE country = "afghanistan"
What is Set 1, when Date is Jun 26, and when Set 4 is 26-24?
CREATE TABLE table_41782 ("Date" text,"Score" text,"Set 1" text,"Set 2" text,"Set 3" text,"Set 4" text,"Set 5" text,"Total" text)
SELECT "Set 1" FROM table_41782 WHERE "Date" = 'jun 26' AND "Set 4" = '26-24'
Find Post Deletion Suspects.
CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,DeletionDate time,ExpiryDate time,Body text,OwnerUserId number,DeletionUserId number)CREATE TABLE Users (Id number,Reputation number,CreationDate time,DisplayName text,LastAccessDate time,WebsiteUrl text,Location text,AboutMe te...
SELECT Reputation, DisplayName FROM Users WHERE Reputation >= 20000 ORDER BY Reputation DESC, DisplayName
the tallest delegate
CREATE TABLE table_203_791 (id number,"represented" text,"contestant" text,"age" number,"height" text,"hometown" text)
SELECT "contestant" FROM table_203_791 ORDER BY "height" DESC LIMIT 1
What are the issue dates of volumes associated with the artist 'Gorgoroth'?
CREATE TABLE artist (Artist_ID VARCHAR,Artist VARCHAR)CREATE TABLE volume (Issue_Date VARCHAR,Artist_ID VARCHAR)
SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Artist = "Gorgoroth"
What was the date of the game with the record of 18 10 2?
CREATE TABLE table_name_60 (date VARCHAR,record VARCHAR)
SELECT date FROM table_name_60 WHERE record = "18–10–2"
How many students taking a course who received an A or C? Group by students' first name with a pie chart.
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 ENROLL (CLASS_CODE varchar(5),STU_NUM int,ENROLL_GRADE varchar(50...
SELECT STU_FNAME, COUNT(STU_FNAME) FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM WHERE T2.ENROLL_GRADE = 'C' OR T2.ENROLL_GRADE = 'A' GROUP BY STU_FNAME
How many times did episode 17 originally air?
CREATE TABLE table_29297 ("Episode No. Episode No. refers to the episodes number in the overall series,whereas Series No. refers to the episodes number in this particular series." real,"Series No." real,"Episode" text,"Director" text,"Writer(s)" text,"Original airdate" text)
SELECT COUNT("Original airdate") FROM table_29297 WHERE "Episode No. Episode No. refers to the episodes number in the overall series, whereas Series No. refers to the episodes number in this particular series." = '17'
Who are the Rowers with a Time of 6:39.49?
CREATE TABLE table_name_31 (rowers VARCHAR,time VARCHAR)
SELECT rowers FROM table_name_31 WHERE time = "6:39.49"
when did patient 31239 first have their maximum heart rate until 09/12/2104?
CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type t...
SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31239)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart ra...
List the name and the number of stations for all the cities that have at least 15 stations. Show bar chart.
CREATE TABLE weather (date TEXT,max_temperature_f INTEGER,mean_temperature_f INTEGER,min_temperature_f INTEGER,max_dew_point_f INTEGER,mean_dew_point_f INTEGER,min_dew_point_f INTEGER,max_humidity INTEGER,mean_humidity INTEGER,min_humidity INTEGER,max_sea_level_pressure_inches NUMERIC,mean_sea_level_pressure_inches NUM...
SELECT city, COUNT(*) FROM station GROUP BY city
Which rank has more than 1 silver and a total nation?
CREATE TABLE table_name_1 (rank VARCHAR,silver VARCHAR,nation VARCHAR)
SELECT rank FROM table_name_1 WHERE silver > 1 AND nation = "total"
For those employees who was hired before 2002-06-21, show me about the distribution of job_id and the average of salary , and group by attribute job_id in a bar chart, could you list the average of salary in desc order 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 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 jobs (JOB_I...
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(SALARY) DESC
Who had the most assists in the game against Miami?
CREATE TABLE table_17325937_8 (high_assists VARCHAR,team VARCHAR)
SELECT high_assists FROM table_17325937_8 WHERE team = "Miami"
Which Founded has a Club of tri-city storm and a Titles larger than 1?
CREATE TABLE table_name_68 (founded INTEGER,club VARCHAR,titles VARCHAR)
SELECT SUM(founded) FROM table_name_68 WHERE club = "tri-city storm" AND titles > 1
Which UEFA Champions League has a La Liga of 17, and a Copa del Rey larger than 0?
CREATE TABLE table_name_9 (uefa_champions_league INTEGER,la_liga VARCHAR,copa_del_rey VARCHAR)
SELECT MIN(uefa_champions_league) FROM table_name_9 WHERE la_liga = 17 AND copa_del_rey > 0
Show me the number of country by country in a histogram, rank by the the number of country in desc.
CREATE TABLE club (Club_ID int,name text,Region text,Start_year text)CREATE TABLE player (Player_ID int,name text,Position text,Club_ID int,Apps real,Tries real,Goals text,Points real)CREATE TABLE competition_result (Competition_ID int,Club_ID_1 int,Club_ID_2 int,Score text)CREATE TABLE club_rank (Rank real,Club_ID int...
SELECT Country, COUNT(Country) FROM competition GROUP BY Country ORDER BY COUNT(Country) DESC
Name the ethnic group with a buddhist of 0.19%
CREATE TABLE table_52056 ("Ethnic group" text,"Christian" text,"Buddhist" text,"Hindu" text,"Jewish" text,"Muslim" text,"Sikh" text,"Other" text,"No religion" text,"Not stated" text)
SELECT "Ethnic group" FROM table_52056 WHERE "Buddhist" = '0.19%'
Users who want the 404 polyglot back.
CREATE TABLE PostNoticeTypes (Id number,ClassId number,Name text,Body text,IsHidden boolean,Predefined boolean,PostNoticeDurationId number)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE PostFeedback (Id num...
SELECT Id AS "user_link", AboutMe FROM Users WHERE (AboutMe LIKE '%404 polyglot%' OR AboutMe LIKE '%back the polyglot%')
What was the score when the record was 22-53?
CREATE TABLE table_23274514_9 (score VARCHAR,record VARCHAR)
SELECT score FROM table_23274514_9 WHERE record = "22-53"
What is the total number of byes associated with fewer than 8 wins and fewer than 1 draw?
CREATE TABLE table_name_67 (byes VARCHAR,draws VARCHAR,wins VARCHAR)
SELECT COUNT(byes) FROM table_name_67 WHERE draws < 1 AND wins < 8
Which Points have Touchdowns larger than 0, and an Extra points smaller than 0?
CREATE TABLE table_37814 ("Player" text,"Touchdowns" real,"Extra points" real,"Field goals" real,"Points" real)
SELECT SUM("Points") FROM table_37814 WHERE "Touchdowns" > '0' AND "Extra points" < '0'
What format is the link for the polling data for February 10 28, 2011?
CREATE TABLE table_24778847_2 (link VARCHAR,date_of_polling VARCHAR)
SELECT link FROM table_24778847_2 WHERE date_of_polling = "February 10–28, 2011"
Does Trinity (valhalla) have HDMI?
CREATE TABLE table_80197 ("Codename" text,"HDMI" text,"Power Supply" text,"In Production" text,"Date Released" text)
SELECT "HDMI" FROM table_80197 WHERE "Codename" = 'trinity (valhalla)'
have there been any microbiological other tests for patient 031-3355?
CREATE TABLE intakeoutput (intakeoutputid number,patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE treatment (treatmentid number,patientun...
SELECT COUNT(*) FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355')) AND microlab.culturesite = 'other'
Return the id of the customer who has the most cards, as well as the number of cards.
CREATE TABLE financial_transactions (transaction_id number,previous_transaction_id number,account_id number,card_id number,transaction_type text,transaction_date time,transaction_amount number,transaction_comment text,other_transaction_details text)CREATE TABLE accounts (account_id number,customer_id number,account_nam...
SELECT customer_id, COUNT(*) FROM customers_cards GROUP BY customer_id ORDER BY COUNT(*) DESC LIMIT 1
For those employees who was hired before 2002-06-21, draw a bar chart about the distribution of job_id and the sum of department_id , and group by attribute job_id, rank bars in asc order.
CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE locations (LOCATION_ID decimal(4,0),STREET_ADDRESS varchar(40),POSTAL_CODE varchar(12),CITY varchar(30),STATE_PROVINCE varchar(25),COUNTRY_ID varchar(2))CREATE TABLE departments (DEPARTMENT_ID decima...
SELECT JOB_ID, SUM(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID
how many of the patients on urgent admission received oral therapy?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "URGENT" AND prescriptions.route = "ORAL"
What is the attendance of the game against the New Orleans Saints before game 11?
CREATE TABLE table_name_20 (attendance INTEGER,opponent VARCHAR,game VARCHAR)
SELECT AVG(attendance) FROM table_name_20 WHERE opponent = "new orleans saints" AND game < 11
What are the names of the artists who sang the shortest song?
CREATE TABLE genre (g_name text,rating text,most_popular_in text)CREATE TABLE song (song_name text,artist_name text,country text,f_id number,genre_is text,rating number,languages text,releasedate time,resolution number)CREATE TABLE artist (artist_name text,country text,gender text,preferred_genre text)CREATE TABLE file...
SELECT T1.artist_name FROM song AS T1 JOIN files AS T2 ON T1.f_id = T2.f_id ORDER BY T2.duration LIMIT 1
When did San Jose visit the St. Louis?
CREATE TABLE table_name_91 (date VARCHAR,visitor VARCHAR)
SELECT date FROM table_name_91 WHERE visitor = "san jose"
What is the number for the Channel 4 weekly rank when there are more than 2.19 million viewers for the episode 'zero worship' which was earlier than episode 34?
CREATE TABLE table_70273 ("Episode #" real,"Title" text,"Airdate" text,"Viewers (millions)" real,"Channel 4 weekly rank a" real)
SELECT COUNT("Channel 4 weekly rank a") FROM table_70273 WHERE "Viewers (millions)" > '2.19' AND "Title" = 'zero worship' AND "Episode #" < '34'
Who is the opponent on July 2 with more than 39,290 attendance?
CREATE TABLE table_36514 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text)
SELECT "Opponent" FROM table_36514 WHERE "Attendance" > '39,290' AND "Date" = 'july 2'
How many values for silver occur when gold is less than 1, the rank is 13, and bronze is greater than 2?
CREATE TABLE table_name_70 (silver VARCHAR,bronze VARCHAR,gold VARCHAR,rank VARCHAR)
SELECT COUNT(silver) FROM table_name_70 WHERE gold < 1 AND rank = 13 AND bronze > 2
On what date was the format of ed remaster cd?
CREATE TABLE table_name_97 (date VARCHAR,format VARCHAR)
SELECT date FROM table_name_97 WHERE format = "ed remaster cd"
For those records from the products and each product's manufacturer, return a bar chart about the distribution of founder and the sum of code , and group by attribute founder, and could you rank from high to low by the sum code?
CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL)CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)
SELECT T2.Founder, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Founder ORDER BY T1.Code DESC
list all flights on CO leaving SEATTLE on sunday after 1630
CREATE TABLE ground_service (city_code text,airport_code text,transport_type text,ground_fare int)CREATE TABLE time_interval (period text,begin_time int,end_time int)CREATE TABLE flight_fare (flight_id int,fare_id int)CREATE TABLE flight (aircraft_code_sequence text,airline_code varchar,airline_flight text,arrival_time...
SELECT DISTINCT flight.flight_id FROM airport_service, city, date_day, days, flight WHERE ((date_day.day_number = 27 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time > 1630 AND flight.flight_days = days.days_code) AND city.city_code = airport_service...
how many patients are diagnosed with open wound of face nos and suggested the drug route via po/ng?
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,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,la...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Open wound of face NOS" AND prescriptions.route = "PO/NG"
provide me the number of patients who are younger than 31 years and had a hospital stay of more than 2 days.
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "31" AND demographic.days_stay > "2"
The Soviet Union has won more than 2 Silver, but how many Bronzes?
CREATE TABLE table_name_44 (bronze VARCHAR,nation VARCHAR,silver VARCHAR)
SELECT COUNT(bronze) FROM table_name_44 WHERE nation = "soviet union" AND silver > 2
How many Dates have a Score in the final of 6 4, 6 2?
CREATE TABLE table_49410 ("Outcome" text,"Date" real,"Championship" text,"Surface" text,"Opponent in the final" text,"Score in the final" text)
SELECT SUM("Date") FROM table_49410 WHERE "Score in the final" = '6–4, 6–2'
What was the highest rink for Kingston?
CREATE TABLE table_60807 ("Rank" real,"Res." text,"Wind" text,"Athlete" text,"Date" text,"Location" text)
SELECT MAX("Rank") FROM table_60807 WHERE "Location" = 'kingston'
What was the date of the game after week 5 with 62,262 fans attending?
CREATE TABLE table_name_82 (date VARCHAR,week VARCHAR,attendance VARCHAR)
SELECT date FROM table_name_82 WHERE week > 5 AND attendance = "62,262"
A bar chart about what is the average age for each city and what are those cities?, order in asc by the y axis please.
CREATE TABLE Dorm (dormid INTEGER,dorm_name VARCHAR(20),student_capacity INTEGER,gender VARCHAR(1))CREATE TABLE Has_amenity (dormid INTEGER,amenid INTEGER)CREATE TABLE Dorm_amenity (amenid INTEGER,amenity_name VARCHAR(25))CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1)...
SELECT city_code, AVG(Age) FROM Student GROUP BY city_code ORDER BY AVG(Age)
What club team plays at the champion window field?
CREATE TABLE table_66382 ("Club" text,"Sport" text,"Founded" real,"League" text,"Venue" text)
SELECT "Club" FROM table_66382 WHERE "Venue" = 'champion window field'
count the number of cases in which patient 027-203413 had received a mpv laboratory test.
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname...
SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-203413')) AND lab.labname = 'mpv'
how many times has patient 65467 been in hospital during a year before?
CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE prescriptions (row_id number,subject_id number,hadm_id number,startdate time,enddate ...
SELECT COUNT(DISTINCT admissions.hadm_id) FROM admissions WHERE admissions.subject_id = 65467 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')