table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
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 procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
... | what is the number of patients whose ethnicity is white - russian and drug name is topiramate (topamax)? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND prescriptions.drug = "Topiramate (Topamax)" |
CREATE TABLE table_28704 (
"Rank" real,
"Athlete" text,
"Country" text,
"Distance (metres)" text,
"Points" text,
"Adjusted Points" real
) | What is the total number of times points were listed when the distance was 41.05 metres? | SELECT COUNT("Points") FROM table_28704 WHERE "Distance (metres)" = '41.05' |
CREATE TABLE table_35523 (
"Position" real,
"Team" text,
"Played" real,
"Wins" real,
"Draws" real,
"Losses" real,
"Scored" real,
"Conceded" real,
"Points" real
) | What was the lowest number of wins for the team that scored more than 14 points and had a position of 7? | SELECT MIN("Wins") FROM table_35523 WHERE "Position" = '7' AND "Scored" > '14' |
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),... | For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about employee_id over the email , and I want to display in ascending by the y axis. | SELECT EMAIL, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMPLOYEE_ID |
CREATE TABLE table_22358 (
"No. in series" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"U.S. viewers (in millions)" text
) | What was the title of the episode directed by John T. Kretchmer? | SELECT "Title" FROM table_22358 WHERE "Directed by" = 'John T. Kretchmer' |
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 prescriptions... | count the number of patients whose admission type is newborn and procedure short title is vaccination nec? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "NEWBORN" AND procedures.short_title = "Vaccination NEC" |
CREATE TABLE table_241 (
"Model" text,
"Engine make/Capacity" text,
"Power kW@rpm" text,
"Torque Nm@rpm" text,
"Transmission Make/Type/Speed" text,
"GVM (kg) Technical Capacity" text,
"GCM (kg) Technical Capacity" text
) | Which model number has a GVM (kg) Technical Capacity of 16000 and a Torque Nm@rpm of 600 @ 1700? | SELECT "Model" FROM table_241 WHERE "GVM (kg) Technical Capacity" = '16000' AND "Torque Nm@rpm" = '600 @ 1700' |
CREATE TABLE table_204_38 (
id number,
"date" text,
"opponent#" text,
"rank#" text,
"site" text,
"result" text
) | were the results of the game of november 14 above or below the results of the october 17 game ? | SELECT (SELECT "result" FROM table_204_38 WHERE "date" = 'november 14') > (SELECT "result" FROM table_204_38 WHERE "date" = 'october 17') |
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
Body text,
OwnerUserId number,
OwnerDisplayName text,
LastEditorUserId number,
LastEditorDisplayName text... | Get upvoted answers where question doesn t have tag.. | SELECT * FROM Posts |
CREATE TABLE table_17648 (
"#" real,
"Athlete" text,
"Shooting" text,
"Fencing" text,
"Swimming" text,
"Riding" text,
"Running" text,
"Total" real
) | What is the numberof running wiht pamela zapata? | SELECT COUNT("Running") FROM table_17648 WHERE "Athlete" = 'Pamela Zapata' |
CREATE TABLE table_17596418_4 (
country VARCHAR,
p VARCHAR
) | What country has a P of GK? | SELECT country FROM table_17596418_4 WHERE p = "GK" |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age te... | what were the five drugs most frequently prescribed to the patients aged 50s during the same month after they had been diagnosed with septic shock until 2104? | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'septic shock' AND STRFTIME('%y', diagnosis.diagnos... |
CREATE TABLE table_name_2 (
date INTEGER,
label VARCHAR,
catalog VARCHAR,
format VARCHAR
) | what is the earliest date for the album that had a catalog number of 3645, was formatted as a cd and was under the luaka bop label? | SELECT MIN(date) FROM table_name_2 WHERE catalog = "3645" AND format = "cd" AND label = "luaka bop" |
CREATE TABLE table_52682 (
"Division" text,
"League Apps (Sub)" real,
"League Goals" real,
"FA Cup Apps (Sub)" text,
"FA Cup Goals" real,
"FL Cup Apps (Sub)" real,
"FL Cup Goals" real,
"Other Apps" real,
"Other Goals" real,
"Total Apps (Sub)" text,
"Total Goals" real
) | What is Division One's average Other Apps, with a League Goal less than 1? | SELECT AVG("Other Apps") FROM table_52682 WHERE "Division" = 'one' AND "League Goals" < '1' |
CREATE TABLE table_name_96 (
runner_up VARCHAR,
year VARCHAR
) | Who was the runner-up in 2004? | SELECT runner_up FROM table_name_96 WHERE year = "2004" |
CREATE TABLE table_204_237 (
id number,
"season" text,
"average" number,
"high" number,
"low" number,
"season tickets" number
) | how many seasons at the stadio ennio tardini had 11,000 or more season tickets ? | SELECT COUNT("season") FROM table_204_237 WHERE "season tickets" >= 11000 |
CREATE TABLE table_42237 (
"AIRLINE" text,
"AIRLINE (in Arabic)" text,
"ICAO" text,
"CALLSIGN" text,
"COMMENCED OPERATIONS" real
) | What callsign has commenced operations in 2011? | SELECT "CALLSIGN" FROM table_42237 WHERE "COMMENCED OPERATIONS" = '2011' |
CREATE TABLE table_name_80 (
prr_class VARCHAR,
wheel_arrangement VARCHAR,
total_produced VARCHAR
) | What is the PRR class for wheel arrangement c-c and total less than 15? | SELECT prr_class FROM table_name_80 WHERE wheel_arrangement = "c-c" AND total_produced < 15 |
CREATE TABLE table_name_2 (
date_of_polling VARCHAR,
liberal VARCHAR,
polling_firm VARCHAR,
green VARCHAR
) | On what date of polling was the Polling Firm forum research with 7 green and less than 30 liberals? | SELECT date_of_polling FROM table_name_2 WHERE polling_firm = "forum research" AND green = 7 AND liberal < 30 |
CREATE TABLE table_name_82 (
weekly_rank VARCHAR,
official_ratings__millions_ VARCHAR
) | Which Weekly Rank has an Official ratings (millions) of 11.58? | SELECT weekly_rank FROM table_name_82 WHERE official_ratings__millions_ = 11.58 |
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 patient (
uniquep... | tell me the name of the drug that patient 022-187132 had been allergic to on this hospital visit? | SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-187132' AND patient.hospitaldischargetime IS NULL)) |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospita... | indicate the daily minimum volume of nephrostomy that patient 007-7646 has had since 142 days ago. | SELECT MIN(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 = '007-7646')) AND intakeoutput.celllabel = 'nephro... |
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_... | what flights can i take between BOSTON and ATLANTA so that when i leave BOSTON i will have the maximum amount of time on the ground in ATLANTA and still return in the same day | 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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight.arrival_time = (SELECT MIN(FLIGHTalias1.arrival_time) FROM airport_s... |
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number,
LinkTypeId number
)
CREATE TABLE TagSynonyms (
Id number... | Unanswered questions beginning with a keyword. | SELECT p.CreationDate, p.Id AS "post_link", p.Body FROM Posts AS p WHERE (p.PostTypeId = 1 AND p.Score < 3 AND COALESCE(p.AnswerCount, 0) = 0 AND ClosedDate IS NULL AND p.Body LIKE '<p>##Keyword##%') ORDER BY p.Id DESC |
CREATE TABLE table_22460 (
"Township" text,
"County" text,
"Pop. (2010)" real,
"Land ( sqmi )" text,
"Water (sqmi)" text,
"Latitude" text,
"Longitude" text,
"GEO ID" real,
"ANSI code" real
) | what is the lowest geo id? | SELECT MIN("GEO ID") FROM table_22460 |
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,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 T... | For all employees who have the letters D or S in their first name, return a line chart about the change of commission_pct over hire_date . | SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsysto... | is there any microbiological test result since 2101 for patient 025-28600's abscess? | SELECT COUNT(*) FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-28600')) AND microlab.culturesite = 'abscess' AND STRFTIME('%y', microlab.cult... |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREA... | tell me the sex of patient 017-49538. | SELECT DISTINCT patient.gender FROM patient WHERE patient.uniquepid = '017-49538' |
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... | show the number of patients with procedure icd code 8852 who are younger than 31 years. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "31" AND procedures.icd9_code = "8852" |
CREATE TABLE table_name_43 (
station VARCHAR,
number VARCHAR,
stop VARCHAR
) | Which station has a number less than 5 and an l stop? | SELECT station FROM table_name_43 WHERE number < 5 AND stop = "l" |
CREATE TABLE table_255188_1 (
institution VARCHAR,
joined VARCHAR
) | What institution joined in 1988? | SELECT institution FROM table_255188_1 WHERE joined = 1988 |
CREATE TABLE cite (
citingpaperid int,
citedpaperid int
)
CREATE TABLE paper (
paperid int,
title varchar,
venueid int,
year int,
numciting int,
numcitedby int,
journalid int
)
CREATE TABLE journal (
journalid int,
journalname varchar
)
CREATE TABLE dataset (
datasetid... | Keyphrases used by jeffrey heer | SELECT DISTINCT keyphrase.keyphraseid FROM author, keyphrase, paper, paperkeyphrase, writes WHERE author.authorname = 'jeffrey heer' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid |
CREATE TABLE table_10203 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was the venue where the away team scored 16.11 (107)? | SELECT "Venue" FROM table_10203 WHERE "Away team score" = '16.11 (107)' |
CREATE TABLE table_name_68 (
memory VARCHAR,
clock VARCHAR,
number VARCHAR
) | What is the Memory for a Number 32 with a Clock of 2.26ghz? | SELECT memory FROM table_name_68 WHERE clock = "2.26ghz" AND number = 32 |
CREATE TABLE Rooms (
RoomId TEXT,
roomName TEXT,
beds INTEGER,
bedType TEXT,
maxOccupancy INTEGER,
basePrice INTEGER,
decor TEXT
)
CREATE TABLE Reservations (
Code INTEGER,
Room TEXT,
CheckIn TEXT,
CheckOut TEXT,
Rate REAL,
LastName TEXT,
FirstName TEXT,
Adul... | Draw a bar chart of decor versus minimal baseprice, and sort Y-axis from low to high order. | SELECT decor, MIN(basePrice) FROM Rooms GROUP BY decor ORDER BY MIN(basePrice) |
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 prescriptions... | Find the number of divorced patients with 2182-12-31 17:20:00 as the lab test chart time. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.charttime = "2182-12-31 17:20:00" |
CREATE TABLE customer (
customer_id SMALLINT UNSIGNED,
store_id TINYINT UNSIGNED,
first_name VARCHAR(45),
last_name VARCHAR(45),
email VARCHAR(50),
address_id SMALLINT UNSIGNED,
active BOOLEAN,
create_date DATETIME,
last_update TIMESTAMP
)
CREATE TABLE rental (
rental_id INT,
... | How many films are there in each category? List the genre name and the count with a bar chart, and list the total number in asc order please. | SELECT name, COUNT(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T1.category_id ORDER BY COUNT(*) |
CREATE TABLE table_name_99 (
april INTEGER,
record VARCHAR,
points VARCHAR
) | What is the highest value in April with a record of 35 37 11 and more than 81 points? | SELECT MAX(april) FROM table_name_99 WHERE record = "35–37–11" AND points > 81 |
CREATE TABLE student (
stuid number,
lname text,
fname text,
age number,
sex text,
major number,
advisor number,
city_code text
)
CREATE TABLE voting_record (
stuid number,
registration_date text,
election_cycle text,
president_vote number,
vice_president_vote number... | What are the maximum and minimum age of students with major 600? | SELECT MAX(age), MIN(age) FROM student WHERE major = 600 |
CREATE TABLE table_45799 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"Record" text,
"Streak" text
) | Which Record has a Score of 111 101? | SELECT "Record" FROM table_45799 WHERE "Score" = '111–101' |
CREATE TABLE table_20398823_1 (
podiums INTEGER,
points VARCHAR
) | Name the least podiums for 49 points | SELECT MIN(podiums) FROM table_20398823_1 WHERE points = "49" |
CREATE TABLE table_name_87 (
lost INTEGER,
goals_scored VARCHAR,
place VARCHAR
) | What the lost in place less than 3 and having more than 63 goals scored? | SELECT SUM(lost) FROM table_name_87 WHERE goals_scored > 63 AND place < 3 |
CREATE TABLE table_name_43 (
gain INTEGER,
avg_g VARCHAR,
loss VARCHAR
) | What are the gains for the player with average of 26.8 and lost yard fewer than 13? | SELECT SUM(gain) FROM table_name_43 WHERE avg_g = "26.8" AND loss < 13 |
CREATE TABLE table_22815265_1 (
record VARCHAR,
opponents VARCHAR
) | How many records were there when opponents were 9? | SELECT COUNT(record) FROM table_22815265_1 WHERE opponents = 9 |
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_status text,
age text,
dob te... | find the number of patients whose insurance is self pay and lab test name is platelet count. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Self Pay" AND lab.label = "Platelet Count" |
CREATE TABLE table_11861 (
"Rank" real,
"Player" text,
"Country" text,
"Earnings( $ )" real,
"Wins" real
) | How much has dave stockton earned? | SELECT MAX("Earnings( $ )") FROM table_11861 WHERE "Player" = 'dave stockton' |
CREATE TABLE table_24355 (
"Type of Record" text,
"Attendance" real,
"Date/Year" text,
"Stadium" text,
"Result/Games" text
) | what is the highest attendance for a total attendance-regular season record | SELECT MAX("Attendance") FROM table_24355 WHERE "Type of Record" = 'Total Attendance-Regular season' |
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE course (
course_id int,
na... | What is the most challenging class ? | SELECT DISTINCT course.name, course.number, program_course.workload FROM course, program_course WHERE course.department = 'EECS' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MAX(PROGRAM_COURSEalias1.workload) FROM course AS COURSEalias1, program_course AS PROGRAM_COURSEalias1 WH... |
CREATE TABLE table_name_43 (
number_of_households INTEGER,
median_household_income VARCHAR
) | What is the sum of households that makes a median household income of $44,718? | SELECT SUM(number_of_households) FROM table_name_43 WHERE median_household_income = "$44,718" |
CREATE TABLE table_name_39 (
astc_member VARCHAR,
aam_accredited VARCHAR,
state VARCHAR,
aam_member VARCHAR
) | What is ASTC Member, when State is Arkansas, when AAM Member is No, and when AAM Accredited is Yes? | SELECT astc_member FROM table_name_39 WHERE state = "arkansas" AND aam_member = "no" AND aam_accredited = "yes" |
CREATE TABLE table_name_72 (
place VARCHAR,
artist VARCHAR,
points VARCHAR
) | Name the total number of places for vicky gordon and points more than 23 | SELECT COUNT(place) FROM table_name_72 WHERE artist = "vicky gordon" AND points > 23 |
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescriptions... | what is the number of patients diagnosed with hamartoses nec who have been prescribed additive type drug? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Hamartoses NEC" AND prescriptions.drug_type = "ADDITIVE" |
CREATE TABLE table_name_30 (
attendance INTEGER,
arena VARCHAR,
points VARCHAR
) | How much Attendance has an Arena of arrowhead pond of anaheim, and Points of 5? | SELECT SUM(attendance) FROM table_name_30 WHERE arena = "arrowhead pond of anaheim" AND points = 5 |
CREATE TABLE table_204_448 (
id number,
"team" text,
"winners" number,
"runners-up" number,
"years won" text,
"years runner-up" text
) | which teams has the least wins ? | SELECT "team" FROM table_204_448 WHERE "winners" = (SELECT MIN("winners") FROM table_204_448) |
CREATE TABLE Courses (
course_id INTEGER,
author_id INTEGER,
subject_id INTEGER,
course_name VARCHAR(120),
course_description VARCHAR(255)
)
CREATE TABLE Students (
student_id INTEGER,
date_of_registration DATETIME,
date_of_latest_logon DATETIME,
login_name VARCHAR(40),
password... | What are the student IDs and middle names of the students enrolled in at most two courses, rank by the student_id from high to low please. | SELECT T2.middle_name, T1.student_id FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.student_id DESC |
CREATE TABLE table_name_65 (
leading_scorer VARCHAR,
attendance VARCHAR,
record VARCHAR
) | What is Leading Scorer, when Attendance is Gund Arena 20,562, and when Record is 20-10? | SELECT leading_scorer FROM table_name_65 WHERE attendance = "gund arena 20,562" AND record = "20-10" |
CREATE TABLE table_10038 (
"Team" text,
"Match" real,
"Points" real,
"Draw" real,
"Lost" real
) | What is the number of points when the match is smaller than 14? | SELECT COUNT("Points") FROM table_10038 WHERE "Match" < '14' |
CREATE TABLE election (
Election_ID int,
Counties_Represented text,
District int,
Delegate text,
Party int,
First_Elected real,
Committee text
)
CREATE TABLE county (
County_Id int,
County_name text,
Population real,
Zip_code text
)
CREATE TABLE party (
Party_ID int,
... | For each county, find the name of the county and the number of delegates from that county Show bar chart, and show by the Y from low to high please. | SELECT County_name, COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_Id = T2.District GROUP BY T1.County_Id ORDER BY COUNT(*) |
CREATE TABLE CloseReasonTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
PostId number,
RelatedPostId number... | Subtract the preceding value from the current value using php while loop. | SELECT * FROM Posts WHERE Id = '5312400' |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
... | give me the number of patients whose insurance is medicaid and primary disease is morbid obesity/sda? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Medicaid" AND demographic.diagnosis = "MORBID OBESITY/SDA" |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | Users with the highest posts to total rep ratio. | SELECT u.Id AS "user_link", u.Reputation, COUNT(*) AS "total_number_of_posts", COUNT(*) / u.Reputation AS Ratio FROM Users AS u JOIN Posts AS p ON p.OwnerUserId = u.Id WHERE p.PostTypeId IN (1, 2) GROUP BY u.Id, u.DisplayName, u.Reputation ORDER BY Ratio DESC LIMIT 100 |
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 demographic ... | provide the number of patients whose admission year is less than 2110 and diagnoses icd9 code is 7885? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2110" AND diagnoses.icd9_code = "7885" |
CREATE TABLE table_29471472_1 (
season INTEGER,
team VARCHAR
) | What season was the team autosport academy? | SELECT MAX(season) FROM table_29471472_1 WHERE team = "Autosport Academy" |
CREATE TABLE table_36446 (
"Year" text,
"Flagship Station" text,
"Play-by-play" text,
"Color commentator(s)" text,
"Studio host" text
) | Name the flagship station for cedric maxwell and year of 1995-96 | SELECT "Flagship Station" FROM table_36446 WHERE "Color commentator(s)" = 'cedric maxwell' AND "Year" = '1995-96' |
CREATE TABLE table_13741576_4 (
try_bonus VARCHAR,
tries_against VARCHAR
) | Name the try bonus for tries against is 70 | SELECT try_bonus FROM table_13741576_4 WHERE tries_against = "70" |
CREATE TABLE table_8235 (
"ISLAND" text,
"CITY / TOWN" text,
"ICAO" text,
"IATA" text,
"AIRPORTNAME" text
) | What is the name of the airport in S o Filipe that has an IATA of sfl? | SELECT "AIRPORTNAME" FROM table_8235 WHERE "CITY / TOWN" = 'são filipe' AND "IATA" = 'sfl' |
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_status text,
age text,
dob te... | how many patients are diagnosed with human immuno virus dis and had their lab test show abnormal status? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Human immuno virus dis" AND lab.flag = "abnormal" |
CREATE TABLE table_18662026_10 (
gymnast VARCHAR,
parallel_bars VARCHAR
) | If the parallel bars is 14.025, what is the total number of gymnasts? | SELECT COUNT(gymnast) FROM table_18662026_10 WHERE parallel_bars = "14.025" |
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
... | User's Reputation, Questions, Comments and Answers. | SELECT TOP(100) AS DisplayName, Reputation, AnswerCount, CommentCount FROM Users, Posts ORDER BY Reputation DESC |
CREATE TABLE party (
Party_Theme VARCHAR,
Number_of_hosts VARCHAR
) | List the themes of parties in ascending order of number of hosts. | SELECT Party_Theme FROM party ORDER BY Number_of_hosts |
CREATE TABLE table_12599 (
"State" text,
"Status" text,
"Association Agreement" text,
"Membership Application" text,
"Candidate status" text,
"Negotiations start" text,
"Screening completed" text,
"Acquis Chapters open/closed" text
) | What is the candidate status of macedonia? | SELECT "Candidate status" FROM table_12599 WHERE "State" = 'macedonia' |
CREATE TABLE table_44766 (
"Round" real,
"Pick" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | What is Name, when Overall is greater than 132, and when Round is 12? | SELECT "Name" FROM table_44766 WHERE "Overall" > '132' AND "Round" = '12' |
CREATE TABLE table_43814 (
"Club" text,
"League goals" text,
"FA Cup goals" text,
"League Cup goals" text,
"Total" real
) | Which League Cup goals have a Total larger than 14, and a League goals of 14, and a FA Cup goals of 0? | SELECT "League Cup goals" FROM table_43814 WHERE "Total" > '14' AND "League goals" = '14' AND "FA Cup goals" = '0' |
CREATE TABLE table_name_58 (
lost VARCHAR,
points VARCHAR,
points_against VARCHAR
) | when points were 36 and points against 489 what is the lost? | SELECT lost FROM table_name_58 WHERE points = "36" AND points_against = "489" |
CREATE TABLE table_11216 (
"Pick" real,
"Round" text,
"Player" text,
"Position" text,
"School" text
) | What position did the school of alabama draft? | SELECT "Position" FROM table_11216 WHERE "School" = 'alabama' |
CREATE TABLE table_77897 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What is the home team for victoria park? | SELECT "Home team" FROM table_77897 WHERE "Venue" = 'victoria park' |
CREATE TABLE table_name_60 (
tournament VARCHAR,
opponent VARCHAR
) | Which tournament did the opponent Guillermo Carry play? | SELECT tournament FROM table_name_60 WHERE opponent = "guillermo carry" |
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress text
)
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
... | How many views did the question I answered get?. Finds every answer you wrote, and then looks how many views the question got. Kinda cool imo. | SELECT A.ParentId AS "Question ID", Q.Id AS "post_link", Q.Tags AS "Tags", Q.ViewCount AS "Views" FROM Posts AS A INNER JOIN Posts AS Q ON Q.Id = A.ParentId WHERE A.PostTypeId = 2 AND A.OwnerUserId = @UserId ORDER BY Q.ViewCount DESC |
CREATE TABLE table_name_56 (
crowd INTEGER,
venue VARCHAR
) | Who has the smallest crowd in the Venue of Arden Street Oval? | SELECT MIN(crowd) FROM table_name_56 WHERE venue = "arden street oval" |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
... | what procedure did patient 15257 until 2104 receive for the last time? | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15257) AND STRFTIME('%y', procedures_icd.charttime) <= '2104' ORDER ... |
CREATE TABLE table_name_99 (
player VARCHAR,
to_par VARCHAR
) | Name the Player which has a To par of 6? | SELECT player FROM table_name_99 WHERE to_par = "–6" |
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,
first_careunit text,
last_careunit text,
first_wardid number,
last_wardid number... | what is the name of the specimen test which patient 5878 has last received on the last hospital encounter? | SELECT microbiologyevents.spec_type_desc FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5878 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) ORDER BY microbiologyevents.charttime DESC LIMIT 1 |
CREATE TABLE table_name_13 (
silver VARCHAR,
total VARCHAR,
gold VARCHAR,
bronze VARCHAR
) | What is the total number of silver medals of the team with less than 2 gold, 1 bronze, and more than 2 total medals? | SELECT COUNT(silver) FROM table_name_13 WHERE gold < 2 AND bronze = 1 AND total > 2 |
CREATE TABLE table_train_233 (
"id" int,
"serum_bicarbonate" int,
"language" string,
"hemoglobin_a1c_hba1c" float,
"creatinine_clearance_cl" float,
"admission_blood_glucose" int,
"urine_albumin" int,
"ketoacidosis" bool,
"age" float,
"NOUSE" float
) | subjects must have an admission blood glucose > 140 mg and < 400 mg / dl and no evidence of ketoacidosis ( serum bicarbonate < 18 meq / l | SELECT * FROM table_train_233 WHERE admission_blood_glucose > 140 AND admission_blood_glucose < 400 AND (ketoacidosis = 0 OR serum_bicarbonate > 18) |
CREATE TABLE table_name_98 (
opponent VARCHAR,
points VARCHAR
) | Which opponent has 63 points? | SELECT opponent FROM table_name_98 WHERE points = 63 |
CREATE TABLE settlements (
settlement_id number,
claim_id number,
date_claim_made time,
date_claim_settled time,
amount_claimed number,
amount_settled number,
customer_policy_id number
)
CREATE TABLE payments (
payment_id number,
settlement_id number,
payment_method_code text,
... | Of all the claims, what was the earliest date when any claim was made? | SELECT date_claim_made FROM claims ORDER BY date_claim_made LIMIT 1 |
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... | Visualize a bar chart about the distribution of All_Home and the sum of Team_ID , and group by attribute All_Home, and display by the X in descending please. | SELECT All_Home, SUM(Team_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home DESC |
CREATE TABLE table_name_84 (
wins VARCHAR,
year VARCHAR
) | What is listed for the Wins with a Year of 1989? | SELECT wins FROM table_name_84 WHERE year = 1989 |
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,
... | Singapore Top User with Python tag. | SELECT ROW_NUMBER() OVER (ORDER BY u.Reputation DESC) AS "#", u.Id AS "user_link", u.Reputation FROM Users AS u INNER JOIN Posts AS p ON p.OwnerUserId = u.Id INNER JOIN PostTags AS pt ON pt.PostId = p.Id INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE LOWER(u.Location) LIKE '%singapore%' OR UPPER(u.Location) LIKE '%SG' A... |
CREATE TABLE Transactions (
transaction_id INTEGER,
investor_id INTEGER,
transaction_type_code VARCHAR(10),
date_of_transaction DATETIME,
amount_of_transaction DECIMAL(19,4),
share_count VARCHAR(40),
other_details VARCHAR(255)
)
CREATE TABLE Ref_Transaction_Types (
transaction_type_code... | Show the average amount of transactions for different investors with a scatter chart. | SELECT investor_id, AVG(amount_of_transaction) FROM Transactions GROUP BY investor_id |
CREATE TABLE table_name_96 (
city VARCHAR,
club VARCHAR
) | Which city has a club called the Huntsville Stars? | SELECT city FROM table_name_96 WHERE club = "huntsville stars" |
CREATE TABLE table_4556 (
"Actor/actress" text,
"Character" text,
"Rank" text,
"Tenure" text,
"Episodes" text
) | What rank did actor Aaron Pedersen's character have? | SELECT "Rank" FROM table_4556 WHERE "Actor/actress" = 'aaron pedersen' |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREA... | what is the daily maximum amount of urine in patient 025-51980 in 01/this year? | SELECT MAX(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 = '025-51980')) AND intakeoutput.celllabel = 'urine... |
CREATE TABLE table_23846 (
"Parish" text,
"Obama%" text,
"Obama#" real,
"McCain%" text,
"McCain#" real
) | What was McCain's percentage when Obama had 64.39% of the vote? | SELECT "McCain%" FROM table_23846 WHERE "Obama%" = '64.39%' |
CREATE TABLE table_204_809 (
id number,
"draw" number,
"country" text,
"language" text,
"artist" text,
"song" text,
"english translation" text,
"national final" text,
"place" number,
"points" number
) | how many countries other than spain placed 2nd in the national final category ? | SELECT COUNT("country") FROM table_204_809 WHERE "country" <> 'spain' AND "national final" = 2 |
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime... | what is the yearly minimum amount of output y (ml)-chest tube y - a #1 right b #1 left in patient 016-13544 until 04/2104? | SELECT MIN(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 = '016-13544')) AND intakeoutput.celllabel = 'outpu... |
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,
... | what is the number of patients whose drug name is nifedipine cr? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "NIFEdipine CR" |
CREATE TABLE table_57852 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What team was the home team on 27 june 1981, at vfl park? | SELECT "Home team" FROM table_57852 WHERE "Date" = '27 june 1981' AND "Venue" = 'vfl park' |
CREATE TABLE table_29289 (
"Season" text,
"Coach" text,
"Conf. Record" text,
"Overall" text,
"Standings" text,
"Postseason" text
) | Who was the coach of the Pandas when their overall record was 20-6-2? | SELECT "Coach" FROM table_29289 WHERE "Overall" = '20-6-2' |
CREATE TABLE table_31291 (
"Season" text,
"Level" text,
"Division" text,
"Section" text,
"Position" text,
"Movements" text
) | in what year the position was the 9th | SELECT "Season" FROM table_31291 WHERE "Position" = '9th' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.