instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
Which Game has a Record of 8 2 0, and Points larger than 16?
CREATE TABLE table_39155 ("Game" real,"October" real,"Opponent" text,"Score" text,"Record" text,"Points" real)
SELECT SUM("Game") FROM table_39155 WHERE "Record" = '8–2–0' AND "Points" > '16'
Tell me the total number of Grid for Time/Retired of +2 Laps and Laps less than 70
CREATE TABLE table_52796 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT COUNT("Grid") FROM table_52796 WHERE "Time/Retired" = '+2 laps' AND "Laps" < '70'
How many silver medals are there with 3 gold medals at a rank above 1?
CREATE TABLE table_10891 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT COUNT("Silver") FROM table_10891 WHERE "Gold" = '3' AND "Rank" > '1'
At which stadium did the Los Angeles Raiders play as the visiting team?
CREATE TABLE table_name_85 (stadium VARCHAR,visiting_team VARCHAR)
SELECT stadium FROM table_name_85 WHERE visiting_team = "los angeles raiders"
Which titles have been published by Gamehouse Live?
CREATE TABLE table_28621502_1 (title VARCHAR,publisher VARCHAR)
SELECT title FROM table_28621502_1 WHERE publisher = "GameHouse Live"
Lis the series for game 5.
CREATE TABLE table_30998 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Series" text)
SELECT "Series" FROM table_30998 WHERE "Game" = '5'
how many patients with medicare insurance are diagnosed with icd9 code 2851?
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 lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicare" AND diagnoses.icd9_code = "2851"
What is the head of government for Don Stephen Senanayake?
CREATE TABLE table_name_77 (head_s__of_government VARCHAR,name VARCHAR)
SELECT head_s__of_government FROM table_name_77 WHERE name = "don stephen senanayake"
What district has abhayapuri south as the name?
CREATE TABLE table_name_41 (district VARCHAR,name VARCHAR)
SELECT district FROM table_name_41 WHERE name = "abhayapuri south"
what was the name of the allergy that was patient 021-111547 had in this month?
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 vitalperiodic (vitalperiodicid number,patientunitstayid number,tempe...
SELECT allergy.allergyname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-111547')) AND DATETIME(allergy.allergytime, 'start of month') = DATET...
How many of the patients tested for ascites were born before 2184?
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2184" AND lab.fluid = "Ascites"
how many times has patient 1784 produced an urine . output today?
CREATE TABLE procedures_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 diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code ...
SELECT COUNT(*) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1784)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine .' AND d_item...
What is the highest round of a player from Sweden who plays right wing?
CREATE TABLE table_name_59 (round INTEGER,nationality VARCHAR,position VARCHAR)
SELECT MAX(round) FROM table_name_59 WHERE nationality = "sweden" AND position = "right wing"
which school was in the columbus neighborhood and was demolished ?
CREATE TABLE table_203_40 (id number,"p.s. #" number,"school name" text,"neighborhood" text,"low grade" text,"high grade" number,"year closed" text,"building status" text)
SELECT "school name" FROM table_203_40 WHERE "neighborhood" = 'columbus' AND "building status" = 'demolished'
What is the Acquisition that has less than 22, in the 2002 season?
CREATE TABLE table_42795 ("Name" text,"Position" text,"Number" real,"Season" text,"Acquisition via" text)
SELECT "Acquisition via" FROM table_42795 WHERE "Number" < '22' AND "Season" = '2002'
What is the Qaxmu al village with a Fistiqli village ke qutan?
CREATE TABLE table_name_81 (qaxmuğal VARCHAR,fıstıqlı VARCHAR)
SELECT qaxmuğal FROM table_name_81 WHERE fıstıqlı = "keşqutan"
What losses consist of the team of japan?
CREATE TABLE table_name_13 (losses VARCHAR,team VARCHAR)
SELECT losses FROM table_name_13 WHERE team = "japan"
Show all distinct product categories along with the number of mailshots in each category Visualize by bar chart, rank x-axis from high to low order please.
CREATE TABLE Products (product_id INTEGER,product_category VARCHAR(15),product_name VARCHAR(80))CREATE TABLE Customers (customer_id INTEGER,payment_method VARCHAR(15),customer_name VARCHAR(80),customer_phone VARCHAR(80),customer_email VARCHAR(80),customer_address VARCHAR(255),customer_login VARCHAR(80),customer_passwor...
SELECT product_category, COUNT(*) FROM Mailshot_Campaigns GROUP BY product_category ORDER BY product_category DESC
calculate the three year survival rate of those who were diagnosed with peptic ulcer disease - duodenal.
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage tex...
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 3 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOI...
How many professors whose office is located in DRE 102 are hired in each month? Return a bar chart, list by the how many emp hiredate in asc.
CREATE TABLE COURSE (CRS_CODE varchar(10),DEPT_CODE varchar(10),CRS_DESCRIPTION varchar(35),CRS_CREDIT float(8))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 EMPLOYEE (EMP_NUM int,EMP_LNAME varchar(15),EMP_FNAME varch...
SELECT EMP_HIREDATE, COUNT(EMP_HIREDATE) FROM EMPLOYEE AS T1 JOIN PROFESSOR AS T2 ON T1.EMP_NUM = T2.EMP_NUM WHERE T2.PROF_OFFICE = 'DRE 102' ORDER BY COUNT(EMP_HIREDATE)
Show different nationalities along with the number of hosts of each nationality Visualize by bar chart, and show from high to low by the X.
CREATE TABLE party (Party_ID int,Party_Theme text,Location text,First_year text,Last_year text,Number_of_hosts int)CREATE TABLE host (Host_ID int,Name text,Nationality text,Age text)CREATE TABLE party_host (Party_ID int,Host_ID int,Is_Main_in_Charge bool)
SELECT Nationality, COUNT(*) FROM host GROUP BY Nationality ORDER BY Nationality DESC
What is the Time/Retired for laps higher than 52 on a grid larger than 21?
CREATE TABLE table_54112 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Time/Retired" FROM table_54112 WHERE "Laps" > '52' AND "Grid" > '21'
List the number of the names of patients who have made appointments, list by the bars in asc.
CREATE TABLE Procedures (Code INTEGER,Name VARCHAR(30),Cost REAL)CREATE TABLE Physician (EmployeeID INTEGER,Name VARCHAR(30),Position VARCHAR(30),SSN INTEGER)CREATE TABLE Department (DepartmentID INTEGER,Name VARCHAR(30),Head INTEGER)CREATE TABLE On_Call (Nurse INTEGER,BlockFloor INTEGER,BlockCode INTEGER,OnCallStart D...
SELECT Name, COUNT(Name) FROM Appointment AS T1 JOIN Patient AS T2 ON T1.Patient = T2.SSN GROUP BY Name ORDER BY Name
What is the average drawn of the team with a difference of 4 and more than 13 losses?
CREATE TABLE table_38619 ("Position" real,"Team" text,"Points" real,"Played" real,"Drawn" real,"Lost" real,"Against" real,"Difference" text)
SELECT AVG("Drawn") FROM table_38619 WHERE "Difference" = '4' AND "Lost" > '13'
How many mixed doubles were won in 1996?
CREATE TABLE table_19790 ("Year" real,"Mens singles" text,"Womens singles" text,"Mens doubles" text,"Womens doubles" text,"Mixed doubles" text)
SELECT COUNT("Mixed doubles") FROM table_19790 WHERE "Year" = '1996'
what was the average age of the first three on the list ?
CREATE TABLE table_204_145 (id number,"representative" text,"state" text,"district(s)" text,"served" text,"party" text,"date of birth" text,"date of death" text,"age" text)
SELECT AVG("age") FROM table_204_145 WHERE id <= 3
What is the 0 100km/h,s for the output of ps (kw; hp) @4000 rpm?
CREATE TABLE table_60253 ("Name" text,"Volume" text,"Engine" text,"Fuel" text,"Output" text,"Torque" text,"Engine ID code(s)" text,"0\u2013100km/h,s" real,"Top speed" text,"Years" text)
SELECT COUNT("0\u2013100km/h,s") FROM table_60253 WHERE "Output" = 'ps (kw; hp) @4000 rpm'
What is the result from March 14, 2007?
CREATE TABLE table_33729 ("Date" text,"Venue" text,"Result" text,"Goals" real,"Competition" text)
SELECT "Result" FROM table_33729 WHERE "Date" = 'march 14, 2007'
Who directed the film that received an award of 6,245?
CREATE TABLE table_name_10 (director_s_ VARCHAR,award VARCHAR)
SELECT director_s_ FROM table_name_10 WHERE award = "£6,245"
Find the the names of the tourist attractions that the tourist named Alison visited but Rosalind did not visit.
CREATE TABLE hotels (hotel_id number,star_rating_code text,pets_allowed_yn text,price_range number,other_hotel_details text)CREATE TABLE visitors (tourist_id number,tourist_details text)CREATE TABLE tourist_attractions (tourist_attraction_id number,attraction_type_code text,location_id number,how_to_get_there text,name...
SELECT T1.name FROM tourist_attractions AS T1 JOIN visitors AS T2 JOIN visits AS T3 ON T1.tourist_attraction_id = T3.tourist_attraction_id AND T2.tourist_id = T3.tourist_id WHERE T2.tourist_details = "Alison" EXCEPT SELECT T1.name FROM tourist_attractions AS T1 JOIN visitors AS T2 JOIN visits AS T3 ON T1.tourist_attrac...
For those records from the products and each product's manufacturer, a scatter chart shows the correlation between price and revenue .
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 Price, Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code
When Team 1 is Aalborg BK, what is the 1st Leg?
CREATE TABLE table_55591 ("Team 1" text,"Agg." text,"Team 2" text,"1st leg" text,"2nd leg" text)
SELECT "1st leg" FROM table_55591 WHERE "Team 1" = 'aalborg bk'
When did the staff member Janessa Sawayn leave the company?
CREATE TABLE customers (customer_id number,customer_address_id number,customer_status_code text,date_became_customer time,date_of_birth time,first_name text,last_name text,amount_outstanding number,email_address text,phone_number text,cell_mobile_phone_number text)CREATE TABLE customer_payments (customer_id number,date...
SELECT date_left_staff FROM staff WHERE first_name = "Janessa" AND last_name = "Sawayn"
what is the total volume of output patient 002-58565 had?
CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE patient (uniquepid text,patienthealthsystemsta...
SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-58565')) AND intakeoutput.cellpath LIKE '%ou...
What is team 2 if Team 1 is Numancia?
CREATE TABLE table_name_61 (team_2 VARCHAR,team_1 VARCHAR)
SELECT team_2 FROM table_name_61 WHERE team_1 = "numancia"
show me the four year survival rate of patients who were prescribed buminate after they were diagnosed with dementia?
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 SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 4 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid...
For all employees who have the letters D or S in their first name, give me the comparison about the average of department_id over the hire_date bin hire_date by weekday by a bar chart, sort from high to low by the y-axis.
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 employees (EMPLOYEE_ID decimal(6,0),FIRST_NAME varchar(20),LAST_NAME varchar(25),EMAIL varchar(25),PHONE_NUMBER varchar(20),HIRE_DATE date,JO...
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(DEPARTMENT_ID) DESC
When Team 2 was USL Dunkerque (D2), what was the score
CREATE TABLE table_name_75 (score VARCHAR,team_2 VARCHAR)
SELECT score FROM table_name_75 WHERE team_2 = "usl dunkerque (d2)"
Home Team of chicago bulls, and a Result of 81-83 (3-2) involved what game?
CREATE TABLE table_name_33 (game VARCHAR,home_team VARCHAR,result VARCHAR)
SELECT game FROM table_name_33 WHERE home_team = "chicago bulls" AND result = "81-83 (3-2)"
What is Bronze, when Silver is 2, and when Nation is Italy?
CREATE TABLE table_name_20 (bronze VARCHAR,silver VARCHAR,nation VARCHAR)
SELECT bronze FROM table_name_20 WHERE silver = "2" AND nation = "italy"
What the air dates for the episodes are episode 3 in the series?
CREATE TABLE table_70928 ("No. in series" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text)
SELECT "Original air date" FROM table_70928 WHERE "No. in series" > '3'
what is the first score listed ?
CREATE TABLE table_204_130 (id number,"#" number,"date" text,"venue" text,"opponent" text,"score" text,"result" text,"competition" text)
SELECT "score" FROM table_204_130 WHERE id = 1
Total number of downvoted posts.
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostNotices (Id number,PostId number,PostNoticeTypeId number,CreationDate time,D...
SELECT COUNT(*) FROM Posts JOIN Votes ON Votes.PostId = Posts.Id WHERE VoteTypeId = 3
Top Sri Lankans in Stackoverflow.
CREATE TABLE FlagTypes (Id number,Name text,Description text)CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%Sri%' ORDER BY Reputation DESC LIMIT 300
What category was Kasautii Zindagii Kay nominated for after 2005?
CREATE TABLE table_name_20 (category VARCHAR,year VARCHAR,for_the_show VARCHAR)
SELECT category FROM table_name_20 WHERE year > 2005 AND for_the_show = "kasautii zindagii kay"
how many points did leicester city score ?
CREATE TABLE table_203_184 (id number,"tie no" number,"home team" text,"score" text,"away team" text,"attendance" text)
SELECT (SELECT "score" FROM table_203_184 WHERE "home team" = 'leicester city') + (SELECT "score" FROM table_203_184 WHERE "away team" = 'leicester city')
how many patients whose days of hospital stay is greater than 3 and procedure icd9 code is 5451?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE procedures (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug tex...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "3" AND procedures.icd9_code = "5451"
Show the number of accounts for all accounts by the customer with first name 'Meaghan' opened in each day. Bin the account open day by year interval in a bar chart.
CREATE TABLE Financial_Transactions (transaction_id INTEGER,account_id INTEGER,invoice_number INTEGER,transaction_type VARCHAR(15),transaction_date DATETIME,transaction_amount DECIMAL(19,4),transaction_comment VARCHAR(255),other_transaction_details VARCHAR(255))CREATE TABLE Customers (customer_id INTEGER,customer_first...
SELECT date_account_opened, COUNT(date_account_opened) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan'
Find all the ids and dates of the logs for the problem whose id is 10 Plot them as bar chart, display from low to high by the total number.
CREATE TABLE Problem_Status_Codes (problem_status_code VARCHAR(20),problem_status_description VARCHAR(80))CREATE TABLE Product (product_id INTEGER,product_name VARCHAR(80),product_details VARCHAR(255))CREATE TABLE Problem_Log (problem_log_id INTEGER,assigned_to_staff_id INTEGER,problem_id INTEGER,problem_category_code ...
SELECT log_entry_date, problem_log_id FROM Problem_Log WHERE problem_id = 10 ORDER BY problem_log_id
What COSPAR ID has a Launch date/time (UTC) of 1995-11-06, 05:15:01?
CREATE TABLE table_57481 ("Name" text,"Block" text,"Launch date/time (UTC)" text,"COSPAR ID" text,"Rocket" text)
SELECT "COSPAR ID" FROM table_57481 WHERE "Launch date/time (UTC)" = '1995-11-06, 05:15:01'
ground transportation in DENVER
CREATE TABLE code_description (code varchar,description text)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)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,we...
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'DENVER' AND ground_service.city_code = city.city_code
Which player was transferred to Reggina?
CREATE TABLE table_name_99 (player VARCHAR,to_club VARCHAR)
SELECT player FROM table_name_99 WHERE to_club = "reggina"
WHAT IS THE TO PAR WITH T5 PLACE, AND PLAYER MARK MCCUMBER?
CREATE TABLE table_name_68 (to_par VARCHAR,place VARCHAR,player VARCHAR)
SELECT to_par FROM table_name_68 WHERE place = "t5" AND player = "mark mccumber"
Return a histogram on how old is the average person for each job?, rank x axis in descending order.
CREATE TABLE PersonFriend (name varchar(20),friend varchar(20),year INTEGER)CREATE TABLE Person (name varchar(20),age INTEGER,city TEXT,gender TEXT,job TEXT)
SELECT job, AVG(age) FROM Person GROUP BY job ORDER BY job DESC
What days were the rounds of 66-67-70-67 recorded?
CREATE TABLE table_1506950_4 (date VARCHAR,rounds VARCHAR)
SELECT date FROM table_1506950_4 WHERE rounds = "66-67-70-67"
what was the first dose of aspirin given to patient 75762?
CREATE TABLE inputevents_cv (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,amount number)CREATE TABLE admissions (row_id number,subject_id number,hadm_id number,admittime time,dischtime time,admission_type text,admission_location text,discharge_location text,insurance tex...
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 75762) AND prescriptions.drug = 'aspirin' ORDER BY prescriptions.startdate LIMIT 1
how many patients whose ethnicity is white - russian and diagnoses short title is chr tot occlus cor artry?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND diagnoses.short_title = "Chr tot occlus cor artry"
What was the crowd when the home team had a score of 16.21 (117)?
CREATE TABLE table_33002 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text)
SELECT "Crowd" FROM table_33002 WHERE "Home team score" = '16.21 (117)'
For those employees who did not have any job in the past, a scatter chart shows the correlation between salary and department_id .
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 jobs (JOB_ID varchar(10),JOB_TITLE va...
SELECT SALARY, DEPARTMENT_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
What is the result at the Masters for the player who finished R16 at the PGA Ch.?
CREATE TABLE table_1171 ("Nationality" text,"Player" text,"Year" real,"Wins" real,"Masters" text,"U.S. Open" text,"Open Ch." text,"PGA Ch." text)
SELECT "Masters" FROM table_1171 WHERE "PGA Ch." = 'R16'
this year, how many patients were prescribed potassium chloride in the same month after they had a analgesics - narcotic analgesic?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender text,age text,ethnicity text,hospitalid number,wardid number,admissionheight number,admissionweight number,discha...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'analgesics - narcotic analgesic' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_T...
Show all transaction ids with transaction code 'PUR'.
CREATE TABLE TRANSACTIONS (transaction_id VARCHAR,transaction_type_code VARCHAR)
SELECT transaction_id FROM TRANSACTIONS WHERE transaction_type_code = 'PUR'
How many episodes were directed by Ken Fink?
CREATE TABLE table_30088 ("\u2116" real,"#" real,"Title" text,"Directed by" text,"Written by" text,"Original air date" text,"Production code" text,"U.S. viewers (million)" text)
SELECT COUNT("#") FROM table_30088 WHERE "Directed by" = 'Ken Fink'
what are the prices for fat emulsion 20 % iv emul?
CREATE TABLE microlab (microlabid number,patientunitstayid number,culturesite text,organism text,culturetakentime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text...
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'fat emulsion 20 % iv emul')
Who was the candidate when the result - % was 0.4%?
CREATE TABLE table_25818630_2 (candidate VARCHAR,result____percentage VARCHAR)
SELECT candidate FROM table_25818630_2 WHERE result____percentage = "0.4%"
what is maximum days of hospital stay of patients whose year of death is less than 2111?
CREATE TABLE diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title text)CREATE TABLE prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd text,route text,drug_dose text)CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime tex...
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.dod_year < "2111.0"
What was the result for Paris(48-byes) for 3 seed?
CREATE TABLE table_23845 ("Seed" real,"Player" text,"Marseille (32 draw)" text,"Metz (32)" text,"Lyon (32)" text,"Paris (48 - byes)" text)
SELECT "Paris (48 - byes)" FROM table_23845 WHERE "Seed" = '3'
What are the first names of all professors who teach more than one class?
CREATE TABLE department (dept_code text,dept_name text,school_code text,emp_num number,dept_address text,dept_extension text)CREATE TABLE employee (emp_num number,emp_lname text,emp_fname text,emp_initial text,emp_jobcode text,emp_hiredate time,emp_dob time)CREATE TABLE class (class_code text,crs_code text,class_sectio...
SELECT T2.emp_fname FROM class AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING COUNT(*) > 1
Name the number of location attendance for april 24
CREATE TABLE table_17621978_11 (location_attendance VARCHAR,date VARCHAR)
SELECT COUNT(location_attendance) FROM table_17621978_11 WHERE date = "April 24"
What is the largest number lost with 0 draws and less than 12 points for Gwardia Katowice?
CREATE TABLE table_42391 ("Team" text,"Match" real,"Points" real,"Draw" real,"Lost" real)
SELECT MAX("Lost") FROM table_42391 WHERE "Draw" = '0' AND "Team" = 'gwardia katowice' AND "Points" < '12'
Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling.
CREATE TABLE invoices (invoice_number number,order_id number,invoice_date time)CREATE TABLE product_categories (production_type_code text,product_type_description text,vat_rating number)CREATE TABLE order_items (order_item_id number,order_id number,product_id number,product_quantity text,other_order_item_details text)C...
SELECT T1.account_name, T1.other_account_details FROM accounts AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Meaghan" AND T2.customer_last_name = "Keeling"
show me the nonstop flights from NASHVILLE to ST. LOUIS
CREATE TABLE compartment_class (compartment varchar,class_type varchar)CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)CREATE TABLE dual_carrier (main_airline varchar,low_flight_number int,high_flight_number int,dual_airline varchar,service_name text)CREATE TABLE equipment_sequence (aircraft_code_s...
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 = 'NASHVILLE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ST....
Find all invoice dates corresponding to customers with first name Astrid and last name Gruber, and count them by a bar chart, and show from low to high by the y-axis please.
CREATE TABLE Genre (GenreId integer,Name varchar(120))CREATE TABLE Album (AlbumId integer,Title varchar(160),ArtistId integer)CREATE TABLE Invoice (InvoiceId integer,CustomerId integer,InvoiceDate datetime,BillingAddress varchar(70),BillingCity varchar(40),BillingState varchar(40),BillingCountry varchar(40),BillingPost...
SELECT InvoiceDate, COUNT(InvoiceDate) FROM Customer AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "Astrid" AND LastName = "Gruber" ORDER BY COUNT(InvoiceDate)
When the points are less than 65 what is the drop #?
CREATE TABLE table_12049 ("Points" real,"Name" text,"Club" text,"Apps" real,"Tries" real,"Drop" real)
SELECT COUNT("Drop") FROM table_12049 WHERE "Points" < '65'
Which player who weighs 210 plays for the Reno Bighorns?
CREATE TABLE table_42992 ("Pos." text,"Player" text,"Team" text,"Height" text,"Weight" real)
SELECT "Player" FROM table_42992 WHERE "Weight" = '210' AND "Team" = 'reno bighorns'
What are seasons by team for Pro Bowl appearances of the player who was an OL and had 11 appearances?
CREATE TABLE table_274117_5 (seasons_by_team VARCHAR,position VARCHAR,number VARCHAR)
SELECT seasons_by_team FROM table_274117_5 WHERE position = "OL" AND number = 11
Downvotes as more than N% of votes.
CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE ReviewTaskResults (Id number,ReviewTaskId number,ReviewTaskResultTypeId number,CreationDate time,RejectionReasonId number,Comment text)CREATE TABLE ...
SELECT Id AS "user_link", Reputation, UpVotes, DownVotes, (1.0 * DownVotes / (1.0 * UpVotes + 1.0 * DownVotes)) AS PercentDown FROM Users WHERE DownVotes > 0 AND (1.0 * DownVotes / (1.0 * UpVotes + 1.0 * DownVotes)) > @PERCENT / 100.0 AND (UpVotes + DownVotes) > @MIN_VOTES ORDER BY DownVotes DESC
What was the record on April 16?
CREATE TABLE table_name_41 (record VARCHAR,date VARCHAR)
SELECT record FROM table_name_41 WHERE date = "april 16"
what is the average value of the arterial bp mean of patient 739?
CREATE TABLE d_labitems (row_id number,itemid number,label text)CREATE TABLE labevents (row_id number,subject_id number,hadm_id number,itemid number,charttime time,valuenum number,valueuom text)CREATE TABLE d_icd_diagnoses (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE transfers (row_id num...
SELECT AVG(chartevents.valuenum) 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 = 739)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arteri...
For those employees who was hired before 2002-06-21, show me the trend about employee_id over hire_date with a line chart.
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 regions (REGION_ID decimal(5,0),REGION_NAME varchar(25))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID deci...
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE HIRE_DATE < '2002-06-21'
For those records from the products and each product's manufacturer, a bar chart shows the distribution of headquarter and the average of code , and group by attribute headquarter.
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.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter
select id, score from posts order by score desc;.
CREATE TABLE Badges (Id number,UserId number,Name text,Date time,Class number,TagBased boolean)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId...
SELECT Id, Score FROM Posts ORDER BY Score DESC
What party is the delegate of Turner, Frank S. Frank S. Turner of Howard County?
CREATE TABLE table_name_50 (party VARCHAR,counties_represented VARCHAR,delegate VARCHAR)
SELECT party FROM table_name_50 WHERE counties_represented = "howard" AND delegate = "turner, frank s. frank s. turner"
What season had Marcio Lassiter?
CREATE TABLE table_name_97 (season VARCHAR,name VARCHAR)
SELECT season FROM table_name_97 WHERE name = "marcio lassiter"
What is Score, when Attendance is '76', and when Home Team is 'Meir Ka'?
CREATE TABLE table_name_84 (score VARCHAR,attendance VARCHAR,home_team VARCHAR)
SELECT score FROM table_name_84 WHERE attendance = "76" AND home_team = "meir ka"
What is the total amount of grant money given to each organization and what is its id. Show the correlation.
CREATE TABLE Organisations (organisation_id INTEGER,organisation_type VARCHAR(10),organisation_details VARCHAR(255))CREATE TABLE Project_Staff (staff_id DOUBLE,project_id INTEGER,role_code VARCHAR(10),date_from DATETIME,date_to DATETIME,other_details VARCHAR(255))CREATE TABLE Project_Outcomes (project_id INTEGER,outcom...
SELECT SUM(grant_amount), organisation_id FROM Grants GROUP BY organisation_id
What is the total with a 25-19 set 2 on Jun 17?
CREATE TABLE table_40021 ("Date" text,"Score" text,"Set 1" text,"Set 2" text,"Set 3" text,"Set 4" text,"Set 5" text,"Total" text)
SELECT "Total" FROM table_40021 WHERE "Set 2" = '25-19' AND "Date" = 'jun 17'
What are the morning times for the RELIGION 465 course ?
CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE comment_instructor (instructor_id int,student_id int,score int,comment_text varchar)CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE course (course_id int,name varchar,department varchar,numbe...
SELECT DISTINCT course_offering.end_time, course_offering.start_time, semester.semester, semester.year FROM course, course_offering, semester WHERE course_offering.start_time < '12:00:00' AND course_offering.start_time >= '08:00:00' AND course.course_id = course_offering.course_id AND course.department = 'RELIGION' AND...
Score of 4 0 had what attendance number?
CREATE TABLE table_36630 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text)
SELECT COUNT("Attendance") FROM table_36630 WHERE "Score" = '4–0'
How many no outs for an average of 56.38?
CREATE TABLE table_2247 ("Rank" real,"Runs" real,"Player" text,"Matches" real,"Innings" real,"Not Out" real,"Average" text)
SELECT COUNT("Not Out") FROM table_2247 WHERE "Average" = '56.38'
What is the record when Tampa Bay is the visitor?
CREATE TABLE table_69017 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Attendance" real,"Record" text)
SELECT "Record" FROM table_69017 WHERE "Visitor" = 'tampa bay'
Days to Close a Question by Creation Month.
CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,PostId number,RevisionGUID other,CreationDate time,UserId number,UserDisplayName text,Comment text,Text text,ContentLicense text)CREATE TABLE PostTypes (Id number,Na...
SELECT date1, AVG(diff1) AS cnt FROM (SELECT DATEDIFF(day, d.CreationDate, ClosedDate) AS "diff1", FORMAT(d.CreationDate, 'yy-MM') AS "date1", FORMAT(d.ClosedDate, 'yy-MM') AS "date2", (d.Id) AS id FROM Posts AS d LEFT JOIN PostHistory AS ph ON ph.PostId = d.Id LEFT JOIN PostLinks AS pl ON pl.PostId = d.Id LEFT JOIN Po...
Who Has Answered My Questions?.
CREATE TABLE ReviewTasks (Id number,ReviewTaskTypeId number,CreationDate time,DeletionDate time,ReviewTaskStateId number,PostId number,SuggestedEditId number,CompletedByReviewTaskId number)CREATE TABLE Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score n...
SELECT u.Id AS "userid", u.DisplayName AS "name", a.Id AS "post_link" FROM Users AS u INNER JOIN Posts AS a ON a.OwnerUserId = u.Id AND a.PostTypeId = 2 WHERE (a.ParentId IN (SELECT Id FROM Posts WHERE OwnerUserId = @UserId AND PostTypeId = 1)) ORDER BY u.DisplayName
please list flights between SAN FRANCISCO and DENVER
CREATE TABLE flight_leg (flight_id int,leg_number int,leg_flight int)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_m...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = '...
How many flights in each destination city? Return a bar chart.
CREATE TABLE employee (eid number(9,0),name varchar2(30),salary number(10,2))CREATE TABLE certificate (eid number(9,0),aid number(9,0))CREATE TABLE aircraft (aid number(9,0),name varchar2(30),distance number(6,0))CREATE TABLE flight (flno number(4,0),origin varchar2(20),destination varchar2(20),distance number(6,0),dep...
SELECT destination, COUNT(destination) FROM flight GROUP BY destination
What rank has a gold greater than 0, 0 as the bronze, with germany (ger) as the nation?
CREATE TABLE table_63029 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT "Rank" FROM table_63029 WHERE "Gold" > '0' AND "Bronze" = '0' AND "Nation" = 'germany (ger)'
What is the frequency when radio station branding is 106.3 energy fm naga?
CREATE TABLE table_26386 ("Branding" text,"Callsign" text,"Frequency" text,"Power kW" text,"Coverage" text)
SELECT "Frequency" FROM table_26386 WHERE "Branding" = '106.3 Energy FM Naga'
When philippe gilbert is the winner who is the points classification?
CREATE TABLE table_18733814_2 (points_classification VARCHAR,winner VARCHAR)
SELECT points_classification FROM table_18733814_2 WHERE winner = "Philippe Gilbert"
what was the first value of patient 027-136480's laboratory test for alkaline phos. during their current hospital visit?
CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number...
SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-136480' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'alkaline pho...
Which Result has the Event Strikeforce and the Method, Ko (spinning back fist)?
CREATE TABLE table_10882 ("Result" text,"Record" text,"Opponent" text,"Method" text,"Event" text,"Round" real,"Location" text)
SELECT "Result" FROM table_10882 WHERE "Event" = 'strikeforce' AND "Method" = 'ko (spinning back fist)'