table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ...
Unanswered questions tagged with Visio (but not 'vision').
WITH TargetTags AS (SELECT Tags.Id FROM Tags WHERE Tags.TagName LIKE '%visio%' AND NOT Tags.TagName LIKE '%vision%') SELECT Posts.Tags, Posts.Id, 'http://stackoverflow.com/questions/' + REPLACE(STR(Posts.Id), ' ', '') AS PostURL, Posts.Title, Posts.OwnerDisplayName, Posts.CreationDate, Posts.Body FROM Posts INNER JOIN ...
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 )
How old is the average person for each job Show bar chart, and rank total number from high to low order.
SELECT job, AVG(age) FROM Person GROUP BY job ORDER BY AVG(age) DESC
CREATE TABLE table_68061 ( "Goal #" real, "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
Name the score for 30 january 2013
SELECT "Score" FROM table_68061 WHERE "Date" = '30 january 2013'
CREATE TABLE table_name_50 ( original_name VARCHAR, location VARCHAR )
What was the original name of the restaurant located in Orillia, ON?
SELECT original_name FROM table_name_50 WHERE location = "orillia, on"
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, sy...
what were the top three procedures for patients 20s?
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 3
CREATE TABLE film ( Film_ID int, Rank_in_series int, Number_in_season int, Title text, Directed_by text, Original_air_date text, Production_code text ) CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) CREATE TABLE cine...
Give me a pie to show the total number from different directed by.
SELECT Directed_by, COUNT(*) FROM film GROUP BY Directed_by
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, ...
among patients who were prescribed with warfarin, what are the four most frequently prescribed drugs at the same time, in the last year?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'warfarin' AND DATETIME(prescriptions.startdate, 'start of year') ...
CREATE TABLE table_name_57 ( wins VARCHAR, top_5 VARCHAR, top_10 VARCHAR, cuts_made VARCHAR )
How many Wins have a Top-10 smaller than 6, and Cuts made larger than 7, and a Top-5 of 0?
SELECT COUNT(wins) FROM table_name_57 WHERE top_10 < 6 AND cuts_made > 7 AND top_5 = 0
CREATE TABLE Allergy_type ( allergy VARCHAR )
How many allergies are there?
SELECT COUNT(DISTINCT allergy) FROM Allergy_type
CREATE TABLE table_name_17 ( group_b VARCHAR, group_e VARCHAR )
What is the group B region with a Group E region of Georgia?
SELECT group_b FROM table_name_17 WHERE group_e = "georgia"
CREATE TABLE stock ( Shop_ID VARCHAR, quantity INTEGER ) CREATE TABLE shop ( Shop_Name VARCHAR, Shop_ID VARCHAR )
Show the name of the shop that have the largest quantity of devices in stock.
SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID ORDER BY SUM(T1.quantity) DESC LIMIT 1
CREATE TABLE table_name_14 ( record VARCHAR, event VARCHAR )
What is the record during the event, UFC 27?
SELECT record FROM table_name_14 WHERE event = "ufc 27"
CREATE TABLE reviewer ( rid number, name text ) CREATE TABLE rating ( rid number, mid number, stars number, ratingdate time ) CREATE TABLE movie ( mid number, title text, year number, director text )
Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year.
SELECT DISTINCT year FROM movie AS T1 JOIN rating AS T2 ON T1.mid = T2.mid WHERE T2.stars >= 4 ORDER BY T1.year
CREATE TABLE table_62466 ( "Parish (Prestegjeld)" text, "Sub-Parish (Sokn)" text, "Church Name" text, "Year Built" text, "Location of the Church" text )
In which Parish (Prestegjeld) is the church called Stavang Kyrkje?
SELECT "Parish (Prestegjeld)" FROM table_62466 WHERE "Church Name" = 'stavang kyrkje'
CREATE TABLE elimination ( elimination_id text, wrestler_id text, team text, eliminated_by text, elimination_move text, time text ) CREATE TABLE wrestler ( wrestler_id number, name text, reign text, days_held text, location text, event text )
How many wrestlers are there?
SELECT COUNT(*) FROM wrestler
CREATE TABLE table_68155 ( "Place" text, "Name" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real )
What place in the United States has a To par of e?
SELECT "Place" FROM table_68155 WHERE "Country" = 'united states' AND "To par" = 'e'
CREATE TABLE table_1397655_1 ( year_acquired INTEGER, station VARCHAR )
how many is the minimum for citv
SELECT MIN(year_acquired) FROM table_1397655_1 WHERE station = "CITV"
CREATE TABLE table_name_64 ( lane INTEGER, react VARCHAR, nationality VARCHAR )
what is the lowest lane when react is more than 0.164 and the nationality is guinea?
SELECT MIN(lane) FROM table_name_64 WHERE react > 0.164 AND nationality = "guinea"
CREATE TABLE jobs ( job_id text, job_title text, min_salary number, max_salary number ) CREATE TABLE regions ( region_id number, region_name text ) CREATE TABLE countries ( country_id text, country_name text, region_id number ) CREATE TABLE employees ( employee_id number, ...
Display the first name, and department number for all employees whose last name is 'McEwen'.
SELECT first_name, department_id FROM employees WHERE last_name = 'McEwen'
CREATE TABLE table_36717 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Game Site" text, "Attendance" text )
What is the record of the game before week 5 and a bye game site?
SELECT "Record" FROM table_36717 WHERE "Week" < '5' AND "Game Site" = 'bye'
CREATE TABLE table_name_40 ( coaster_name VARCHAR, year_opened VARCHAR, track VARCHAR )
What is the coaster name that was opened in 1978, and have wooden track?
SELECT coaster_name FROM table_name_40 WHERE year_opened = "1978" AND track = "wooden"
CREATE TABLE table_31749 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
Which stadium can hold 63,443 people?
SELECT "Result" FROM table_31749 WHERE "Attendance" = '63,443'
CREATE TABLE table_13636_1 ( first_operational VARCHAR, programming VARCHAR )
what's the first operational with programming being not programmable single purpose
SELECT first_operational FROM table_13636_1 WHERE programming = "Not programmable—single purpose"
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 t...
count the number of patients whose days of hospital stay is greater than 5 and lab test name is iron?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "5" AND lab.label = "Iron"
CREATE TABLE Claims ( Claim_ID INTEGER, Policy_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER ) CREATE TABLE Settlements ( Settlement_ID INTEGER, Claim_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amoun...
Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date, and count them by a bar chart, and rank y axis from low to high order.
SELECT Date_Claim_Made, COUNT(Date_Claim_Made) FROM Claims WHERE Amount_Settled <= (SELECT AVG(Amount_Settled) FROM Claims) ORDER BY COUNT(Date_Claim_Made)
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, ...
this year, what are the top five most common medications prescribed to patients in the same hospital visit after the prescription of d5 1/2ns?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate, admissions.hadm_id FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'd5 1/2ns' AND DATETIME(prescriptions.startdat...
CREATE TABLE table_2472711_32 ( average INTEGER, total VARCHAR )
What is the maximum average associated with a total of 221902?
SELECT MAX(average) FROM table_2472711_32 WHERE total = 221902
CREATE TABLE table_name_14 ( chassis VARCHAR, driver VARCHAR, tyre VARCHAR, engine_† VARCHAR )
what is the chassis when the tyre is b, the engine is ferrari 050 ferrari 051 and the driver is rubens barrichello?
SELECT chassis FROM table_name_14 WHERE tyre = "b" AND engine_† = "ferrari 050 ferrari 051" AND driver = "rubens barrichello"
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, Last...
Count of posts by month. Simple count of posts by month
SELECT (TIME_TO_STR(p.CreationDate, '%Y') * 12) + TIME_TO_STR(p.CreationDate, '%m') AS yearmonth, COUNT(*) AS postcount FROM Posts AS p GROUP BY TIME_TO_STR(p.CreationDate, '%Y'), TIME_TO_STR(p.CreationDate, '%m') ORDER BY TIME_TO_STR(p.CreationDate, '%Y'), TIME_TO_STR(p.CreationDate, '%m')
CREATE TABLE table_1053802_1 ( winners VARCHAR, local_title VARCHAR )
How many winners are there of farma?
SELECT COUNT(winners) FROM table_1053802_1 WHERE local_title = "Farma"
CREATE TABLE table_name_70 ( money___$__ VARCHAR, score VARCHAR )
What is the Money of the Player with a Score of 69-71-69-72=281?
SELECT money___$__ FROM table_name_70 WHERE score = 69 - 71 - 69 - 72 = 281
CREATE TABLE table_name_79 ( year INTEGER, college_country VARCHAR )
What is the earliest year a Baylor player made the list?
SELECT MIN(year) FROM table_name_79 WHERE college_country = "baylor"
CREATE TABLE table_35593 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What team did the Heat play against at the TD Waterhouse Centre?
SELECT "Team" FROM table_35593 WHERE "Location Attendance" = 'td waterhouse centre'
CREATE TABLE table_12155 ( "Draft" real, "Round" text, "Pick" real, "Player" text, "Nationality" text )
What is the lowest Pick, when Draft is less than 1991, and when Player is 'Tom Sasso Category:Articles with hCards'?
SELECT MIN("Pick") FROM table_12155 WHERE "Draft" < '1991' AND "Player" = 'tom sasso category:articles with hcards'
CREATE TABLE bridge ( architect_id int, id int, name text, location text, length_meters real, length_feet real ) CREATE TABLE architect ( id text, name text, nationality text, gender text ) CREATE TABLE mill ( architect_id int, id int, location text, name text, ...
Pie chart. what are the ids and names of the architects who built at least 3 bridges ?
SELECT T1.name, T1.id FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id
CREATE TABLE table_9805 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text )
What was the margin of victory when the runner-up was Janet Coles?
SELECT "Margin of victory" FROM table_9805 WHERE "Runner(s)-up" = 'janet coles'
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugst...
has patient 021-95970 had any allergies in their current hospital visit?
SELECT COUNT(*) > 0 FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-95970' AND patient.hospitaldischargetime IS NULL))
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 locations ( LOCATIO...
Please show me how many employees working on different countries using a bar chart, and could you display from low to high by the x axis please?
SELECT COUNTRY_NAME, COUNT(COUNTRY_NAME) FROM countries GROUP BY COUNTRY_NAME ORDER BY COUNTRY_NAME
CREATE TABLE table_38613 ( "Home (1st leg)" text, "Home (2nd leg)" text, "1st Leg" text, "2nd leg" text, "Aggregate" text )
What was the 2nd leg score having an aggregate score of 4-2?
SELECT "2nd leg" FROM table_38613 WHERE "Aggregate" = '4-2'
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 t...
what is the maximum age of the patients whose marital status is single and were born after 2095?
SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.dob_year > "2095"
CREATE TABLE club ( clublocation VARCHAR, clubname VARCHAR )
Where is the club 'Hopkins Student Enterprises' located?
SELECT clublocation FROM club WHERE clubname = "Hopkins Student Enterprises"
CREATE TABLE table_train_109 ( "id" int, "serum_potassium" float, "systolic_blood_pressure_sbp" int, "body_mass_index_bmi" float, "hypertension" bool, "NOUSE" float )
systolic bp >= 170 mmhg
SELECT * FROM table_train_109 WHERE systolic_blood_pressure_sbp >= 170
CREATE TABLE table_24172157_3 ( team VARCHAR, incoming_manager VARCHAR )
What team has an incoming manager named Kenny Dalglish?
SELECT team FROM table_24172157_3 WHERE incoming_manager = "Kenny Dalglish"
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE days ( days_code varchar, ...
morning flights out of SAN FRANCISCO arriving BOSTON afternoon
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (((flight.arrival_time <= 1800 AND flight.arrival_time >= 1200) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.to_...
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Badges...
Obtaining closed questions on Worldbuilding Meta.
SELECT * FROM Posts WHERE NOT ClosedDate IS NULL
CREATE TABLE table_13394 ( "Rank" real, "Name" text, "1st run" text, "2nd run" text, "3rd run" text, "Total" real )
Who had a 2nd run of 39.296 (5)?
SELECT "Name" FROM table_13394 WHERE "2nd run" = '39.296 (5)'
CREATE TABLE table_40513 ( "Date" real, "Doubles, I Class" real, "Doubles, II Class" real, "Greater Doubles" real, "Doubles" real, "Semidoubles" real, "Total" real )
What is the lowest Greater Doubles, when Doubles, I Class is 23, and when Doubles, II Class is less than 27?
SELECT MIN("Greater Doubles") FROM table_40513 WHERE "Doubles, I Class" = '23' AND "Doubles, II Class" < '27'
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE patients ( ...
has patient 25628 received a albumin lab in 01/this year?
SELECT COUNT(*) > 0 FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'albumin') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25628) AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME()...
CREATE TABLE table_3780 ( "Game" real, "January" real, "Opponent" text, "Score" text, "Decision" text, "Location/Attendance" text, "Record" text )
If the opponent was the Philadelphia flyers, what was the record?
SELECT "Record" FROM table_3780 WHERE "Opponent" = 'Philadelphia Flyers'
CREATE TABLE table_name_96 ( opponent VARCHAR, tv_time VARCHAR )
Which opponent had a bye for the TV Time?
SELECT opponent FROM table_name_96 WHERE tv_time = "bye"
CREATE TABLE table_16799784_11 ( latitude VARCHAR, name VARCHAR )
At what latitude can the name origin of naijok fossae be found?
SELECT latitude FROM table_16799784_11 WHERE name = "Naijok Fossae"
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 patients ( row_id number, subject_id number, gender text, dob time, dod time ) CR...
what is the four event that is frequent in the output?
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT outputevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM outputevents GROUP BY outputevents.itemid) AS t1 WHERE t1.c1 <= 4)
CREATE TABLE table_203_58 ( id number, "airline" text, "airline (in russian)" text, "licence #" number, "icao" text, "iata" text, "domestic code" text, "callsign" text, "photo" text )
which airline has air sakha as its call sign ?
SELECT "airline" FROM table_203_58 WHERE "callsign" = 'air sakha'
CREATE TABLE table_502 ( "Season" text, "Competition" text, "Round" text, "Club" text, "1st leg" text, "2nd leg" text, "Aggregate" text )
What is the competition when 2nd leg is 0 8?
SELECT "Competition" FROM table_502 WHERE "2nd leg" = '0–8'
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 t...
what is admission location and primary disease of subject id 18480?
SELECT demographic.admission_location, demographic.diagnosis FROM demographic WHERE demographic.subject_id = "18480"
CREATE TABLE table_name_75 ( drawn VARCHAR, goals_against VARCHAR, lost VARCHAR )
What is the total number drawn with goals against less than 55, and a total of 14 losses?
SELECT COUNT(drawn) FROM table_name_75 WHERE goals_against < 55 AND lost = 14
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellv...
what is first weight of patient 027-120551 since 90 months ago.
SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-120551') AND NOT patient.admissionweight IS NULL AND DATETIME(patient.unitadmittime) >= DATETIME(CURRENT_TIME(), '-90 month') ORDER BY patient.unit...
CREATE TABLE table_name_40 ( week INTEGER, date VARCHAR )
What is the latest week with the date of november 5, 1995?
SELECT MAX(week) FROM table_name_40 WHERE date = "november 5, 1995"
CREATE TABLE table_14240688_1 ( playoffs VARCHAR, open_cup VARCHAR )
Name the playoffs for 2nd round open cup
SELECT playoffs FROM table_14240688_1 WHERE open_cup = "2nd Round"
CREATE TABLE table_name_46 ( constructor VARCHAR, winning_driver VARCHAR, race VARCHAR )
What was the constructor when Jack Brabham was the driver at the Monaco Grand Prix?
SELECT constructor FROM table_name_46 WHERE winning_driver = "jack brabham" AND race = "monaco grand prix"
CREATE TABLE table_22148 ( "English name" text, "Thai name" text, "Transcription" text, "Color" text, "Sanskrit word" text, "Planet" text )
Which planet has the transcription of wan suk?
SELECT "Planet" FROM table_22148 WHERE "Transcription" = 'wan suk'
CREATE TABLE table_4359 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
What is the average week on November 7, 1976 with an attendance less than 46,735?
SELECT AVG("Week") FROM table_4359 WHERE "Date" = 'november 7, 1976' AND "Attendance" < '46,735'
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_...
how many patients since 1 year ago received opn aortic valvuloplasty two times?
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'opn aortic valvulopla...
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 diagnoses ( ...
How many patients below 67 years of age have stayed in the hospital for more than 34 days?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "67" AND demographic.days_stay > "34"
CREATE TABLE table_1348246_3 ( mechanical VARCHAR, regulating VARCHAR )
What mechanical has lpm regulation?
SELECT mechanical FROM table_1348246_3 WHERE regulating = "LPM"
CREATE TABLE table_60090 ( "Country" text, "Region" text, "FHFreepressreport" text, "RWB Pressfreedomindex" text, "Internetlists" text, "ONIpoliticalfiltering" text, "ONIsocialfiltering" text, "ONIsecurityfiltering" text, "ONItoolsfiltering" text )
The country of Laos is in what region?
SELECT "Region" FROM table_60090 WHERE "Country" = 'laos'
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 text, route text, drug_dose text ) ...
provide the number of emergency hospital admission patients who have been diagnosed with unspecified malignant neoplasm of tongue.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.short_title = "Malig neo tongue NEC"
CREATE TABLE table ( weight VARCHAR, market_name VARCHAR )
If the market name is Xperia U, what is the weight?
SELECT weight FROM table WHERE market_name = "Xperia U"
CREATE TABLE table_name_24 ( points VARCHAR, wins INTEGER )
How many Points has Wins larger than 0?
SELECT COUNT(points) FROM table_name_24 WHERE wins > 0
CREATE TABLE table_22595 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text )
What is the production code for episode 6 in the season?
SELECT "Production code" FROM table_22595 WHERE "No. in season" = '6'
CREATE TABLE table_77534 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Decision" text, "Attendance" real, "Record" text )
Who was the visiting team at the game when the Canadiens had a record of 30 19 9?
SELECT "Visitor" FROM table_77534 WHERE "Record" = '30–19–9'
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 city ( city_code varchar, city_name varchar, state_code varchar, country_name varc...
what flights are available from DALLAS to ATLANTA with one way economy fares
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, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND fare_basis.economy = 'YES' AND fare.fare_basi...
CREATE TABLE table_54442 ( "Party" text, "Results 2004" text, "CSA 5/14/09" text, "Viavoice 5/15/09" text, "Ifop- La Croix 5/15/09" text, "Ipsos 5/16/09" text, "OpinionWay 5/18/09" text, "CSA 5/20/09" text, "Ipsos 5/25/09" text, "TNS-Sofres 5/26/09" text, "OpinionWay 5/28/09"...
Which Ipsos 5/16/09 has a TNS-Sofres 5/28/09 of 2.5%?
SELECT "Ipsos 5/16/09" FROM table_54442 WHERE "TNS-Sofres 5/28/09" = '2.5%'
CREATE TABLE table_name_78 ( name VARCHAR, city VARCHAR, years_as_tallest VARCHAR )
What is the name of the building that was the tallest from 1990 1997 in Frankfurt?
SELECT name FROM table_name_78 WHERE city = "frankfurt" AND years_as_tallest = "1990–1997"
CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE flight_stop ( flight_id int, stop_number int, ...
AA flights from CINCINNATI to SALT LAKE CITY
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 = 'SALT LAKE CITY' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name =...
CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, sc...
Are there any courses in Synthesis and Characterization that satisfy the ULCS requirement ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%Synthesis and Characterization%' OR course.description LIKE '%Synthesis and Characterization%' O...
CREATE TABLE department ( Department_ID int, Name text, Creation text, Ranking int, Budget_in_Billions real, Num_Employees real ) CREATE TABLE head ( head_ID int, name text, born_state text, age real ) CREATE TABLE management ( department_ID int, head_ID int, tempor...
Show the average age of heads of departments born in each state with a bar chart, list by the X-axis in desc.
SELECT born_state, AVG(age) FROM head GROUP BY born_state ORDER BY born_state DESC
CREATE TABLE table_24619 ( "Week" real, "Date" text, "Opponent" text, "Location" text, "Final Score" text, "Attendance" real, "Record" text )
How many people were present at the July 10 game?
SELECT "Attendance" FROM table_24619 WHERE "Date" = 'July 10'
CREATE TABLE table_7309 ( "Ballarat FL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
How many total wins does Ballarat FL of East point have when the against is greater than 1000?
SELECT COUNT("Wins") FROM table_7309 WHERE "Ballarat FL" = 'east point' AND "Against" > '1000'
CREATE TABLE artist ( artist_id number, artist text, age number, famous_title text, famous_release_date text ) CREATE TABLE volume ( volume_id number, volume_issue text, issue_date text, weeks_on_top number, song text, artist_id number ) CREATE TABLE music_festival ( id...
What is the issue date of the volume with the minimum weeks on top?
SELECT issue_date FROM volume ORDER BY weeks_on_top LIMIT 1
CREATE TABLE table_58849 ( "Year" real, "Manufacturer" text, "Start" real, "Finish" real, "Team" text )
WHAT WAS THE FINISH NUMBER WITH A START SMALLER THAN 20 IN 1969?
SELECT COUNT("Finish") FROM table_58849 WHERE "Start" < '20' AND "Year" = '1969'
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 )
Find the number of different products that are produced by companies at different headquarter cities Plot them as bar chart, and could you order by the Y-axis in desc please?
SELECT Headquarter, COUNT(DISTINCT T1.Name) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code ORDER BY COUNT(DISTINCT T1.Name) DESC
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE requirement (...
Tell me the differences between ARABIC 600 and ARABIC 101 .
SELECT DISTINCT department, description, number FROM course WHERE (department = 'ARABIC' AND number = 600) OR (department = 'ARABIC' AND number = 101)
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 vitalperiodic ( vitalperiodici...
calculate the number of times patient 007-2498 had a surgical drain, tube output: drainage bag-closed s until 265 days ago.
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '007-2498')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.cel...
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 )
For those records from the products and each product's manufacturer, show me about the distribution of name and manufacturer , and group by attribute headquarter in a bar chart.
SELECT T1.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name
CREATE TABLE publication ( Book_ID VARCHAR, Price INTEGER ) CREATE TABLE book ( Writer VARCHAR, Book_ID VARCHAR )
Show writers who have published a book with price more than 4000000.
SELECT T1.Writer FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID WHERE T2.Price > 4000000
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 t...
tell me the number of urgent hospital admission patients who have been diagnosed with retained plastic fragments.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.long_title = "Retained plastic fragments"
CREATE TABLE table_9297 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
Which Rank has a Total larger than 30, and a Bronze of 14?
SELECT AVG("Rank") FROM table_9297 WHERE "Total" > '30' AND "Bronze" = '14'
CREATE TABLE table_69523 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text )
How many points for did Bridgend Athletic RFC score?
SELECT "Points for" FROM table_69523 WHERE "Club" = 'bridgend athletic rfc'
CREATE TABLE table_name_36 ( school_club_team VARCHAR, round VARCHAR, position VARCHAR )
What school did the linebacker who was drafted after round 8 come from?
SELECT school_club_team FROM table_name_36 WHERE round > 8 AND position = "linebacker"
CREATE TABLE table_17299 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
How many times was the game 39?
SELECT COUNT("Record") FROM table_17299 WHERE "Game" = '39'
CREATE TABLE table_14170 ( "Model number" text, "sSpec number" text, "Cores" text, "Frequency" text, "Turbo" text, "L2 cache" text, "L3 cache" text, "GPU model" text, "GPU frequency" text, "Socket" text, "I/O bus" text, "Release date" text, "Release price ( USD )" tex...
What turbo has a L2 cache of 4 256 kb, a release date of June 2013, and a Model number of core i7-4770s?
SELECT "Turbo" FROM table_14170 WHERE "L2 cache" = '4 × 256 kb' AND "Release date" = 'june 2013' AND "Model number" = 'core i7-4770s'
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost numbe...
calculate the probability of survival for four year among the patients diagnosed with upper respiratory obstruction - due to tumor.
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 4 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOI...
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Return a bar chart about the distribution of All_Games and School_ID , list by the School_ID in descending.
SELECT All_Games, School_ID FROM basketball_match ORDER BY School_ID DESC
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtim...
what is the one year survival rate for a patient with facial bone fracture - maxillary fracture?
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 1 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOI...
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number,...
what were the top five diagnoses that had the highest one year mortality rate?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t4.icd9_code FROM (SELECT t3.icd9_code, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.icd9_code, 100 - SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.chartt...
CREATE TABLE table_12962773_12 ( player VARCHAR, height VARCHAR )
WHat is the number for the player whose height is 2.01?
SELECT COUNT(player) FROM table_12962773_12 WHERE height = "2.01"
CREATE TABLE table_56308 ( "Date" text, "Tournament" text, "Surface" text, "Opponent in the final" text, "Score" text )
What is the tournament surface at Aptos?
SELECT "Surface" FROM table_56308 WHERE "Tournament" = 'aptos'
CREATE TABLE table_43173 ( "Name" text, "Position" text, "Number" text, "School/Club Team" text, "Season" text, "Acquisition via" text )
What season did School/Club Team, East have an Acquisition via of trade?
SELECT "Season" FROM table_43173 WHERE "Acquisition via" = 'trade' AND "School/Club Team" = 'east'
CREATE TABLE table_name_3 ( position VARCHAR, hometown VARCHAR )
What is the position of the player from Fort Lauderdale, Florida?
SELECT position FROM table_name_3 WHERE hometown = "fort lauderdale, florida"