instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Which year won has a Finish of t24, and a Country of england? | CREATE TABLE table_name_6 (year_won INTEGER,finish VARCHAR,country VARCHAR) | SELECT AVG(year_won) FROM table_name_6 WHERE finish = "t24" AND country = "england" |
What was the date of the friendly competition with a score of 4-0? | CREATE TABLE table_name_31 (date VARCHAR,competition VARCHAR,score VARCHAR) | SELECT date FROM table_name_31 WHERE competition = "friendly" AND score = "4-0" |
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the trend about commission_pct over hire_date , could you display X-axis in ascending order? | 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 job_history (EMPLOYEE_ID decimal(6,0)... | SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE |
What is the season of the game which causes the player 'Walter Samuel' to get injured? | CREATE TABLE injury_accident (game_id VARCHAR,player VARCHAR)CREATE TABLE game (season VARCHAR,id VARCHAR) | SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel' |
find the name of subject id 3343. | 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.name FROM demographic WHERE demographic.subject_id = "3343" |
how many laetare medalists were philantrohpists ? | CREATE TABLE table_203_509 (id number,"year" number,"laetare medalist" text,"position" text) | SELECT COUNT("laetare medalist") FROM table_203_509 WHERE "position" = 'philanthropist' |
What actor was nominated for best actress? | CREATE TABLE table_name_45 (actor VARCHAR,result VARCHAR,category VARCHAR) | SELECT actor FROM table_name_45 WHERE result = "nominated" AND category = "best actress" |
Find the white grape used to produce wines with scores above 90. | CREATE TABLE wine (no number,grape text,winery text,appelation text,state text,name text,year number,price number,score number,cases number,drink text)CREATE TABLE grapes (id number,grape text,color text)CREATE TABLE appellations (no number,appelation text,county text,state text,area text,isava text) | SELECT DISTINCT T1.grape FROM grapes AS T1 JOIN wine AS T2 ON T1.grape = T2.grape WHERE T1.color = "White" AND T2.score > 90 |
What was the score for the game in which Emeka Okafor (10) had high rebounds? | CREATE TABLE table_11907963_6 (score VARCHAR,high_rebounds VARCHAR) | SELECT score FROM table_11907963_6 WHERE high_rebounds = "Emeka Okafor (10)" |
i need a reservation from BALTIMORE to SAN FRANCISCO | CREATE TABLE airport (airport_code varchar,airport_name text,airport_location text,state_code varchar,country_name varchar,time_zone_code varchar,minimum_connect_time int)CREATE TABLE airport_service (city_code varchar,airport_code varchar,miles_distant int,direction varchar,minutes_distant int)CREATE TABLE compartment... | 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 = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN ... |
Which Country has a Score of 69-74=143? | CREATE TABLE table_60690 ("Place" text,"Player" text,"Country" text,"Score" text,"To Par" real) | SELECT "Country" FROM table_60690 WHERE "Score" = '69-74=143' |
What did the home team score against Richmond? | CREATE TABLE table_20739 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Ground" text,"Crowd" real,"Date" text) | SELECT "Home team score" FROM table_20739 WHERE "Away team" = 'Richmond' |
What instrument did the musician with last name 'Heilo' use in the song 'Badlands'? | CREATE TABLE Songs (SongId VARCHAR,songid VARCHAR,title VARCHAR)CREATE TABLE Instruments (instrument VARCHAR,songid VARCHAR,bandmateid VARCHAR)CREATE TABLE Band (id VARCHAR,lastname VARCHAR)CREATE TABLE Performance (bandmate VARCHAR,SongId VARCHAR) | SELECT T4.instrument FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.songid = T1.songid JOIN Instruments AS T4 ON T4.songid = T3.songid AND T4.bandmateid = T2.id WHERE T2.lastname = "Heilo" AND T3.title = "Badlands" |
How many different items appear in the high rebounds column in game 80? | CREATE TABLE table_29780 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT COUNT("High rebounds") FROM table_29780 WHERE "Game" = '80' |
For those records from the products and each product's manufacturer, find name and code , and group by attribute founder, and visualize them by a bar chart. | 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 Founder, T1.Name |
For those employees who did not have any job in the past, visualize a scatter chart about the correlation between employee_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 jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY decimal(6,0))CREATE TABLE ... | SELECT EMPLOYEE_ID, DEPARTMENT_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) |
What is the sum of Total Regions that have the Year 1954, and a Nebo greater than 447? | CREATE TABLE table_70914 ("Year" real,"Total Region" real,"Belyando" real,"Broadsound" real,"Nebo" real) | SELECT SUM("Total Region") FROM table_70914 WHERE "Year" = '1954' AND "Nebo" > '447' |
What nation has 28 bronze medals? | CREATE TABLE table_name_63 (nation VARCHAR,bronze VARCHAR) | SELECT nation FROM table_name_63 WHERE bronze = "28" |
What is the average number of gold medals won among the nations that won more than 1 bronze? | CREATE TABLE table_13782 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT AVG("Gold") FROM table_13782 WHERE "Bronze" > '1' |
List the number of games in each season with a line chart, sort from high to low by the X. | CREATE TABLE game (stadium_id int,id int,Season int,Date text,Home_team text,Away_team text,Score text,Competition text)CREATE TABLE injury_accident (game_id int,id int,Player text,Injury text,Number_of_matches text,Source text)CREATE TABLE stadium (id int,name text,Home_Games int,Average_Attendance real,Total_Attendan... | SELECT Season, COUNT(Season) FROM game GROUP BY Season ORDER BY Season DESC |
How many league division does football_data database has? | CREATE TABLE betfront (year number,datetime time,country text,competion text,match text,home_opening number,draw_opening number,away_opening number,home_closing number,draw_closing number,away_closing number)CREATE TABLE football_data (season text,datetime time,div text,country text,league text,referee text,hometeam te... | SELECT COUNT(div) FROM football_data |
how many female patients used the drug code metl25? | 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 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.formulary_drug_cd = "METL25" |
What was the away team's score for the match played at Victoria Park? | CREATE TABLE table_33500 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT "Away team score" FROM table_33500 WHERE "Venue" = 'victoria park' |
Return a histogram on what are the different names and credit scores of customers who have taken a loan?, show Y from low to high order please. | CREATE TABLE loan (loan_ID varchar(3),loan_type varchar(15),cust_ID varchar(3),branch_ID varchar(3),amount int)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 bank (branch_ID int,bname varchar(20),... | SELECT cust_name, credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_ID = T2.cust_ID ORDER BY credit_score |
who ranked right after turkey ? | CREATE TABLE table_203_812 (id number,"rank" number,"nation" text,"gold" number,"silver" number,"bronze" number,"total" number) | SELECT "nation" FROM table_203_812 WHERE "rank" = (SELECT "rank" FROM table_203_812 WHERE "nation" = 'turkey') + 1 |
Name the week number for andrew lloyd webber | CREATE TABLE table_72721 ("Week #" text,"Theme" text,"Song choice" text,"Original artist" text,"Order #" text,"Result" text) | SELECT "Week #" FROM table_72721 WHERE "Theme" = 'Andrew Lloyd Webber' |
Which Object type has a Constellation of orion, and an NGC number larger than 2174, and a Declination (J2000) of 48 06 ? | CREATE TABLE table_name_32 (object_type VARCHAR,declination___j2000__ VARCHAR,constellation VARCHAR,ngc_number VARCHAR) | SELECT object_type FROM table_name_32 WHERE constellation = "orion" AND ngc_number > 2174 AND declination___j2000__ = "°48′06″" |
Round 3 with less than 54 for Round 4? | CREATE TABLE table_name_69 (round_3 VARCHAR,round_4 VARCHAR) | SELECT round_3 FROM table_name_69 WHERE round_4 = "54" |
What was the lowest lane with a mark of 7.26? | CREATE TABLE table_name_50 (lane INTEGER,mark VARCHAR) | SELECT MIN(lane) FROM table_name_50 WHERE mark = "7.26" |
which episode was previous to target | CREATE TABLE table_204_494 (id number,"episode #" text,"original air date (uk)" text,"episode title" text,"guest cast" text,"dvd # 1" number) | SELECT "episode title" FROM table_204_494 WHERE id = (SELECT id FROM table_204_494 WHERE "episode title" = '"target"') - 1 |
What was the score of game 4? | CREATE TABLE table_name_84 (score VARCHAR,game VARCHAR) | SELECT score FROM table_name_84 WHERE game = 4 |
How many points are listed when the position is 2? | CREATE TABLE table_15405904_1 (points INTEGER,position VARCHAR) | SELECT MAX(points) FROM table_15405904_1 WHERE position = 2 |
Which Game has an Opponent of @ houston rockets? | CREATE TABLE table_name_22 (game INTEGER,opponent VARCHAR) | SELECT MIN(game) FROM table_name_22 WHERE opponent = "@ houston rockets" |
What is the name of the airport with the most number of routes that start in China? | CREATE TABLE routes (rid number,dst_apid number,dst_ap text,src_apid number,src_ap text,alid number,airline text,codeshare text)CREATE TABLE airports (apid number,name text,city text,country text,x number,y number,elevation number,iata text,icao text)CREATE TABLE airlines (alid number,name text,iata text,icao text,call... | SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid WHERE T1.country = 'China' GROUP BY T1.name ORDER BY COUNT(*) DESC LIMIT 1 |
how many patients whose age is less than 59 and drug code is tacrsusp? | 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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "59" AND prescriptions.formulary_drug_cd = "TACRSUSP" |
What is the sum of number of bearers in 2009 for a rank above 1, a type of patronymic, an etymology meaning son of Christian, and the number of bearers in 1971 greater than 45.984? | CREATE TABLE table_44876 ("Rank" real,"Surname" text,"Number of bearers 1971" real,"Number of bearers 2009" real,"Type" text,"Etymology" text) | SELECT SUM("Number of bearers 2009") FROM table_44876 WHERE "Rank" > '1' AND "Type" = 'patronymic' AND "Etymology" = 'son of christian' AND "Number of bearers 1971" > '45.984' |
what round saw the ground of telstra dome and shaun burgoyne as nominees? | CREATE TABLE table_51245 ("Round" real,"Nominees" text,"Team" text,"Match" text,"Ground" text) | SELECT MAX("Round") FROM table_51245 WHERE "Ground" = 'telstra dome' AND "Nominees" = 'shaun burgoyne' |
what was the name of a drug patient 65124 was last prescribed on the last hospital encounter? | 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 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,inti... | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65124 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) ORDER BY prescriptions.startdate DESC LIMIT 1 |
What is the average age for each city and what are those cities Show bar chart, and list names in descending order. | CREATE TABLE Student (StuID INTEGER,LName VARCHAR(12),Fname VARCHAR(12),Age INTEGER,Sex VARCHAR(1),Major INTEGER,Advisor INTEGER,city_code VARCHAR(3))CREATE TABLE Lives_in (stuid INTEGER,dormid INTEGER,room_number INTEGER)CREATE TABLE Dorm_amenity (amenid INTEGER,amenity_name VARCHAR(25))CREATE TABLE Has_amenity (dormi... | SELECT city_code, AVG(Age) FROM Student GROUP BY city_code ORDER BY city_code DESC |
Name the 2011 with 2006 of 2r | CREATE TABLE table_69451 ("Tournament" text,"2001" text,"2002" text,"2003" text,"2004" text,"2005" text,"2006" text,"2007" text,"2008" text,"2009" text,"2010" text,"2011" text,"2012" text) | SELECT "2011" FROM table_69451 WHERE "2006" = '2r' |
Which week with Green Bay Packers as an opponent is the highest? | CREATE TABLE table_33121 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" real) | SELECT MAX("Week") FROM table_33121 WHERE "Opponent" = 'green bay packers' |
Group and count brand for each camera lens using a bar chart. | CREATE TABLE camera_lens (id int,brand text,name text,focal_length_mm real,max_aperture real)CREATE TABLE mountain (id int,name text,Height real,Prominence real,Range text,Country text)CREATE TABLE photos (id int,camera_lens_id int,mountain_id int,color text,name text) | SELECT brand, COUNT(brand) FROM camera_lens GROUP BY brand |
Which school has an 1860-1878 larger than 0, and a Second Afghan War of 0? | CREATE TABLE table_71322 ("School" text,"Location" text,"Total" real,"Crimean War" real,"Persian War" real,"Indian Mutiny" real,"1860-1878" real,"Zulu War" real,"Second Afghan War" text) | SELECT "School" FROM table_71322 WHERE "1860-1878" > '0' AND "Second Afghan War" = '0' |
What is the score when the outcome was runner-up, earlier than 1975? | CREATE TABLE table_name_25 (score VARCHAR,outcome VARCHAR,date VARCHAR) | SELECT score FROM table_name_25 WHERE outcome = "runner-up" AND date < 1975 |
What is the name for the 2008 club of Azs olsztyn? | CREATE TABLE table_79237 ("Name" text,"Height" text,"Weight" text,"Spike" text,"2008 club" text) | SELECT "Name" FROM table_79237 WHERE "2008 club" = 'azs olsztyn' |
How many sections does each course have Visualize by bar chart, and list by the the total number from low to high. | CREATE TABLE PROFESSOR (EMP_NUM int,DEPT_CODE varchar(10),PROF_OFFICE varchar(50),PROF_EXTENSION varchar(4),PROF_HIGH_DEGREE varchar(5))CREATE TABLE COURSE (CRS_CODE varchar(10),DEPT_CODE varchar(10),CRS_DESCRIPTION varchar(35),CRS_CREDIT float(8))CREATE TABLE DEPARTMENT (DEPT_CODE varchar(10),DEPT_NAME varchar(30),SCH... | SELECT CRS_CODE, COUNT(*) FROM CLASS GROUP BY CRS_CODE ORDER BY COUNT(*) |
What are the timeslot(s) for broadcast on February 22, 2008? | CREATE TABLE table_20535 ("#" real,"Air Date" text,"Timeslot" text,"Rating" text,"Share" real,"18-49" text,"Viewers" text,"Weekly Rank" text) | SELECT "Timeslot" FROM table_20535 WHERE "Air Date" = 'February 22, 2008' |
Over the next 6 semesters , what classes will be offered ? | CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE course_tags_count (course_id int,clear_grading int,pop_quiz int,group_projects int,inspirational int,long_lectures int,extra_credit int,few_tests int,good_feedback int,tough_tests int,heavy_papers int,cares_for_students int,heavy_assignments int,respe... | SELECT DISTINCT course.name, course.number, semester.semester, semester.year FROM course, course_offering, semester WHERE ((semester.semester = 'FA' AND semester.year = 2016) OR (semester.semester = 'FA' AND semester.year = 2017) OR (semester.semester = 'FA' AND semester.year = 2018) OR (semester.semester = 'WN' AND se... |
For those records from the products and each product's manufacturer, what is the relationship between manufacturer and code , and group by attribute name? | CREATE TABLE Products (Code INTEGER,Name VARCHAR(255),Price DECIMAL,Manufacturer INTEGER)CREATE TABLE Manufacturers (Code INTEGER,Name VARCHAR(255),Headquarter VARCHAR(255),Founder VARCHAR(255),Revenue REAL) | SELECT T1.Manufacturer, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Name |
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, give me the comparison about the average of department_id over the hire_date bin hire_date by time by a bar chart, and list mean department id from high to low order. | 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 HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(DEPARTMENT_ID) DESC |
what is the organism name found until 20 months ago in the last isolate microbiology test of patient 95470? | 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 labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE prescriptions (row_id numbe... | SELECT microbiologyevents.org_name FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95470) AND microbiologyevents.spec_type_desc = 'isolate' AND NOT microbiologyevents.org_name IS NULL AND DATETIME(microbiologyevents.charttime) <= DATET... |
which city has the largest number of historic sites ? | CREATE TABLE table_204_423 (id number,"name" text,"location" text,"city" text,"listing date" text) | SELECT "city" FROM table_204_423 GROUP BY "city" ORDER BY COUNT("name") DESC LIMIT 1 |
May I sign up for 400 -level classes in Fall or Winter term ? | CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE program_course (program_id int,course_id int,workload int,category varchar)CREATE TABLE area (course_id int,area varchar)CREATE TABLE program_requirement (program_id int,category varchar,min_credit int,additional_req varchar)CREATE TABLE co... | 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, semester AS SEMESTERalias0 WHERE ((SEM... |
show me the flights from DENVER to LAS VEGAS | CREATE TABLE time_interval (period text,begin_time int,end_time int)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 airport_service (city_code varchar,airport_code varchar,mi... | 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 = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LAS VEG... |
how many patients tested for rbc pleural in lab? | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "RBC, Pleural" |
bmi: 18 _ 25 kg / m2 hba1c: < 8.9 % fasting plasma glucose: < 250 mg / dl other inclusion criteria: on dietary modification and / or metformin | CREATE TABLE table_dev_33 ("id" int,"gender" string,"fpg" float,"active_infection" bool,"uncontrolled_diabetes" bool,"hiv_infection" bool,"hemoglobin_a1c_hba1c" float,"urine_albumin_excretion" int,"hematocrit_hct" float,"fasting_plasma_glucose" int,"dietary_modification" bool,"hepatitis" bool,"body_mass_index_bmi" floa... | SELECT * FROM table_dev_33 WHERE (body_mass_index_bmi >= 18 AND body_mass_index_bmi <= 25) OR hemoglobin_a1c_hba1c < 8.9 OR fasting_plasma_glucose < 250 OR (dietary_modification = 1 OR metformin = 1) |
With a To par of 2, what is Johnny Miller's Place? | CREATE TABLE table_name_13 (place VARCHAR,to_par VARCHAR,player VARCHAR) | SELECT place FROM table_name_13 WHERE to_par = "–2" AND player = "johnny miller" |
How many data are there under NO vote with a description of $1500 tax exemption amendment? | CREATE TABLE table_256286_8 (no_votes VARCHAR,description VARCHAR) | SELECT COUNT(no_votes) FROM table_256286_8 WHERE description = "$1500 Tax Exemption Amendment" |
What is the Set 2 with a Total with 45 12? | CREATE TABLE table_54308 ("Date" text,"Score" text,"Set 1" text,"Set 2" text,"Set 3" text,"Total" text) | SELECT "Set 2" FROM table_54308 WHERE "Total" = '45–12' |
List the snatch score and clean jerk score of body builders in ascending order of snatch score. Plot them as scatter chart. | CREATE TABLE body_builder (Body_Builder_ID int,People_ID int,Snatch real,Clean_Jerk real,Total real)CREATE TABLE people (People_ID int,Name text,Height real,Weight real,Birth_Date text,Birth_Place text) | SELECT Snatch, Clean_Jerk FROM body_builder |
what were the five most common intakes? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime ti... | SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%intake%' GROUP BY intakeoutput.celllabel) AS t1 WHERE t1.c1 <= 5 |
What game is the lowest with 1 draw and less than 7 points? | CREATE TABLE table_35652 ("Games" real,"Drawn" real,"Lost" real,"Points difference" text,"Points" real) | SELECT MIN("Games") FROM table_35652 WHERE "Drawn" = '1' AND "Points" < '7' |
For those records from the products and each product's manufacturer, return a bar chart about the distribution of name and manufacturer , and group by attribute founder, I want to rank by the y-axis in descending. | 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.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name ORDER BY T1.Manufacturer DESC |
What is the number of bronze that Scotland, which has less than 7 total medals, has? | CREATE TABLE table_78098 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT SUM("Bronze") FROM table_78098 WHERE "Nation" = 'scotland' AND "Total" < '7' |
Find the number of the order dates of the orders with price above 1000. | CREATE TABLE Addresses (Address_ID VARCHAR(100),Line_1 VARCHAR(255),Line_2 VARCHAR(255),City_Town VARCHAR(255),State_County VARCHAR(255),Other_Details VARCHAR(255))CREATE TABLE Stores (Store_ID VARCHAR(100),Address_ID INTEGER,Marketing_Region_Code CHAR(15),Store_Name VARCHAR(255),Store_Phone VARCHAR(255),Store_Email_Ad... | SELECT Order_Date, COUNT(Order_Date) FROM Customer_Orders AS T1 JOIN Order_Items AS T2 ON T1.Order_ID = T2.Order_ID JOIN Products AS T3 ON T2.Product_ID = T3.Product_ID WHERE T3.Product_Price > 1000 |
Who won when the Patriots played the Denver Broncos? | CREATE TABLE table_32481 ("Week" text,"Opponent" text,"Result" text,"Stadium" text,"Record" text,"Attendance" text) | SELECT "Record" FROM table_32481 WHERE "Opponent" = 'denver broncos' |
What's the average of all years tournaments were hosted in Doha, Qatar? | CREATE TABLE table_name_81 (year INTEGER,venue VARCHAR) | SELECT AVG(year) FROM table_name_81 WHERE venue = "doha, qatar" |
Name the most pick number for illinois | CREATE TABLE table_27371 ("Pick #" real,"NFL Team" text,"Player" text,"Position" text,"College" text) | SELECT MAX("Pick #") FROM table_27371 WHERE "College" = 'Illinois' |
how many patients have undergone a vascular catheter placement - central venous two or more times since 2 years ago? | CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight nu... | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, COUNT(*) AS c1 FROM patient WHERE patient.patientunitstayid = (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'vascular catheter placement - central venous' AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TI... |
What was the result of the Oregon 5 District incumbent who was first elected in 1996? | CREATE TABLE table_name_18 (results VARCHAR,first_elected VARCHAR,district VARCHAR) | SELECT results FROM table_name_18 WHERE first_elected = 1996 AND district = "oregon 5" |
calculate the maximum age of female divorced patients. | 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 MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.gender = "F" |
what is the drug code and drug route of the drug calcium carbonate? | 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 lab (subject_id text,hadm_id text,itemid text,charttime tex... | SELECT prescriptions.formulary_drug_cd, prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Calcium Carbonate" |
Game Tag question by Weeks since release. | 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 PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time... | SELECT COUNT(*), CONCAT_WS('_', TIME_TO_STR('creationdate', '%Year'), TIME_TO_STR('creationdate', 'Week')) AS "weekyear" FROM Posts WHERE Tags LIKE '%dark-souls-3%' GROUP BY CONCAT_WS('_', TIME_TO_STR('creationdate', '%Year'), TIME_TO_STR('creationdate', 'Week')) |
What's the rank in West Virginia when the overweight adult was 66.8%? | CREATE TABLE table_66573 ("State and District of Columbia" text,"Obese adults" text,"Overweight (incl. obese) adults" text,"Obese children and adolescents" text,"Obesity rank" real) | SELECT "Obesity rank" FROM table_66573 WHERE "Overweight (incl. obese) adults" = '66.8%' AND "State and District of Columbia" = 'west virginia' |
What is the overall attendance in the places where the average attendance was 17148? | CREATE TABLE table_3837 ("Season" text,"Overall Record" text,"SEC Record" text,"Overall Attendance" real,"Average Attendance" real,"Rank Nationally" text) | SELECT "Overall Attendance" FROM table_3837 WHERE "Average Attendance" = '17148' |
What shows for thurs 25 aug when fri 26 aug is 19' 30.70 116.023mph? | CREATE TABLE table_31468 ("Rank" real,"Rider" text,"Sat 20 Aug" text,"Mon 22 Aug" text,"Tues 23 Aug" text,"Wed 24 Aug" text,"Thurs 25 Aug" text,"Fri 26 Aug" text) | SELECT "Thurs 25 Aug" FROM table_31468 WHERE "Fri 26 Aug" = '19'' 30.70 116.023mph' |
What team does Kenny Smith play for? | CREATE TABLE table_name_25 (school_club_team VARCHAR,player VARCHAR) | SELECT school_club_team FROM table_name_25 WHERE player = "kenny smith" |
Which 1st leg has a Team #1 of ummc ekaterinburg? | CREATE TABLE table_42159 ("Team #1" text,"Agg." text,"Team #2" text,"1st leg" text,"2nd leg" text) | SELECT "1st leg" FROM table_42159 WHERE "Team #1" = 'ummc ekaterinburg' |
How many companies are headquartered in the US? | CREATE TABLE people (people_id number,age number,name text,nationality text,graduation_college text)CREATE TABLE employment (company_id number,people_id number,year_working number)CREATE TABLE company (company_id number,name text,headquarters text,industry text,sales_in_billion number,profits_in_billion number,assets_i... | SELECT COUNT(*) FROM company WHERE headquarters = 'USA' |
What is the average Extras for Muttiah Muralitharan, with less than 353 Runs Conceded? | CREATE TABLE table_name_38 (extras INTEGER,name VARCHAR,runs_conceded VARCHAR) | SELECT AVG(extras) FROM table_name_38 WHERE name = "muttiah muralitharan" AND runs_conceded < 353 |
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 job_id and manager_id , sort Y from low to high 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 jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN... | SELECT JOB_ID, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID |
Show me the frequency of the weekdays (binning year into weekdays interval) that the team Boston Red Stockings won in the postseasons with a bar chart. | CREATE TABLE manager (player_id TEXT,year INTEGER,team_id TEXT,league_id TEXT,inseason INTEGER,g INTEGER,w INTEGER,l INTEGER,rank NUMERIC,plyr_mgr TEXT)CREATE TABLE fielding_outfield (player_id TEXT,year INTEGER,stint INTEGER,glf NUMERIC,gcf NUMERIC,grf NUMERIC)CREATE TABLE pitching_postseason (player_id TEXT,year INTE... | SELECT year, COUNT(year) FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' |
What was Bye's opponent's attendance? | CREATE TABLE table_name_85 (attendance VARCHAR,opponent VARCHAR) | SELECT attendance FROM table_name_85 WHERE opponent = "bye" |
tell me the number of patients who were admitted before the year 2172 and underwent aortography. | 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 diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2172" AND procedures.long_title = "Aortography" |
Find duplicated questions which user has answered. | CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE Tags (Id number,TagName text,Count number,Excer... | SELECT p.ParentId, p.Id AS "post_link", p.Title, pp.Title FROM Posts AS p JOIN Posts AS pp ON p.ParentId = pp.Id JOIN PostHistory AS ph ON ph.PostId = pp.Id WHERE p.PostTypeId = 2 AND p.OwnerUserId = '##userid##' AND ph.PostHistoryTypeId = 10 AND ph.Comment = 101 AND NOT pp.ClosedDate IS NULL |
What is the per capital income for Charles county? | CREATE TABLE table_75584 ("County" text,"Per capita income" text,"Median household income" text,"Population" real,"Number of households" real) | SELECT "Per capita income" FROM table_75584 WHERE "County" = 'charles' |
What is the lowest number of bronze medals with less than 2 silver medals and more than 1 medal in total for Uzbekistan? | CREATE TABLE table_39000 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT MIN("Bronze") FROM table_39000 WHERE "Silver" < '2' AND "Total" > '1' AND "Nation" = 'uzbekistan' |
When was the Attendance larger than 74,382? | CREATE TABLE table_name_36 (date VARCHAR,attendance INTEGER) | SELECT date FROM table_name_36 WHERE attendance > 74 OFFSET 382 |
Search User by their Display Name. Filter users by their Display Name, and Country Name | CREATE TABLE PostsWithDeleted (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,Ta... | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location, WebsiteUrl FROM Users WHERE LOWER(Location) LIKE LOWER('%##CityName##%') AND LOWER(DisplayName) LIKE LOWER('%##UserName##%') ORDER BY Reputation DESC |
what diagnosis did patient 007-16774 first receive during the previous year? | CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,dischargeweight number,hospitaladmittime time,hospitaladmitsource text,unitadmittime time,unitdischargetime tim... | SELECT diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-16774')) AND DATETIME(diagnosis.diagnosistime, 'start of year... |
What is the Away team when the FootyTAB winner was st. george? | CREATE TABLE table_7419 ("Home team" text,"Away team" text,"Match score" text,"\"Pick The Winners\" score" text,"FootyTAB winner" text) | SELECT "Away team" FROM table_7419 WHERE "FootyTAB winner" = 'st. george' |
Find the last name of the author with first name 'Amal'. | CREATE TABLE inst (instid number,name text,country text)CREATE TABLE papers (paperid number,title text)CREATE TABLE authorship (authid number,instid number,paperid number,authorder number)CREATE TABLE authors (authid number,lname text,fname text) | SELECT lname FROM authors WHERE fname = "Amal" |
has patient 022-89058 been prescribed acetaminophen, 50 ml vial : dextrose 50 % iv soln, or acetaminophen (tylenol) tablet 650 mg when they came to the hospital first time? | CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,disch... | SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-89058' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.... |
what is patient 94293's daily average level of asparate aminotransferase (ast) during their first hospital encounter? | CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime t... | SELECT AVG(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 94293 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = '... |
Count the number of male students who had class senator votes in the fall election cycle. | CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE voting_record (stuid number,registration_date text,election_cycle text,president_vote number,vice_president_vote number,secretary_vote number,treasurer_vote number,class_president_vote nu... | SELECT COUNT(*) FROM student AS T1 JOIN voting_record AS T2 ON T1.stuid = class_senator_vote WHERE T1.sex = "M" AND T2.election_cycle = "Fall" |
In Spring or Summer 2008 which hardware courses are offered ? | CREATE TABLE instructor (instructor_id int,name varchar,uniqname 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 int,heavy_assi... | SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE area.area LIKE '%hardw... |
What was the record after the NJKF Magnam 16 event that lasted 2:06? | CREATE TABLE table_5579 ("Result" text,"Record" text,"Opponent" text,"Event" text,"Method" text,"Round" text,"Time" text) | SELECT "Record" FROM table_5579 WHERE "Time" = '2:06' AND "Event" = 'njkf magnam 16' |
What Club has Fiba European Champion's Cup and an Italian Cup? | CREATE TABLE table_55916 ("Season" text,"Club" text,"National League" text,"National Cup" text,"European Cup" text) | SELECT "Club" FROM table_55916 WHERE "European Cup" = 'fiba european champion''s cup' AND "National Cup" = 'italian cup' |
What's the Game SIte with an Opponent of San Diego Chargers? | CREATE TABLE table_name_97 (game_site VARCHAR,opponent VARCHAR) | SELECT game_site FROM table_name_97 WHERE opponent = "san diego chargers" |
Which Team/Chassis has less than 65 points? | CREATE TABLE table_name_66 (team_chassis VARCHAR,pts INTEGER) | SELECT team_chassis FROM table_name_66 WHERE pts < 65 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.