context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_58693 ( "Position" real, "Team" text, "Played" real, "Drawn" real, "Lost" real, "Goals For" real, "Goals Against" real, "Goal Difference" text, "Points 1" text )
What are the lowest lost has 111 as the goals against?
SELECT MIN("Lost") FROM table_58693 WHERE "Goals Against" = '111'
wikisql
CREATE TABLE table_11545282_19 ( no INTEGER, school_club_team VARCHAR )
What is the number of school/club teams held by BYU?
SELECT MIN(no) FROM table_11545282_19 WHERE school_club_team = "BYU"
sql_create_context
CREATE TABLE table_2468961_2 ( title VARCHAR, written_by VARCHAR )
What is the name of the episode written by Ross Brown?
SELECT title FROM table_2468961_2 WHERE written_by = "Ross Brown"
sql_create_context
CREATE TABLE table_name_25 ( label VARCHAR, media VARCHAR, release_date VARCHAR )
What is the label for a CD released in 2004?
SELECT label FROM table_name_25 WHERE media = "cd" AND release_date = 2004
sql_create_context
CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, dire...
i want to fly from DENVER to SAN FRANCISCO
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRA...
atis
CREATE TABLE table_53254 ( "Player" text, "Nationality" text, "Position" text, "Years for Jazz" text, "School/Club Team" text )
What school does John Crotty play for?
SELECT "School/Club Team" FROM table_53254 WHERE "Player" = 'john crotty'
wikisql
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate ti...
how many days have pass since the last time patient 31854 stayed in careunit ccu during the current hospital visit?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 31854 AND admissions.dischtime IS NULL) AND transfers.careunit = 'ccu' ORDER BY transfers.intime DESC LIMIT 1
mimic_iii
CREATE TABLE table_204_867 ( id number, "number" number, "date" text, "name" text, "age\n(at execution)" number, "age\n(at offense)" number, "race" text, "state" text, "method" text )
who was the next consecutive woman to be executed after lynda lyon block ?
SELECT "name" FROM table_204_867 WHERE "number" = (SELECT "number" FROM table_204_867 WHERE "name" = 'lynda lyon block') + 1
squall
CREATE TABLE table_10968 ( "Race" text, "Circuit" text, "Date" text, "Pole position" text, "Fastest lap" text, "Winning driver" text, "Constructor" text, "Tyre" text, "Report" text )
Tell me the fastest lapf or jim clark being the winning driver for prince george
SELECT "Fastest lap" FROM table_10968 WHERE "Winning driver" = 'jim clark' AND "Circuit" = 'prince george'
wikisql
CREATE TABLE table_7114 ( "Year" real, "Conventional plans" text, "HMOs" text, "PPOs" text, "POS plans" text )
Which HMO has a conventional plan of 3% in 2005?
SELECT "HMOs" FROM table_7114 WHERE "Conventional plans" = '3%' AND "Year" = '2005'
wikisql
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospit...
number of times patient 016-26884 was prescribed insulin aspart 100 unit/ml sc soln since 2102.
SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-26884')) AND medication.drugname = 'insulin aspart 100 unit/ml sc soln' AN...
eicu
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JO...
For all employees who have the letters D or S in their first name, draw a line chart about the change of commission_pct over hire_date , and list in descending by the x-axis please.
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE DESC
nvbench
CREATE TABLE protein ( common_name text, protein_name text, divergence_from_human_lineage real, accession_number text, sequence_length real, sequence_identity_to_human_protein text, Institution_id text ) CREATE TABLE building ( building_id text, Name text, Street_address text, ...
Please give me a bar chart showing institution types, along with the total enrollment for each type, and show Y-axis from low to high order.
SELECT Type, SUM(Enrollment) FROM Institution GROUP BY Type ORDER BY SUM(Enrollment)
nvbench
CREATE TABLE table_name_22 ( attendance INTEGER, date VARCHAR, week VARCHAR )
before week 12 what was the attendance on 1983-11-21?
SELECT SUM(attendance) FROM table_name_22 WHERE date = "1983-11-21" AND week < 12
sql_create_context
CREATE TABLE table_10062 ( "Railway" text, "Builder" text, "Built" text, "Wheels" text, "Location" text, "ObjectNumber" text )
Which railway was built in 1920?
SELECT "Railway" FROM table_10062 WHERE "Built" = '1920'
wikisql
CREATE TABLE table_name_42 ( level INTEGER, example_name VARCHAR, number_of_hus__approximate_ VARCHAR )
What is the mean level number when the example name is lower snake and the approximate number is hus is less than 370?
SELECT AVG(level) FROM table_name_42 WHERE example_name = "lower snake" AND number_of_hus__approximate_ < 370
sql_create_context
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined b...
Posts with given word in some of the past revision but not in the current one.
SELECT DISTINCT p.Id AS "post_link", p.OwnerUserId AS "user_link", p.LastActivityDate, p.CreationDate, url = 'site://posts/' + CAST(p.Id AS TEXT) + '/revisions' FROM Posts AS p JOIN PostHistory AS ph ON (ph.PostId = p.Id) WHERE (ph.Text LIKE '%##word?Chebychev##%') AND NOT (p.Body LIKE '%##word##%') ORDER BY p.LastActi...
sede
CREATE TABLE table_73154 ( "#" real, "Episode" text, "UK air date" text, "Timeslot" text, "Viewers (millions)" text, "Audience share in timeslot" text )
name the total number of timeslot for number 1
SELECT COUNT("Timeslot") FROM table_73154 WHERE "#" = '1'
wikisql
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
what were the marital status of patient 40967 in their last hospital visit?
SELECT admissions.marital_status FROM admissions WHERE admissions.subject_id = 40967 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1
mimic_iii
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugsto...
what were the three most commonly given procedures for patients who had previously received a oxygen therapy (> 60%) - face mask within the same month, since 6 years ago?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'oxygen therapy (> 60%) - face mask' AND ...
eicu
CREATE TABLE table_12338595_1 ( swimsuit VARCHAR, state VARCHAR )
What swimsuit score did the state of Virginia contestant achieve?
SELECT COUNT(swimsuit) FROM table_12338595_1 WHERE state = "Virginia"
sql_create_context
CREATE TABLE table_23802 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "College" text )
Name the number for dl
SELECT "Pick #" FROM table_23802 WHERE "Position" = 'DL'
wikisql
CREATE TABLE table_17086 ( "Player" text, "Position" text, "School" text, "Hometown" text, "College" text )
What position is Charone Peake?
SELECT "Position" FROM table_17086 WHERE "Player" = 'Charone Peake'
wikisql
CREATE TABLE table_10190 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
If the away teams score was 15.6 (96), what venue did they play at?
SELECT "Venue" FROM table_10190 WHERE "Away team score" = '15.6 (96)'
wikisql
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE intakeoutput ( i...
in 06/last year, how much did patient 006-50368 weigh for the last time?
SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-50368') AND NOT patient.admissionweight IS NULL AND DATETIME(patient.unitadmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-...
eicu
CREATE TABLE table_44049 ( "Class" text, "Wheel arrangement" text, "Manufacturer" text, "Year made" text, "Quantity made" text, "Quantity preserved" text )
What is Wheel Arrangement, when Manufacturer is 'Baldwin', and when Quantity Made is 12?
SELECT "Wheel arrangement" FROM table_44049 WHERE "Manufacturer" = 'baldwin' AND "Quantity made" = '12'
wikisql
CREATE TABLE table_name_5 ( meet VARCHAR, time VARCHAR )
What Meet has a Time of 1:04.84?
SELECT meet FROM table_name_5 WHERE time = "1:04.84"
sql_create_context
CREATE TABLE table_71674 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
What is Team 1 Al-Hilal's Agg.?
SELECT "Agg." FROM table_71674 WHERE "Team 1" = 'al-hilal'
wikisql
CREATE TABLE table_21321804_1 ( pick__number INTEGER, player VARCHAR )
What is the pick # for player wes lysack?
SELECT MAX(pick__number) FROM table_21321804_1 WHERE player = "Wes Lysack"
sql_create_context
CREATE TABLE table_44149 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Record" text, "Attendance" real )
What was the record on the date of november 10, 1968?
SELECT "Record" FROM table_44149 WHERE "Date" = 'november 10, 1968'
wikisql
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
How many patients stayed in hospital for more than 27 days and got diagnosed for intermed coronary synd?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "27" AND diagnoses.short_title = "Intermed coronary synd"
mimicsql_data
CREATE TABLE table_name_35 ( principal_victims VARCHAR, nat VARCHAR, where_sunk VARCHAR )
Who were the victims of the US ship that sank in the Mississippi River near Memphis?
SELECT principal_victims FROM table_name_35 WHERE nat = "us" AND where_sunk = "mississippi river near memphis"
sql_create_context
CREATE TABLE table_2953 ( "Competition" text, "Final position" text, "First match" text, "Last match" text, "Final Place" text )
Name the final position for copa libertadores
SELECT "Final position" FROM table_2953 WHERE "Competition" = 'Copa Libertadores'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
在2008年5月6日到2018年12月14日内医疗机构5821579的检查费有多少?
SELECT SUM(t_kc22.AMOUNT) FROM t_kc22 WHERE t_kc22.t_kc21_MED_SER_ORG_NO = '5821579' AND t_kc22.STA_DATE BETWEEN '2008-05-06' AND '2018-12-14' AND t_kc22.MED_INV_ITEM_TYPE = '检查费'
css
CREATE TABLE table_name_41 ( points INTEGER, chassis VARCHAR, year VARCHAR )
What are the highest points with a Chassis of gordini t16, and a Year smaller than 1954?
SELECT MAX(points) FROM table_name_41 WHERE chassis = "gordini t16" AND year < 1954
sql_create_context
CREATE TABLE enrolled_in ( stuid number, cid text, grade text ) CREATE TABLE faculty ( facid number, lname text, fname text, rank text, sex text, phone number, room text, building text ) CREATE TABLE member_of ( facid number, dno number, appt_type text ) CREATE...
What is the maximum and minimum grade point of students who live in NYC?
SELECT MAX(T2.gradepoint), MIN(T2.gradepoint) FROM enrolled_in AS T1 JOIN gradeconversion AS T2 JOIN student AS T3 ON T1.grade = T2.lettergrade AND T1.stuid = T3.stuid WHERE T3.city_code = "NYC"
spider
CREATE TABLE table_name_4 ( away_team VARCHAR, score VARCHAR )
Which Away team has a Score of 0 3?
SELECT away_team FROM table_name_4 WHERE score = "0–3"
sql_create_context
CREATE TABLE gwyjzb ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
自二零零九年二月五日开始,截止到二零一零年十二月二十三日,患者07777908的在医治时做过几次检查
SELECT COUNT(*) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_ID = '07777908' AND t_kc22.STA_DATE BETWEEN '2009-02-05' AND '2010-12-23' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' UNION SELECT COUNT(*) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE f...
css
CREATE TABLE table_13841 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Notes" text )
Which Notes have a Year of 2002?
SELECT "Notes" FROM table_13841 WHERE "Year" = '2002'
wikisql
CREATE TABLE table_4918 ( "Lane" real, "Name" text, "Nationality" text, "50m Split" real, "Time" text )
What was Arkady Vyatchanin's time?
SELECT "Time" FROM table_4918 WHERE "Name" = 'arkady vyatchanin'
wikisql
CREATE TABLE table_44939 ( "Date" text, "Rank" real, "Weekend Gross" text, "Theaters" real, "Gross-to-date" text )
Name the Gross-to-date which has a Date of august 23 25?
SELECT "Gross-to-date" FROM table_44939 WHERE "Date" = 'august 23–25'
wikisql
CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_p...
Next semester , who is going to teach ANTHRBIO 475 ?
SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN course ON course.course_id = course_offering.course_id INNER JOIN semester...
advising
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number...
Top users in a tag by score and answer count.
SELECT TagUsers.UserLink AS "user_link", TagUsers.Score AS Score, TagUsers.Count AS "count", (TagUsers.Score + TagUsers.Count) / 2.0 AS Total FROM (SELECT a.OwnerUserId AS UserLink, SUM(a.Score) / 10.0 AS Score, COUNT(a.Score) AS "count" FROM Posts AS a, Posts AS q INNER JOIN PostTags AS pt ON q.Id = pt.PostId INNER JO...
sede
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) C...
information on AA flight from WASHINGTON to PHILADELPHIA
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 = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = '...
atis
CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDispl...
SWL questions with low scoring answers and no accepted answer.
SELECT q.Id AS "post_link", q.CreationDate, COUNT(a.Id) AS answers, MAX(a.Score) AS max_score FROM Posts AS q LEFT JOIN Posts AS a ON a.ParentId = q.Id WHERE q.PostTypeId = 1 AND q.AcceptedAnswerId IS NULL AND q.Tags LIKE '%star-trek%' AND q.DeletionDate IS NULL AND q.ClosedDate IS NULL GROUP BY q.Id, q.CreationDate HA...
sede
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
门诊诊断患者99012820为特发性肌张力障碍,他的检测指标203759的结果定量以及单位数据分别是什么?
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.Y...
css
CREATE TABLE table_25818630_2 ( candidate VARCHAR, result____percentage VARCHAR )
Who as the candidate when the result - % was 2.9%?
SELECT candidate FROM table_25818630_2 WHERE result____percentage = "2.9%"
sql_create_context
CREATE TABLE table_51555 ( "Race" text, "Candidate" text, "Party" text, "Notes" text, "Votes" real )
Who is the candidate in Race for State representative, hd18?
SELECT "Candidate" FROM table_51555 WHERE "Race" = 'state representative, hd18'
wikisql
CREATE TABLE table_19167 ( "State" text, "Highest point" text, "Highest elevation" text, "Lowest point" text, "Lowest elevation" text, "Mean elevation" text )
what's the lowest elevation with highest point being charles mound
SELECT "Lowest elevation" FROM table_19167 WHERE "Highest point" = 'Charles Mound'
wikisql
CREATE TABLE table_1964010_2 ( opponents VARCHAR, score VARCHAR )
Who are the opponents of Mike Byron and partner in matches where the score was 6 4, 4 6, 7 6 (7 4)?
SELECT opponents FROM table_1964010_2 WHERE score = "6–4, 4–6, 7–6 (7–4)"
sql_create_context
CREATE TABLE table_43145 ( "Year" real, "Men's singles" text, "Women's singles" text, "Men's doubles" text, "Women's doubles" text, "Mixed doubles" text )
Which men's singles had a women's doubles team of irena ferencov / yweta trminkov ?
SELECT "Men's singles" FROM table_43145 WHERE "Women's doubles" = 'irena ferencová / yweta trminková'
wikisql
CREATE TABLE table_15013825_8 ( team VARCHAR, copa_conmebol_1992 VARCHAR )
Name the team for copa conmebol 1992 is round of 16
SELECT team FROM table_15013825_8 WHERE copa_conmebol_1992 = "Round of 16"
sql_create_context
CREATE TABLE table_77989 ( "Date" text, "Ship" text, "Type" text, "Nationality" text, "Tonnage GRT" real )
what is the most tonnage grt of any ship sunk or captured on 16 jan 16?
SELECT MAX("Tonnage GRT") FROM table_77989 WHERE "Date" = '16 jan 16'
wikisql
CREATE TABLE table_name_2 ( height VARCHAR, date_of_birth VARCHAR )
How tall is the person born on 1976-12-27?
SELECT height FROM table_name_2 WHERE date_of_birth = "1976-12-27"
sql_create_context
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
查查编号为59839403的病患被开出过药品金额超过2930.76元的医疗记录,看看这些医疗就诊的编码
SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_ID = '59839403' AND MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc22 WHERE AMOUNT > 2930.76)
css
CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Description VARCHAR(255) ) CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME, Day_Number INTEGER ) CREATE TABLE Roles ( Role_Code CHAR(15), Role_Name VARCHAR(255), Role_Description VARCHAR(255) )...
Display a bar chart for what is the code of each location and the number of documents in that location?
SELECT Location_Code, COUNT(*) FROM Document_Locations GROUP BY Location_Code
nvbench
CREATE TABLE table_name_22 ( round INTEGER, player VARCHAR, overall VARCHAR )
In which round did Paul McDonald have an overall greater than 109?
SELECT MAX(round) FROM table_name_22 WHERE player = "paul mcdonald" AND overall > 109
sql_create_context
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0...
For all employees who have the letters D or S in their first name, draw a bar chart about the distribution of hire_date and the average of salary bin hire_date by time, I want to sort in asc by the Y-axis.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(SALARY)
nvbench
CREATE TABLE table_216776_2 ( municipality VARCHAR, population__2010_ VARCHAR )
What municipality had 26839 people living in it in 2010?
SELECT municipality FROM table_216776_2 WHERE population__2010_ = 26839
sql_create_context
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date...
For those employees who was hired before 2002-06-21, give me the comparison about the average of manager_id over the job_id , and group by attribute job_id by a bar chart.
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID
nvbench
CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments ...
For the Spring or Summer term , are there any 500 -level classes ?
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 500 AND 500 + 100 AND semester.semester IN ('SP', 'SS', 'SU') AND semester.semester_id = cou...
advising
CREATE TABLE table_204_801 ( id number, "year" number, "derby\nwinner" text, "galaxy" number, "draw" number, "chivas" number )
how many times has galaxy won the derby ?
SELECT COUNT(*) FROM table_204_801 WHERE "derby\nwinner" = 'galaxy'
squall
CREATE TABLE table_name_8 ( tournament VARCHAR, date VARCHAR )
What tournament was played on May 29, 2010?
SELECT tournament FROM table_name_8 WHERE date = "may 29, 2010"
sql_create_context
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, ...
how many patients are diagnosed for atherosclerosis of native arteries of the extremities with intermittent claudication and had lab test abnormal status as abnormal?
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.long_title = "Atherosclerosis of native arteries of the extremities with intermittent claudication" AND lab.flag = "abnormal"
mimicsql_data
CREATE TABLE table_49275 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text, "Points" real )
Which visitor lives in Minnesota?
SELECT "Visitor" FROM table_49275 WHERE "Home" = 'minnesota'
wikisql
CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city var...
What are the offerings of upper level electives for CS majors ?
SELECT DISTINCT course.department, course.name, course.number FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id
advising
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 medication ( medi...
had a peep lab test patient 017-13959 received since 06/2104?
SELECT COUNT(*) > 0 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-13959')) AND lab.labname = 'peep' AND STRFTIME('%y-%m', lab.labresulttime) >= '2104-...
eicu
CREATE TABLE repair_assignment ( technician_id int, repair_ID int, Machine_ID int ) CREATE TABLE technician ( technician_id real, Name text, Team text, Starting_Year real, Age int ) CREATE TABLE machine ( Machine_ID int, Making_Year int, Class text, Team text, Machi...
Show different teams of technicians and the number of technicians in each team in a pie chart.
SELECT Team, COUNT(*) FROM technician GROUP BY Team
nvbench
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
what was the medication patient 26398 had been prescribed two or more times in the previous month?
SELECT t1.drug FROM (SELECT prescriptions.drug, COUNT(prescriptions.startdate) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26398) AND DATETIME(prescriptions.startdate, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 ...
mimic_iii
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_...
how many hours has it passed since the last time that patient 5828 stayed in ward 57 during their current hospital visit?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5828 AND admissions.dischtime IS NULL)) AND transfers....
mimic_iii
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
从2014-03-30到2020-03-19,哪个工号什么名字的医务人员在患者奚信瑞就诊时为其检测罗马指数(绝经前)的
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzj...
css
CREATE TABLE table_name_52 ( success_rate VARCHAR, year VARCHAR )
What is the success rate for the year 2012?
SELECT success_rate FROM table_name_52 WHERE year = "2012"
sql_create_context
CREATE TABLE table_54151 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
Where is the Venue that has an away team score of 13.16 (94) points?
SELECT "Venue" FROM table_54151 WHERE "Away team score" = '13.16 (94)'
wikisql
CREATE TABLE table_2202 ( "Index (Year)" text, "Author / Editor / Source" text, "Year of publication" text, "Countries sampled" real, "World Ranking (1)" text, "Ranking L.A. (2)" text )
How many countries were sampled for the Prosperity Index (2008)?
SELECT MAX("Countries sampled") FROM table_2202 WHERE "Index (Year)" = 'Prosperity Index (2008)'
wikisql
CREATE TABLE table_name_79 ( population__2009_estimate_ VARCHAR, largest_city VARCHAR )
What is the 2009 estimate population of the region with Manaus as the largest city?
SELECT population__2009_estimate_ FROM table_name_79 WHERE largest_city = "manaus"
sql_create_context
CREATE TABLE table_26713 ( "Legion no and title" text, "Main legion base" text, "Emblem" text, "Date founded/ founder" text, "Date disband" text, "Castra legionaria (legion bases) * = main base. Start date 31 BC if unspecified" text, "Notes" text )
What is the main legion base that disbanded 70 xx?
SELECT "Main legion base" FROM table_26713 WHERE "Date disband" = '70 XX'
wikisql
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
Which department does The Good Life Fall under ?
SELECT DISTINCT department FROM course WHERE name LIKE '%The Good Life%'
advising
CREATE TABLE problem_log ( problem_log_id VARCHAR, log_entry_description VARCHAR )
List all the log ids and their descriptions from the problem logs.
SELECT problem_log_id, log_entry_description FROM problem_log
sql_create_context
CREATE TABLE table_name_79 ( frequency INTEGER, website VARCHAR )
What is the highest frequency from uncionfeypoder.com?
SELECT MAX(frequency) FROM table_name_79 WHERE website = "uncionfeypoder.com"
sql_create_context
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...
provide the number of patients whose gender is f and days of hospital stay is greater than 16?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.days_stay > "16"
mimicsql_data
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
what is procedure icd9 code and procedure long title of subject name jonathan wiggins?
SELECT procedures.icd9_code, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Jonathan Wiggins"
mimicsql_data
CREATE TABLE table_20354_5 ( zodiac_sign VARCHAR, thai_name VARCHAR )
What's the zodiac sign for the month with Thai name ?
SELECT zodiac_sign FROM table_20354_5 WHERE thai_name = "มกราคม"
sql_create_context
CREATE TABLE table_75811 ( "Member State sorted by GDP" text, "GDP in s billion of USD (2012)" real, "GDP % of EU (2012)" text, "Annual change % of GDP (2012)" text, "GDP per capita in PPP US$ (2012)" real, "Public Debt % of GDP (2013 Q1)" real, "Deficit (-)/ Surplus (+) % of GDP (2012)" tex...
What is the largest inflation % annual in 2012 of the country with a public debt % of GDP in 2013 Q1 greater than 88.2 and a GDP % of EU in 2012 of 2.9%?
SELECT MAX("Inflation % Annual (2012)") FROM table_75811 WHERE "Public Debt % of GDP (2013 Q1)" > '88.2' AND "GDP % of EU (2012)" = '2.9%'
wikisql
CREATE TABLE table_26847237_3 ( home_team VARCHAR, opposition VARCHAR )
what is the home team when the opposition is east coast?
SELECT home_team FROM table_26847237_3 WHERE opposition = "East Coast"
sql_create_context
CREATE TABLE table_203_611 ( id number, "player" text, "hr" number, "date reached 500 hr" text, "team" text, "seasons played" text )
which player has the highest number of career home runs ?
SELECT "player" FROM table_203_611 ORDER BY "hr" DESC LIMIT 1
squall
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospit...
what are the changes in patient 016-29746's direct bilirubin values measured at 2104-07-19 19:27:36 compared to the value measured at 2104-04-05 07:18:00?
SELECT (SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-29746')) AND lab.labname = 'direct bilirubin' AND lab.labresulttime = '2104...
eicu
CREATE TABLE table_name_23 ( title VARCHAR, podcast_date VARCHAR )
What is the title of the episode that aired on September 25, 2005?
SELECT title FROM table_name_23 WHERE podcast_date = "september 25, 2005"
sql_create_context
CREATE TABLE table_24798 ( "District" text, "Municipalities" real, "Parishes" real, "Province of 1936" text, "Region" text )
Name the parishes for beira baixa province
SELECT COUNT("Parishes") FROM table_24798 WHERE "Province of 1936" = 'Beira Baixa Province'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
count the number of patients whose admission type is newborn and days of hospital stay is greater than 8?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.days_stay > "8"
mimicsql_data
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text,...
Greece 1000 with Row Number.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS Place, Id AS "user_link", Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%Thess%' OR Location LIKE '%Greece%' OR Location LIKE N'%Gr' OR (Location LIKE N'%Athens%' AND NOT Location LIKE N'%GA%') ORDER BY Reputation DESC LIMIT 1000
sede
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 ) ...
how many patients whose admission location is trsf within this facility and procedure icd9 code is 8857?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND procedures.icd9_code = "8857"
mimicsql_data
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 employees ( EMPLOYE...
Line chart, the X is the hire date of employees and the Y-axis is the corresponding salary, and I want to list X-axis from high to low order.
SELECT HIRE_DATE, SALARY FROM employees ORDER BY HIRE_DATE DESC
nvbench
CREATE TABLE table_25302 ( "Station" text, "Line(s)" text, "City/Neighborhood" text, "Year opened" real, "Transit Connections" text, "Park and ride?" text )
What's the transit connection in Columbia City, Seattle?
SELECT "Transit Connections" FROM table_25302 WHERE "City/Neighborhood" = 'Columbia City, Seattle'
wikisql
CREATE TABLE table_34649 ( "Draw" real, "Singer" text, "Song" text, "Points" real, "Place" real )
What are the Points when the Place is 9?
SELECT "Points" FROM table_34649 WHERE "Place" = '9'
wikisql
CREATE TABLE table_name_71 ( bronze INTEGER, gold VARCHAR, total VARCHAR )
What is the lowest number of bronze medals for nations with over 6 total and 2 golds?
SELECT MIN(bronze) FROM table_name_71 WHERE gold = 2 AND total > 6
sql_create_context
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patie...
among patients who were prescribed fentanyl citrate 0.05 mg/ml ij soln after they had been diagnosed with pleural effusion - right show me the four year survival rate.
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 4 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid...
eicu
CREATE TABLE table_17441 ( "Date" text, "Winning Team" text, "Score" text, "Winning Pitcher" text, "Losing Pitcher" text, "Attendance" real, "Location" text )
How many games were on May 20?
SELECT COUNT("Attendance") FROM table_17441 WHERE "Date" = 'May 20'
wikisql
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Votes ( Id number, PostId number, ...
top 10 users from Bengaluru India.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location FROM Users WHERE LOWER(Location) LIKE '%Bengaluru%' OR UPPER(Location) LIKE '%Bengaluru%' OR Location LIKE '%Bengaluru%' OR LOWER(Location) LIKE '%Bangalore%' OR UPPER(Location) LIKE '%Bangalore%' OR Location LIKE '%Bang...
sede
CREATE TABLE Documents ( document_id INTEGER, document_type_code VARCHAR(10), grant_id INTEGER, sent_date DATETIME, response_received_date DATETIME, other_details VARCHAR(255) ) CREATE TABLE Tasks ( task_id INTEGER, project_id INTEGER, task_details VARCHAR(255), "eg Agree Object...
When do all the researcher role staff stop working? Bin the time into weekday interval and count them with a bar chart.
SELECT date_to, COUNT(date_to) FROM Project_Staff
nvbench
CREATE TABLE table_name_31 ( college_junior_club_team VARCHAR, position VARCHAR, pick__number VARCHAR )
What College/junior/club team has a Position of centre, and pick is #22?
SELECT college_junior_club_team FROM table_name_31 WHERE position = "centre" AND pick__number = "22"
sql_create_context