instruction
stringlengths
0
1.06k
input
stringlengths
11
5.3k
response
stringlengths
2
4.44k
what is the country for fabiana beltrame?
CREATE TABLE table_name_56 (country VARCHAR,athlete VARCHAR)
SELECT country FROM table_name_56 WHERE athlete = "fabiana beltrame"
Who wrote all the shows with 18.73 u.s. viewers?
CREATE TABLE table_1130632_1 (written_by VARCHAR,us_viewers__million_ VARCHAR)
SELECT written_by FROM table_1130632_1 WHERE us_viewers__million_ = "18.73"
What is the overall record of the Ravens?
CREATE TABLE table_15402 ("School" text,"Team" text,"Division Record" text,"Overall Record" text,"Season Outcome" text)
SELECT "Overall Record" FROM table_15402 WHERE "Team" = 'ravens'
What are the complements when the commander is Major William Lloyd?
CREATE TABLE table_11793221_2 (complement VARCHAR,commander VARCHAR)
SELECT complement FROM table_11793221_2 WHERE commander = "Major William Lloyd"
What is the total number of wickets that have runs under 4600 and matches under 44?
CREATE TABLE table_80053 ("Matches" real,"Wickets" real,"Runs" real,"Average" real,"10WM" real,"Best in Innings" text,"Best in Match" text)
SELECT SUM("Wickets") FROM table_80053 WHERE "Runs" < '4600' AND "Matches" < '44'
tell me the number of patients on base type of drug prescription who have diagnoses icd9 code 1120.
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 demographic (subject_id text,hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "1120" AND prescriptions.drug_type = "BASE"
Show the hours of the day a user is most active. Gets the hours in which a user has been active (enables you to see when a user sleeps!)
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PendingFlags (Id number,FlagTypeId number,PostId number,CreationDate time,CloseReasonTypeId number,CloseAsOffTopicReasonTypeId number,DuplicateOfQuestionId number,BelongsOnBaseHostAddress text)CREATE TABLE PostHistory (Id number,PostHistoryTypeId number,Pos...
WITH hours AS (SELECT TIME_TO_STR(CreationDate, '%I') AS HoursSeen FROM Posts WHERE OwnerUserId = '##UserId##' UNION ALL SELECT TIME_TO_STR(CreationDate, '%I') AS HoursSeen FROM Comments WHERE UserId = '##UserId##') SELECT HoursSeen AS Hour, COUNT(*) AS Count, '|' + REPEAT('*', COUNT(*)) AS Graph FROM hours GROUP BY Ho...
SELECT DATEFROMPARTS ( DATEPART(yyyy, GETDATE()) -1, 1, 1 ).
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 DATEFROMPARTS(TIME_TO_STR(CURRENT_TIMESTAMP(), '%Y'), 1, 1)
how many patients died of septic shock?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "1" AND diagnoses.short_title = "Septic shock"
When the score was 76-73-67-69=285 what was the To par?
CREATE TABLE table_name_31 (to_par VARCHAR,score VARCHAR)
SELECT to_par FROM table_name_31 WHERE score = 76 - 73 - 67 - 69 = 285
Display a bar chart for what is the total revenue of companies started by founder?
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 Founder, SUM(Revenue) FROM Manufacturers GROUP BY Founder
how many days have elapsed since patient 97395 was admitted to the hospital?
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 d_labitems (row_id number,itemid number,label text)CREATE TABLE o...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 97395 AND admissions.dischtime IS NULL
list of ids of patients diagnosed with leukocytosis - neutrophilia until 3 years ago.
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE cost (costid number,uniquepid text,patienthealthsystemstayid number,eventtype text,eventid number,chargetime time,cost number)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname tex...
SELECT patient.uniquepid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'leukocytosis - neutrophilia' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-3 year'))
What label has RTRADLP 346 as catalogue?
CREATE TABLE table_32172 ("Region" text,"Date" text,"Label" text,"Format" text,"Catalogue" text)
SELECT "Label" FROM table_32172 WHERE "Catalogue" = 'rtradlp 346'
Find the number of rooms with more than 50 capacity for each building. Show bar chart.
CREATE TABLE section (course_id varchar(8),sec_id varchar(8),semester varchar(6),year numeric(4,0),building varchar(15),room_number varchar(7),time_slot_id varchar(4))CREATE TABLE student (ID varchar(5),name varchar(20),dept_name varchar(20),tot_cred numeric(3,0))CREATE TABLE prereq (course_id varchar(8),prereq_id varc...
SELECT building, COUNT(*) FROM classroom WHERE capacity > 50 GROUP BY building
For all employees who have the letters D or S in their first name, visualize a bar chart about the distribution of job_id and the sum of salary , and group by attribute job_id, and rank total number in desc 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 countries (COUNTRY_ID varchar(2),...
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(SALARY) DESC
Which province and flag which has a water area (km 2) smaller than 176,928 has a total water area percentage of 0.0%?
CREATE TABLE table_4513 ("Rank" text,"Name and flag" text,"Water area (km 2)" real,"Water area as percentage of total area" text,"Percentage of national freshwater area" text)
SELECT "Name and flag" FROM table_4513 WHERE "Water area (km 2 )" < '176,928' AND "Water area as percentage of total area" = '0.0%'
What was the share (%) for the Semi-Final 2 episode?
CREATE TABLE table_74091 ("Episode" text,"Date" text,"Official ITV1 rating (millions)" text,"Weekly rank" real,"Share (%)" text,"Official ITV1 HD rating (millions)" text,"Total ITV1 viewers (millions)" text)
SELECT "Share (%)" FROM table_74091 WHERE "Episode" = 'Semi-final 2'
what is the number of newborn admitted patients who have lab test item id 51274?
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 demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "NEWBORN" AND lab.itemid = "51274"
How many characters does Maurice Dean Wint play in the movie Cube?
CREATE TABLE table_31091 ("Name" text,"Occupation" text,"Gender" text,"Prison connection" text,"Played by" text,"Status" text)
SELECT COUNT("Status") FROM table_31091 WHERE "Played by" = 'Maurice Dean Wint'
Which Agricultural Panel has a Nominated by the Taoiseach larger than 6, and a Total larger than 60?
CREATE TABLE table_40219 ("Administrative Panel" real,"Agricultural Panel" real,"Cultural and Educational Panel" real,"Industrial and Commercial Panel" real,"Labour Panel" real,"National University of Ireland" real,"University of Dublin" real,"Nominated by the Taoiseach" real,"Total" real)
SELECT SUM("Agricultural Panel") FROM table_40219 WHERE "Nominated by the Taoiseach" > '6' AND "Total" > '60'
What is the name of the event that had a prize of z 1,226,711?
CREATE TABLE table_name_22 (event VARCHAR,prize VARCHAR)
SELECT event FROM table_name_22 WHERE prize = "zł 1,226,711"
What's the listed average of Cuts made that has a Top-5 of 3, and a Top-10 that's smaller than 5?
CREATE TABLE table_62976 ("Tournament" text,"Wins" real,"Top-5" real,"Top-10" real,"Top-25" real,"Events" real,"Cuts made" real)
SELECT AVG("Cuts made") FROM table_62976 WHERE "Top-5" = '3' AND "Top-10" < '5'
For those records from the products and each product's manufacturer, give me the comparison about the sum of price over the name , and group by attribute name by a bar chart.
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 T2.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name
What is the ICAO for Antalya Airport?
CREATE TABLE table_name_86 (icao VARCHAR,airport VARCHAR)
SELECT icao FROM table_name_86 WHERE airport = "antalya airport"
a year before how many patients were prescribed cefazolin 2gm syr within 2 months after being diagnosed with urinary tract infection?
CREATE TABLE medication (medicationid number,patientunitstayid number,drugname text,dosage text,routeadmin text,drugstarttime time,drugstoptime time)CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,syst...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'urinary tract infection' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), '...
Who directed hamateur night?
CREATE TABLE table_66620 ("Title" text,"Series" text,"Director" text,"Production Num." text,"Release date" text)
SELECT "Director" FROM table_66620 WHERE "Title" = 'hamateur night'
What was the host city of the 8th edition in the the host country of Croatia?
CREATE TABLE table_73995 ("Edition" text,"Year" real,"Host city" text,"Host country" text,"Date" text,"No. of athletes" text,"Nations" real)
SELECT "Host city" FROM table_73995 WHERE "Host country" = 'Croatia' AND "Edition" = '8th'
How many customers are living in city 'Lake Geovannyton'?
CREATE TABLE customer_addresses (customer_id number,address_id number,date_address_from time,address_type text,date_address_to time)CREATE TABLE customers (customer_id number,payment_method text,customer_name text,date_became_customer time,other_customer_details text)CREATE TABLE products (product_id number,product_det...
SELECT COUNT(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = "Lake Geovannyton"
what is the average price for each type of product?, I want to display by the x axis in descending.
CREATE TABLE Staff (staff_id INTEGER,staff_gender VARCHAR(1),staff_name VARCHAR(80))CREATE TABLE Addresses (address_id INTEGER,address_details VARCHAR(255))CREATE TABLE Supplier_Addresses (supplier_id INTEGER,address_id INTEGER,date_from DATETIME,date_to DATETIME)CREATE TABLE Department_Store_Chain (dept_store_chain_id...
SELECT product_type_code, AVG(product_price) FROM Products GROUP BY product_type_code ORDER BY product_type_code DESC
What is Rating, when Air Date is 'July 24, 2008*', and when Weekly Winner is 'Sales Rep. Oscar Ledezma'?
CREATE TABLE table_name_7 (rating VARCHAR,air_date VARCHAR,weekly_winner VARCHAR)
SELECT rating FROM table_name_7 WHERE air_date = "july 24, 2008*" AND weekly_winner = "sales rep. oscar ledezma"
Who is the director of the episode titled 'Cheyenne, WY'?
CREATE TABLE table_17758 ("No." real,"#" real,"Title" text,"Directed by" text,"Written by" text,"Bens location" text,"Original air date" text,"U.S. viewers (million)" text)
SELECT "Directed by" FROM table_17758 WHERE "Title" = 'Cheyenne, WY'
What is the lowest influence with population in the millions less than 60.64, and MEPs less than 22, and 454,059 inhabitant per MEP?
CREATE TABLE table_42955 ("Member state" text,"Population millions" real,"MEPs" real,"Inhabitants per MEP" real,"Influence" real)
SELECT MIN("Influence") FROM table_42955 WHERE "Population millions" < '60.64' AND "MEPs" < '22' AND "Inhabitants per MEP" = '454,059'
Which Position has a Competition of european race walking cup?
CREATE TABLE table_47630 ("Year" real,"Competition" text,"Venue" text,"Position" text,"Notes" text)
SELECT "Position" FROM table_47630 WHERE "Competition" = 'european race walking cup'
among patients in the 40s until 2103 what were the top four most frequent diagnoses?
CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE d_items (row_id number,itemid number,label text,linksto t...
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN...
random 's absurd edit summaries (meta only). Any edit summary comment from random that's over 100 characters is sure to be an interesting read.
CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE SuggestedEditVotes (Id number,SuggestedEditId number,UserId number,VoteTypeId number,CreationDate time,TargetUserId number,TargetRepChange number)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE Post...
SELECT a.CreationDate, a.Comment AS "ridiculous_comment" FROM PostHistory AS a WHERE a.PostHistoryTypeId IN (4, 5, 6) AND LENGTH(a.Comment) > 100 ORDER BY a.CreationDate
What is the lowest number of Electorates (2003) in District bhind, Reserved for none, and Constituency Number 11?
CREATE TABLE table_65317 ("Constituency number" text,"Name" text,"Reserved for (SC / ST /None)" text,"District" text,"Number of electorates (2003)" real)
SELECT MIN("Number of electorates (2003)") FROM table_65317 WHERE "District" = 'bhind' AND "Reserved for ( SC / ST /None)" = 'none' AND "Constituency number" = '11'
What is the name of the incumbent who was first eleccted in 1940?
CREATE TABLE table_18390 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text)
SELECT "Incumbent" FROM table_18390 WHERE "First elected" = '1940'
provide the number of patients whose year of birth is less than 2098 and drug code is syringens?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2098" AND prescriptions.formulary_drug_cd = "SYRINGENS"
Name the least amount of losses for 23 points
CREATE TABLE table_18703133_1 (losses INTEGER,points VARCHAR)
SELECT MIN(losses) FROM table_18703133_1 WHERE points = 23
what is the number of patients that were admitted to the hospital in this year?
CREATE TABLE diagnoses_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE patients (row_id number,subject_id number,gender text,dob time,dod time)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value num...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
Find the contact channel code that was used by the customer named 'Tillman Ernser'.
CREATE TABLE customers (customer_id number,payment_method text,customer_name text,date_became_customer time,other_customer_details text)CREATE TABLE products (product_id number,product_details text)CREATE TABLE order_items (order_id number,product_id number,order_quantity text)CREATE TABLE customer_addresses (customer_...
SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = "Tillman Ernser"
provide the number of patients whose age is less than 81 and days of hospital stay is greater than 11?
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 WHERE demographic.age < "81" AND demographic.days_stay > "11"
Which years have a Decile of 4, an Authority of state, and a Name of mapiu school?
CREATE TABLE table_69858 ("Name" text,"Years" text,"Gender" text,"Area" text,"Authority" text,"Decile" real,"Roll" real)
SELECT "Years" FROM table_69858 WHERE "Decile" = '4' AND "Authority" = 'state' AND "Name" = 'mapiu school'
what was the date of the last free choice performance ?
CREATE TABLE table_204_889 (id number,"date" text,"week (stage)" text,"song choice" text,"original artist" text,"theme" text,"result" text)
SELECT "date" FROM table_204_889 WHERE "theme" = 'free choice' ORDER BY "date" DESC LIMIT 1
Who is the incumbent for the Oregon 5 District that was elected in 1996?
CREATE TABLE table_79149 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Results" text)
SELECT "Incumbent" FROM table_79149 WHERE "First elected" = '1996' AND "District" = 'oregon 5'
How many l's are there for the skip with 3 for w?
CREATE TABLE table_25714995_2 (l INTEGER,w VARCHAR)
SELECT MAX(l) FROM table_25714995_2 WHERE w = 3
How many ranks are for Switzerland with more than 2 total medals?
CREATE TABLE table_71628 ("Rank" real,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT COUNT("Rank") FROM table_71628 WHERE "Nation" = 'switzerland' AND "Total" > '2'
Homework and non-homework tagged question counts.
CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDate time,ApprovalModeratorId number,DeactivationDat...
SELECT Date, COALESCE(SUM(Homework), 0) AS "Homework", COALESCE(SUM(NotHomework), 0) AS "NotHomework" FROM (SELECT CAST(TIME_TO_STR(p.CreationDate, '%Y.%m.%d') AS TEXT(30)) AS "Date", COUNT(*) AS Homework, NULL AS NotHomework FROM Posts AS p WHERE COALESCE(STR_POSITION(p.Tags, 'homework'), 0) != 0 AND p.PostTypeId = 1 ...
What is the sum of time with a lane larger than 6, a nationality of canada, and the react smaller than 0.151?
CREATE TABLE table_name_70 (time INTEGER,react VARCHAR,lane VARCHAR,nationality VARCHAR)
SELECT SUM(time) FROM table_name_70 WHERE lane > 6 AND nationality = "canada" AND react < 0.151
What is Content, when Package/Option is sky cinema, and when Language is italian originale?
CREATE TABLE table_7182 ("Television service" text,"Country" text,"Language" text,"Content" text,"HDTV" text,"Package/Option" text)
SELECT "Content" FROM table_7182 WHERE "Package/Option" = 'sky cinema' AND "Language" = 'italian originale'
Return the party email that has used party services the greatest number of times.
CREATE TABLE addresses (address_id number,line_1_number_building text,town_city text,zip_postcode text,state_province_county text,country text)CREATE TABLE individuals (individual_id number,individual_first_name text,individual_middle_name text,inidividual_phone text,individual_email text,individual_address text,indivi...
SELECT t1.party_email FROM parties AS t1 JOIN party_services AS t2 ON t1.party_id = t2.customer_id GROUP BY t1.party_email ORDER BY COUNT(*) DESC LIMIT 1
what is the rank for the rating 4.4?
CREATE TABLE table_20257 ("#" real,"Episode" text,"Rating" text,"Share" real,"Rating/Share (18-49)" text,"Viewers (millions)" text,"Rank (Timeslot)" text,"Rank (Night)" text,"Rank (Week)" text)
SELECT "Rank (Night)" FROM table_20257 WHERE "Rating" = '4.4'
What is the American Labor ticket when Henry Epstein is the liberal ticket?
CREATE TABLE table_40325 ("Office" text,"Republican ticket" text,"Democratic ticket" text,"American Labor ticket" text,"Liberal ticket" text,"Communist ticket" text)
SELECT "American Labor ticket" FROM table_40325 WHERE "Liberal ticket" = 'henry epstein'
Who is the driver of the entry constructed by Mercedes-Benz?
CREATE TABLE table_1972 ("Year" real,"Formula" text,"Driver" text,"Constructor" text,"Location" text,"Report" text)
SELECT "Driver" FROM table_1972 WHERE "Constructor" = 'Mercedes-Benz'
What is the largest number of gold medals when the bronze medals is less than 49, and there is 22 silver medals, and the total is less than 60?
CREATE TABLE table_58926 ("Rank" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real)
SELECT MAX("Gold") FROM table_58926 WHERE "Bronze" < '49' AND "Silver" = '22' AND "Total" < '60'
Name the score for rick leach zina garrison
CREATE TABLE table_1547951_3 (score VARCHAR,opponents VARCHAR)
SELECT score FROM table_1547951_3 WHERE opponents = "Rick Leach Zina Garrison"
hosei won in 1964 . who won the next year ?
CREATE TABLE table_204_19 (id number,"university" text,"winner" number,"runner-up" number,"years won" text,"years runner-up" text)
SELECT "university" FROM table_204_19 WHERE "years won" = 1964 + 1
What classes at the 300 -level are offered next semester ?
CREATE TABLE gsi (course_offering_id int,student_id int)CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE instructor (instructor_id int,name varchar,uniqname varchar)CREATE TABLE semester (semester_id int,semester varchar,year int)CREATE TABLE requirement (requirement_id int,requirement var...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 300 AND 300 + 100 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester...
calculate the two year survival probability among the patients who were prescribed dobutamine after they were diagnosed with retropharyngeal abscess.
CREATE TABLE labevents (row_id number,subject_id number,hadm_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,intime time,outtime time...
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd...
how many female patients stayed in hospital for more than 7 days and have undergone the procedure other partial resection of small intestine?
CREATE TABLE lab (subject_id text,hadm_id text,itemid text,charttime text,flag text,value_unit text,label text,fluid text)CREATE TABLE demographic (subject_id text,hadm_id text,name text,marital_status text,age text,dob text,gender text,language text,religion text,admission_type text,days_stay text,insurance text,ethni...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "7" AND procedures.long_title = "Other partial resection of small intestine"
With a Rank of less than 4, what is Pablo Prigioni's total number of Games?
CREATE TABLE table_43051 ("Rank" real,"Name" text,"Team" text,"Games" real,"Assists" real)
SELECT COUNT("Games") FROM table_43051 WHERE "Name" = 'pablo prigioni' AND "Rank" < '4'
What average year contains the title of machineries of joy vol. 4?
CREATE TABLE table_name_54 (year INTEGER,title VARCHAR)
SELECT AVG(year) FROM table_name_54 WHERE title = "machineries of joy vol. 4"
Which match was played on April 2, 2006?
CREATE TABLE table_name_78 (competition VARCHAR,date VARCHAR)
SELECT competition FROM table_name_78 WHERE date = "april 2, 2006"
What does a hand of Theoretical return have as a 3 credit?
CREATE TABLE table_name_34 (hand VARCHAR)
SELECT 3 AS _credits FROM table_name_34 WHERE hand = "theoretical return"
what was the ranking in each november game ?
CREATE TABLE table_204_617 (id number,"date" text,"opponent#" text,"rank#" text,"site" text,"tv" text,"result" text,"attendance" number)
SELECT "rank#" FROM table_204_617 WHERE "date" = 11
What episode in the series was the Amaral family featured?
CREATE TABLE table_19897294_11 (no_in_series VARCHAR,family_families VARCHAR)
SELECT no_in_series FROM table_19897294_11 WHERE family_families = "The Amaral Family"
did patient 24118 have any procedure?
CREATE TABLE microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE cost (row_id number,subject_id number,hadm_i...
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24118)
What rank was the team from Australia?
CREATE TABLE table_name_77 (rank VARCHAR,country VARCHAR)
SELECT COUNT(rank) FROM table_name_77 WHERE country = "australia"
What is the format for UK catalog S 63795?
CREATE TABLE table_12903 ("Date" text,"Label" text,"Format" text,"Country" text,"Catalog" text)
SELECT "Format" FROM table_12903 WHERE "Country" = 'uk' AND "Catalog" = 's 63795'
What was the score on February 14, 1999?
CREATE TABLE table_name_32 (score_in_final VARCHAR,date VARCHAR)
SELECT score_in_final FROM table_name_32 WHERE date = "february 14, 1999"
What district has an assembly segment named mahidpur?
CREATE TABLE table_66539 ("Constituency number" text,"Name" text,"Reserved for (SC / ST /None)" text,"District" text,"Number of electorates (2009)" real)
SELECT "District" FROM table_66539 WHERE "Name" = 'mahidpur'
what is the minimum total cost of the hospital, which includes medicines called albuterol until 4 years ago?
CREATE TABLE vitalperiodic (vitalperiodicid number,patientunitstayid number,temperature number,sao2 number,heartrate number,respiration number,systemicsystolic number,systemicdiastolic number,systemicmean number,observationtime time)CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyna...
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'albuterol')) AND DATETIME(cost.chargetime) <= ...
Top 100 perfis mais visitados.
CREATE TABLE PostHistoryTypes (Id number,Name text)CREATE TABLE CloseReasonTypes (Id number,Name text,Description text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE Tags (Id number,TagName text,Count number,ExcerptPostId number,WikiPostId number)CREATE TABLE FlagTypes (Id number,Name text,Description t...
SELECT Id AS "user_link", Views FROM Users LIMIT 100
What Constructor had 66 Laps?
CREATE TABLE table_52756 ("Driver" text,"Constructor" text,"Laps" real,"Time/Retired" text,"Grid" real)
SELECT "Constructor" FROM table_52756 WHERE "Laps" = '66'
Show the name of the customer who has the most orders.
CREATE TABLE customer_orders (order_id number,customer_id number,order_date time,order_status_code text)CREATE TABLE addresses (address_id number,line_1_number_building text,city text,zip_postcode text,state_province_county text,country text)CREATE TABLE customer_address_history (customer_id number,address_id number,da...
SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC LIMIT 1
What was the 2007 result in the 28th district?
CREATE TABLE table_837 ("District" text,"Incumbent" text,"Party" text,"Elected" real,"Status" text,"2007 Result" text)
SELECT "2007 Result" FROM table_837 WHERE "District" = '28th'
What is the lowest numbered lane of Sue Rolph with a rank under 5?
CREATE TABLE table_name_17 (lane INTEGER,name VARCHAR,rank VARCHAR)
SELECT MIN(lane) FROM table_name_17 WHERE name = "sue rolph" AND rank < 5
How many hours do the students spend studying in each department. Plot them as bar chart.
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 STUDENT (STU_NUM int,STU_LNAME varchar(15),STU_FNAME varcha...
SELECT DEPT_CODE, SUM(STU_HRS) FROM STUDENT GROUP BY DEPT_CODE
What is the score of the game with Falkirk as the runner-up?
CREATE TABLE table_name_48 (score VARCHAR,runner_up VARCHAR)
SELECT score FROM table_name_48 WHERE runner_up = "falkirk"
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of hire_date and the sum of employee_id bin hire_date by weekday.
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 countries (COUNTRY_ID varchar(2),COUN...
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
What is the number of laps for Grid 3?
CREATE TABLE table_67301 ("Driver" text,"Constructor" text,"Laps" text,"Time/Retired" text,"Grid" text)
SELECT "Laps" FROM table_67301 WHERE "Grid" = '3'
what is the number of patients who died after diagnosis of anemia during the same month last year?
CREATE TABLE lab (labid number,patientunitstayid number,labname text,labresult number,labresulttime time)CREATE TABLE diagnosis (diagnosisid number,patientunitstayid number,diagnosisname text,diagnosistime time,icd9code text)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmen...
SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'anemia') AS t1 GROUP BY t1.uniquepid HAVING MIN(t1.diagnosistime...
Which city and state hosted the adelaide street circuit?
CREATE TABLE table_28956 ("Rd." text,"Circuit" text,"City / State" text,"Date" text,"Championship" text,"Challenge" text,"Production" text)
SELECT "City / State" FROM table_28956 WHERE "Circuit" = 'Adelaide Street Circuit'
What is the average in 2010 of the team with a code of (IATA/ICAO) or cra/lrcv?
CREATE TABLE table_67116 ("Rank" real,"Airport" text,"City" text,"Code (IATA/ICAO)" text,"2008" real,"2009" real,"2010" real)
SELECT "2010" FROM table_67116 WHERE "Code (IATA/ICAO)" = 'cra/lrcv'
Name the home with toronto visiting
CREATE TABLE table_75176 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Record" text)
SELECT "Home" FROM table_75176 WHERE "Visitor" = 'toronto'
Which operators offer a genre of music?
CREATE TABLE table_22303 ("Frequency (in Kuala Lumpur,Selangor,Putrajaya and environs)" text,"Station" text,"Operator" text,"Language" text,"Genre" text,"Coverage Area" text)
SELECT "Operator" FROM table_22303 WHERE "Genre" = 'music'
What is the release date of I Wanna Play House?
CREATE TABLE table_63757 ("Title" text,"Series" text,"Director" text,"Production Num." text,"Release date" text)
SELECT "Release date" FROM table_63757 WHERE "Title" = 'i wanna play house'
How many kids stay in the rooms reserved by ROY SWEAZY?
CREATE TABLE reservations (code number,room text,checkin text,checkout text,rate number,lastname text,firstname text,adults number,kids number)CREATE TABLE rooms (roomid text,roomname text,beds number,bedtype text,maxoccupancy number,baseprice number,decor text)
SELECT kids FROM reservations WHERE firstname = "ROY" AND lastname = "SWEAZY"
show me FIRST class flights from PITTSBURGH to SAN FRANCISCO on friday
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 airport_service (city_code ...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis AS FARE_BASIS_0, fare_basis AS FARE_BASIS_1, flight, flight_fare WHERE ((DATE...
tell me the birth date of patient 366?
CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,wardid number,intime time,outtime time)CREATE TABLE d_items (row_id number,itemid number,label text,linksto text)CREATE TABLE chartevents (row_id number,subject_id number,hadm_id number,icustay_id numbe...
SELECT patients.dob FROM patients WHERE patients.subject_id = 366
Total and average number of votes per question and answer.
CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModeratorId number,ApprovalDate time,ApprovalModeratorId number,DeactivationDat...
SELECT CASE p.PostTypeId WHEN 1 THEN 'Questions' ELSE 'Answers' END, CASE v.VoteTypeId WHEN 2 THEN 'Up' ELSE 'Down' END, COUNT(*) FROM Votes AS v INNER JOIN Posts AS p ON v.PostId = p.Id WHERE v.VoteTypeId IN (2, 3) GROUP BY p.PostTypeId, v.VoteTypeId
What is the total round when DB was the position, and the pick less than 21, and Jeff Welch as the name?
CREATE TABLE table_name_95 (round INTEGER,pick VARCHAR,position VARCHAR,name VARCHAR)
SELECT SUM(round) FROM table_name_95 WHERE position = "db" AND name = "jeff welch" AND pick < 21
Tell me the 2011 with 2012 of 2r
CREATE TABLE table_name_40 (Id VARCHAR)
SELECT 2011 FROM table_name_40 WHERE 2012 = "2r" AND 2010 = "2r" AND 2009 = "2r"
What date was the record 34-41?
CREATE TABLE table_68522 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Record" text)
SELECT "Date" FROM table_68522 WHERE "Record" = '34-41'
What was the result when the method was submission (kimura)?
CREATE TABLE table_name_72 (res VARCHAR,method VARCHAR)
SELECT res FROM table_name_72 WHERE method = "submission (kimura)"
What is the constituency number with a reserved for ( SC / ST /None) of none, for Katol?
CREATE TABLE table_12611 ("Constituency number" text,"Name" text,"Reserved for (SC / ST /None)" text,"District" text,"Number of electorates (2009)" real)
SELECT "Constituency number" FROM table_12611 WHERE "Reserved for ( SC / ST /None)" = 'none' AND "Name" = 'katol'
which party has had the most leaders ?
CREATE TABLE table_201_25 (id number,"party" text,"leader" text,"from" text,"to" text)
SELECT "party" FROM table_201_25 GROUP BY "party" ORDER BY COUNT("leader") DESC LIMIT 1
What 's the name of the teacher for Winter Core course ?
CREATE TABLE course_prerequisite (pre_course_id int,course_id int)CREATE TABLE area (course_id int,area varchar)CREATE TABLE offering_instructor (offering_instructor_id int,offering_id int,instructor_id int)CREATE TABLE student (student_id int,lastname varchar,firstname varchar,program_id int,declare_major varchar,tota...
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instr...
what is the average top-10 when the cuts made is less than 9 and the events is more than 14?
CREATE TABLE table_76400 ("Tournament" text,"Wins" real,"Top-5" real,"Top-10" real,"Top-25" real,"Events" real,"Cuts made" real)
SELECT AVG("Top-10") FROM table_76400 WHERE "Cuts made" < '9' AND "Events" > '14'