context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_15872814_7 ( team VARCHAR, high_assists VARCHAR )
What team had high assists Rafer Alston (5)?
SELECT team FROM table_15872814_7 WHERE high_assists = "Rafer Alston (5)"
sql_create_context
CREATE TABLE table_name_8 ( gauge VARCHAR, concessionaire VARCHAR )
What was the guage of the concessionaire ferrosur roca?
SELECT gauge FROM table_name_8 WHERE concessionaire = "ferrosur roca"
sql_create_context
CREATE TABLE Documents ( Document_ID INTEGER, Document_Type_Code CHAR(15), Project_ID INTEGER, Document_Date DATETIME, Document_Name VARCHAR(255), Document_Description VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Statements ( Statement_ID INTEGER, Statement_Details VARCHA...
Show the number of documents in each day for all documents on project with details 'Graph Database project' and bin document date by year interval with a line chart.
SELECT Document_Date, COUNT(Document_Date) FROM Documents AS T1 JOIN Projects AS T2 ON T1.Project_ID = T2.Project_ID WHERE T2.Project_Details = 'Graph Database project'
nvbench
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 primary disease is hemopytsis and drug type is base?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "HEMOPYTSIS" AND prescriptions.drug_type = "BASE"
mimicsql_data
CREATE TABLE table_name_41 ( length VARCHAR, stage VARCHAR )
Name the length for stage of ss6
SELECT length FROM table_name_41 WHERE stage = "ss6"
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE lab ( labid number, pa...
in total, count the number of patients who have been prescribed albuterol neb until 1 year ago.
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'albuterol neb' AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-1 year'))
eicu
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...
tell me both the short title and long title of diagnoses for diagnoses icd9 code 7596.
SELECT diagnoses.short_title, diagnoses.long_title FROM diagnoses WHERE diagnoses.icd9_code = "7596"
mimicsql_data
CREATE TABLE table_name_12 ( track INTEGER, catalogue VARCHAR, time VARCHAR )
What is the sum of every track with a catalogue of EPA 4054 with a 2:05 length?
SELECT SUM(track) FROM table_name_12 WHERE catalogue = "epa 4054" AND time = "2:05"
sql_create_context
CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE dataset ( datasetid int, datase...
What area cites ras bodik ?
SELECT DISTINCT field.fieldid FROM author, field, paper, paperfield, writes WHERE author.authorname = 'ras bodik' AND paperfield.fieldid = field.fieldid AND paper.paperid = paperfield.paperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
scholar
CREATE TABLE table_23044 ( "Week #" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text )
Name the week number for the beatles
SELECT "Week #" FROM table_23044 WHERE "Theme" = 'The Beatles'
wikisql
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number,...
what was the total hospital charge of patient 029-23889?
SELECT SUM(cost.cost) FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-23889')
eicu
CREATE TABLE table_204_678 ( id number, "record" text, "athlete" text, "nation" text, "venue" text, "date" text, "#" number )
which country is the only one to have only one record holder for pole vaulting ?
SELECT "nation" FROM table_204_678 GROUP BY "nation" HAVING COUNT(*) = 1
squall
CREATE TABLE table_38884 ( "Rider" text, "Bike" text, "Laps" real, "Time" text, "Grid" real )
Using a Ducati 999 F06 Bike, how many Laps with a Grid greater than 11 and Time of +53.488?
SELECT COUNT("Laps") FROM table_38884 WHERE "Bike" = 'ducati 999 f06' AND "Time" = '+53.488' AND "Grid" > '11'
wikisql
CREATE TABLE table_name_50 ( result VARCHAR, year VARCHAR, award VARCHAR )
In what year, prior to 2009, was the Mercury Prize awarded?
SELECT result FROM table_name_50 WHERE year < 2009 AND award = "mercury prize"
sql_create_context
CREATE TABLE table_13870 ( "Date" text, "Season" text, "Playing for" text, "Opponent" text, "Final score" text )
what is the final score when the date is 2009-02-26?
SELECT "Final score" FROM table_13870 WHERE "Date" = '2009-02-26'
wikisql
CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE paperfield ( fieldid int, paperid int...
papers citing oren etzioni
SELECT DISTINCT paper.paperid FROM author, cite, paper, writes WHERE author.authorname = 'oren etzioni' AND paper.paperid = cite.citingpaperid AND writes.authorid = author.authorid AND writes.paperid = cite.citedpaperid
scholar
CREATE TABLE table_28138035_4 ( year_location VARCHAR, womens_singles VARCHAR )
Name the year location for haruna fukuoka
SELECT year_location FROM table_28138035_4 WHERE womens_singles = "Haruna Fukuoka"
sql_create_context
CREATE TABLE zzmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZ...
列出患者43772576所有检验结果指标记录中的仪器编号以及名称在2005-02-16到2014-01-13内均为什么?
SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH ...
css
CREATE TABLE table_name_74 ( name__year_commissioned_ VARCHAR, from_to VARCHAR )
What is the name of the line from Karratha to Port Hedland?
SELECT name__year_commissioned_ FROM table_name_74 WHERE from_to = "karratha to port hedland"
sql_create_context
CREATE TABLE table_11684 ( "Nation" text, "Gold" text, "Silver" text, "Bronze" text, "Total" real )
How many total medals for the netherlands?
SELECT SUM("Total") FROM table_11684 WHERE "Nation" = 'netherlands'
wikisql
CREATE TABLE table_72460 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
How many people had the high assists @ minnesota?
SELECT COUNT("High assists") FROM table_72460 WHERE "Team" = '@ Minnesota'
wikisql
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ...
Potentially useless comments to flag.
SELECT PostId AS "post_link", Score, Text, CreationDate, PostId FROM Comments WHERE LENGTH(Text) < 25 AND Text LIKE '%Thank%' ORDER BY CreationDate DESC
sede
CREATE TABLE table_43359 ( "Outcome" text, "Date" text, "Championship" text, "Surface" text, "Opponent" text, "Score" text )
What is the Surface when the score was 4 6, 6 3, 6 7 (5 7)?
SELECT "Surface" FROM table_43359 WHERE "Score" = '4–6, 6–3, 6–7 (5–7)'
wikisql
CREATE TABLE table_name_66 ( position VARCHAR, caps VARCHAR, player VARCHAR )
What is Position, when Caps is Example, and When Player is Shane Kelly?
SELECT position FROM table_name_66 WHERE caps = "example" AND player = "shane kelly"
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...
give me the number of patients whose drug code is atro1i?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "ATRO1I"
mimicsql_data
CREATE TABLE table_63065 ( "Date" text, "Venue" text, "Result" text, "Scored" real, "Competition" text )
What competition has a Result of 1 2?
SELECT "Competition" FROM table_63065 WHERE "Result" = '1–2'
wikisql
CREATE TABLE table_name_5 ( qual_2 VARCHAR, best VARCHAR )
Who in Qual 2 had the best time of 1:31.327?
SELECT qual_2 FROM table_name_5 WHERE best = "1:31.327"
sql_create_context
CREATE TABLE table_28523 ( "Institution" text, "Location" text, "Founded" real, "Type" text, "Enrollment" real, "Joined" text, "Left" text, "Nickname" text, "Primary Conference when joining the MSFA" text, "Current Primary Conference" text )
What location has a school with enrollment of 850?
SELECT "Location" FROM table_28523 WHERE "Enrollment" = '850'
wikisql
CREATE TABLE table_name_73 ( ch_1 VARCHAR, region_served VARCHAR )
What is the Ch1 in the region served by Central Tablelands?
SELECT ch_1 FROM table_name_73 WHERE region_served = "central tablelands"
sql_create_context
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_40...
Find the names of stadiums that some Australian swimmers have been to, and count them by a bar chart, and order from high to low by the bar.
SELECT T4.Name, COUNT(T4.Name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID JOIN event AS t3 ON t2.Event_ID = t3.ID JOIN stadium AS t4 ON t4.ID = t3.Stadium_ID WHERE t1.Nationality = 'Australia' GROUP BY T4.Name ORDER BY T4.Name DESC
nvbench
CREATE TABLE table_206419_3 ( s_b_share VARCHAR, shareholder VARCHAR )
What is the s B share for Handelsbanken funds incl XACT?
SELECT s_b_share FROM table_206419_3 WHERE shareholder = "Handelsbanken funds incl XACT"
sql_create_context
CREATE TABLE table_27657925_1 ( no_in_series VARCHAR, us_viewers__millions_ VARCHAR )
When there are 5.2 million u.s. viewers how many numbers in series are there?
SELECT COUNT(no_in_series) FROM table_27657925_1 WHERE us_viewers__millions_ = "5.2"
sql_create_context
CREATE TABLE table_name_58 ( events VARCHAR, cuts_made VARCHAR, top_10 VARCHAR )
What is the total number of events that had 34 cuts and 3 in the top 10?
SELECT COUNT(events) FROM table_name_58 WHERE cuts_made < 34 AND top_10 > 3
sql_create_context
CREATE TABLE table_40541 ( "Air Date" text, "Timeslot" text, "Rating" real, "Share" real, "18-49" text, "Viewers" real, "Weekly Rank" text )
What is the average share at 8:00 p.m., and an 18-49 of 1.3/4 with an air date of April 4, 2008?
SELECT AVG("Share") FROM table_40541 WHERE "Timeslot" = '8:00 p.m.' AND "18-49" = '1.3/4' AND "Air Date" = 'april 4, 2008'
wikisql
CREATE TABLE table_name_81 ( tournament VARCHAR, opponent_in_the_final VARCHAR )
Which tournament has marielle bruens for the opponent in the final?
SELECT tournament FROM table_name_81 WHERE opponent_in_the_final = "marielle bruens"
sql_create_context
CREATE TABLE table_203_208 ( id number, "team" text, "location" text, "venue" text, "capacity" number, "position in 1993-94" number )
what were the total amount of times minsk is listed as a location ?
SELECT COUNT(*) FROM table_203_208 WHERE "location" = 'minsk'
squall
CREATE TABLE table_25140 ( "Position" real, "2005\u20132006" text, "2006\u20132007" text, "2007\u20132008" text, "2008\u20132009" text, "2009\u20132010" text )
who was position 3 in 2007-2008?
SELECT "2007\u20132008" FROM table_25140 WHERE "Position" = '3'
wikisql
CREATE TABLE table_name_86 ( city VARCHAR, sport VARCHAR, _number_of_titles VARCHAR, last VARCHAR )
What city is the school that had less than 17 titles in boys basketball with the last title being after 2005?
SELECT city FROM table_name_86 WHERE _number_of_titles < 17 AND last > 2005 AND sport = "boys basketball"
sql_create_context
CREATE TABLE table_73738 ( "Year" real, "Division" real, "League" text, "Reg. Season" text, "Playoffs" text, "Open Cup" text )
Mame the reg season for 2001
SELECT "Reg. Season" FROM table_73738 WHERE "Year" = '2001'
wikisql
CREATE TABLE table_38476 ( "School Year" text, "Class A" text, "Class AA" text, "Class AAA" text, "Class AAAA" text, "Class AAAAA" text )
What is the Class AA of the school year 2009-10 with a class AAA of Giddings?
SELECT "Class AA" FROM table_38476 WHERE "Class AAA" = 'giddings' AND "School Year" = '2009-10'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
count the number of patients whose marital status is widowed and lab test fluid is cerebrospinal fluid (csf)?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "WIDOWED" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
mimicsql_data
CREATE TABLE table_57526 ( "Class" text, "Type" text, "Introduced" text, "Fleet Size" real, "Numbers" text )
What is the average fleet size for the Shunter type introduced in 1959?
SELECT AVG("Fleet Size") FROM table_57526 WHERE "Type" = 'shunter' AND "Introduced" = '1959'
wikisql
CREATE TABLE table_36265 ( "Date" text, "Episode" real, "Performer 1" text, "Performer 2" text, "Performer 3" text, "Performer 4" text )
Performer 1 of greg proops, and a Performer 3 of ryan stiles, and a Date of 25 august 1995 is which average episode?
SELECT AVG("Episode") FROM table_36265 WHERE "Performer 1" = 'greg proops' AND "Performer 3" = 'ryan stiles' AND "Date" = '25 august 1995'
wikisql
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
For those employees who did not have any job in the past, visualize a bar chart about the distribution of job_id and the sum of salary , and group by attribute job_id, display y-axis from low to high order.
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(SALARY)
nvbench
CREATE TABLE table_66110 ( "Japanese Title" text, "Romaji Title" text, "TV Station" text, "Episodes" real, "Average Ratings" text )
What is the Japanese title for the episode bigger than 10 on TBS with average ratings of 14.8%?
SELECT "Japanese Title" FROM table_66110 WHERE "Episodes" > '10' AND "TV Station" = 'tbs' AND "Average Ratings" = '14.8%'
wikisql
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
what is the age of the patient kelley gallardo?
SELECT demographic.age FROM demographic WHERE demographic.name = "Kelly Gallardo"
mimicsql_data
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) ...
calculate the number of patients who had stayed in careunit csru until 2104.
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT transfers.hadm_id FROM transfers WHERE transfers.careunit = 'csru' AND STRFTIME('%y', transfers.intime) <= '2104')
mimic_iii
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostLinks ( Id number, Crea...
Science on Drupal User Questions.
SELECT p.* FROM Users AS u, Posts AS p WHERE u.AboutMe LIKE '%@ScienceOnDrupal%' AND p.OwnerUserId = u.Id AND p.PostTypeId = 1 ORDER BY p.CreationDate
sede
CREATE TABLE table_21716139_1 ( frequency VARCHAR, destination VARCHAR )
What is the number of frequencies that have a destination of Jaipur?
SELECT COUNT(frequency) FROM table_21716139_1 WHERE destination = "Jaipur"
sql_create_context
CREATE TABLE table_42241 ( "City" text, "Province" text, "Country" text, "IATA" text, "Airport" text )
Which city's IATA is nkg?
SELECT "City" FROM table_42241 WHERE "IATA" = 'nkg'
wikisql
CREATE TABLE table_12437 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What is Home Team, when Date is '6 December 1986', and when Tie No is '4'?
SELECT "Home team" FROM table_12437 WHERE "Date" = '6 december 1986' AND "Tie no" = '4'
wikisql
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
列出在医院2797205中编号为16026423患者就诊科室名称包含足踝的所有门诊就诊记录的流水号是多少?
SELECT wdmzjzjlb.JZLSH FROM hz_info JOIN wdmzjzjlb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE hz_info.RYBH = '16026423' AND hz_info.YLJGDM = '2797205' AND wdmzjzjlb.JZKSMC LIKE '%足踝%' UNION SELECT bdmzjzjlb.JZLSH FROM hz_info JOIN bdmzjzjlb ON hz_info.YLJGDM...
css
CREATE TABLE table_204_558 ( id number, "name" text, "location" text, "city" text, "listing date" text )
which city is home to the greatest number of historic sites , existing or demolished ?
SELECT "city" FROM table_204_558 GROUP BY "city" ORDER BY COUNT(*) DESC LIMIT 1
squall
CREATE TABLE faculty ( facid number, lname text, fname text, rank text, sex text, phone number, room text, building text ) CREATE TABLE course ( cid text, cname text, credits number, instructor number, days text, hours text, dno number ) CREATE TABLE departm...
What are the names of departments either in division AS, or in division EN and in building NEB?
SELECT dname FROM department WHERE division = "AS" UNION SELECT dname FROM department WHERE division = "EN" AND building = "NEB"
spider
CREATE TABLE table_221315_3 ( max_altitude__miles_ VARCHAR, pilot VARCHAR )
What was the maximum altitude for Neil Armstrong?
SELECT max_altitude__miles_ FROM table_221315_3 WHERE pilot = "Neil Armstrong"
sql_create_context
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...
患者王飞燕有哪些门诊就诊的检验报告日期在2020-10-11以后?查询这些门诊就诊的流水号
SELECT wdmzjzjlb.JZLSH FROM person_info JOIN hz_info JOIN wdmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE person_info.XM = '王飞燕' AND NOT wdmzjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ <= '2020-10-1...
css
CREATE TABLE table_55676 ( "Romaji title" text, "Japanese title" text, "Release date" text, "Reference" text, "Oricon" real )
Which Oricon has a Romaji title of nakitakunalu?
SELECT MAX("Oricon") FROM table_55676 WHERE "Romaji title" = 'nakitakunalu'
wikisql
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, ...
在医院3985817全部医疗记录中参照科室的不同与出院诊断的差异算出患者年龄的平均数,把里面平均值超过23岁的记录留下来
SELECT gwyjzb.MED_ORG_DEPT_NM, gwyjzb.OUT_DIAG_DIS_NM, AVG(gwyjzb.PERSON_AGE) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '3985817' GROUP BY gwyjzb.MED_ORG_DEPT_NM, gwyjzb.OUT_DIAG_DIS_NM HAVING AVG(gwyjzb.PERSON_AGE) > 23 UNION SELECT fgwyjzb.MED_ORG_DEPT_NM, fgwyjzb.OUT_DIAG_DIS_NM, AVG(fgwyjzb.PERSON_AGE) FROM fgwyjzb...
css
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, ...
参保人编码为65953184入院整数金额次数有几次?
SELECT COUNT(*) FROM gwyjzb WHERE gwyjzb.PERSON_ID = '65953184' AND gwyjzb.CLINIC_TYPE = '住院' AND MOD(gwyjzb.MED_AMOUT, 1) = 0 UNION SELECT COUNT(*) FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '65953184' AND fgwyjzb.CLINIC_TYPE = '住院' AND MOD(fgwyjzb.MED_AMOUT, 1) = 0
css
CREATE TABLE table_1889233_2 ( parliament VARCHAR, general_election_contested VARCHAR )
What number parliament held it's election in 1997?
SELECT parliament FROM table_1889233_2 WHERE general_election_contested = 1997
sql_create_context
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_...
list all flights from BALTIMORE to ATLANTA after 1200 thursday nonstop
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((((flight.stops = 0) AND flight.departure_time > 1200) AND date_day.day_number = 24 AND date_day.month_number = 5 AND date_day.year = 1991 AND d...
atis
CREATE TABLE table_62080 ( "Companion (in order from star)" text, "Mass" text, "Semimajor axis ( AU )" text, "Orbital period ( s day )" text, "Eccentricity" text, "Inclination" text )
What Companion (in order from star) has an Orbital period (s day) of 9.6184 +0.0050 0.0049?
SELECT "Companion (in order from star)" FROM table_62080 WHERE "Orbital period ( s day )" = '9.6184 +0.0050 −0.0049'
wikisql
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, a bar chart shows the distribution of headquarter and the average of code , and group by attribute headquarter, and I want to rank from high to low by the Headquarter.
SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T2.Headquarter DESC
nvbench
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...
在医疗就诊40465384086中给许慧英这个病人做检验的科室是哪些?对应的编码是什么
SELECT jybgb.JYKSBM, jybgb.JYKSMC FROM jybgb WHERE jybgb.JZLSH = '40465384086'
css
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 those employees who was hired before 2002-06-21, show me about the change of employee_id over hire_date in a line chart, and sort by the x axis in asc.
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE
nvbench
CREATE TABLE professor ( emp_num number, dept_code text, prof_office text, prof_extension text, prof_high_degree text ) CREATE TABLE student ( stu_num number, stu_lname text, stu_fname text, stu_init text, stu_dob time, stu_hrs number, stu_class text, stu_gpa number,...
Find the name and address of the department that has the highest number of students.
SELECT T2.dept_name, T2.dept_address FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
查询52622012病患的检验报告单中结果指标均异常的检验报告单?需要检验报告的单号
SELECT jybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN jybgb 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 WHERE hz_info.RYBH = '52622012' AND NOT jybgb.BGDH IN (SELECT jyjgzbb.BGDH FROM jyjgzbb WH...
css
CREATE TABLE ORDER_ITEMS ( Order_Quantity INTEGER, Product_ID VARCHAR ) CREATE TABLE Products ( Product_ID VARCHAR, Product_Name VARCHAR )
What are the total order quantities of photo products?
SELECT SUM(T1.Order_Quantity) FROM ORDER_ITEMS AS T1 JOIN Products AS T2 ON T1.Product_ID = T2.Product_ID WHERE T2.Product_Name = "photo"
sql_create_context
CREATE TABLE airports ( country VARCHAR, elevation INTEGER )
Find the average elevation of all airports for each country.
SELECT AVG(elevation), country FROM airports GROUP BY country
sql_create_context
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
Stackoverflow top users from kerala.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%italy%' OR UPPER(Location) LIKE '%italy%' AND Reputation >= 200 ORDER BY Reputation DESC
sede
CREATE TABLE table_10754 ( "Species" text, "Strain" text, "Type" text, "Base Pairs" text, "Genes" real, "Reference" text )
what is the average genes when the reference is 2009 and the strain is rku-1?
SELECT AVG("Genes") FROM table_10754 WHERE "Reference" = '2009' AND "Strain" = 'rku-1'
wikisql
CREATE TABLE table_name_14 ( round INTEGER, opponent VARCHAR )
What round did Takayo Hashi face Yoko Hattori?
SELECT SUM(round) FROM table_name_14 WHERE opponent = "yoko hattori"
sql_create_context
CREATE TABLE train_station ( train_id number, station_id number ) CREATE TABLE station ( station_id number, name text, annual_entry_exit number, annual_interchanges number, total_passengers number, location text, main_services text, number_of_platforms number ) CREATE TABLE tra...
Show the station name with greatest number of trains.
SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_59352 ( "Player" text, "Round" real, "Pick" real, "Position" text, "NFL Club" text )
Who is the player from a round less than 13 and has a pick of 74?
SELECT "Player" FROM table_59352 WHERE "Round" < '13' AND "Pick" = '74'
wikisql
CREATE TABLE table_60421 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What was the score in Tie number 16?
SELECT "Score" FROM table_60421 WHERE "Tie no" = '16'
wikisql
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
what is the number of patients whose insurance is private and admission location is trsf within this facility?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.admission_location = "TRSF WITHIN THIS FACILITY"
mimicsql_data
CREATE TABLE table_48304 ( "Rank" real, "Company" text, "Headquarters" text, "Industry" text, "Sales (billion $)" real, "Profits (billion $)" real, "Assets (billion $)" real, "Market Value (billion $)" real )
What is the total market value in billions of the company with 20.96 billion in profits and less than 166.99 billions in assets?
SELECT COUNT("Market Value (billion $)") FROM table_48304 WHERE "Profits (billion $)" = '20.96' AND "Assets (billion $)" < '166.99'
wikisql
CREATE TABLE table_name_96 ( tournament VARCHAR, winner VARCHAR )
Which tournament did Patrick Rafter win?
SELECT tournament FROM table_name_96 WHERE winner = "patrick rafter"
sql_create_context
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE fare ( fare_id int, from_airport varchar, ...
what flights does US have from SAN FRANCISCO to PITTSBURGH on tuesday
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND date_day.day_number = 22 AND date_day.month_number = 3 A...
atis
CREATE TABLE table_51565 ( "Year" real, "Award" text, "Category" text, "Nomination" text, "Result" text )
What category was danson tang nominated?
SELECT "Category" FROM table_51565 WHERE "Nomination" = 'danson tang'
wikisql
CREATE TABLE table_24141 ( "Rank" real, "Commodity" text, "Value (Int $1000)" real, "Production (MT)" real, "Quantity world rank" text, "Value world rank" text )
where value world rank is 12, what is the quantity world rank?
SELECT "Quantity world rank" FROM table_24141 WHERE "Value world rank" = '12'
wikisql
CREATE TABLE table_name_23 ( opponents_in_the_final VARCHAR, surface VARCHAR, score VARCHAR )
Who were the opponents on a hard surface with a score of 6-4, 7-6(2)?
SELECT opponents_in_the_final FROM table_name_23 WHERE surface = "hard" AND score = "6-4, 7-6(2)"
sql_create_context
CREATE TABLE table_52638 ( "Date" text, "Competition" text, "Venue" text, "Result" text, "Score" text, "Goals" text )
I want the result for goals which has goals of deacon 6/6
SELECT "Result" FROM table_52638 WHERE "Goals" = 'deacon 6/6'
wikisql
CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConce...
Number of comments under questions posts.
SELECT COUNT(*) FROM Comments JOIN Posts ON Comments.PostId = Posts.Id WHERE Posts.PostTypeId = 1
sede
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, ...
病号13405731在19年2月9日到20年11月19日内被开出过哪些检验报告单它们的检验报告单号都是啥?
SELECT jybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN hz_info_mzjzjlb ON 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 mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info...
css
CREATE TABLE table_34825 ( "Year" real, "Class" text, "Team" text, "Points" real, "Wins" real )
How many wins have a year after 1976, and 350cc as the class?
SELECT SUM("Wins") FROM table_34825 WHERE "Year" > '1976' AND "Class" = '350cc'
wikisql
CREATE TABLE table_24978 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
Who is the player with the pick# 80?
SELECT "Player" FROM table_24978 WHERE "Pick #" = '80'
wikisql
CREATE TABLE zzmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZ...
病人韩飞烟在医疗机构8914725的门诊就诊过多少次?在2010-09-30到2019-07-07的这几年里
SELECT COUNT(*) FROM person_info JOIN hz_info JOIN zzmzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE person_info.XM = '韩飞烟' AND zzmzjzjlb.JZKSRQ BETWEEN '2010-09-30' AND '2019-07-07' AND zzmzjzjlb.YLJGDM = '8914725' UNI...
css
CREATE TABLE table_3968 ( "Proceed to Quarter-final" text, "Match points" text, "Aggregate score" text, "Points margin" real, "Eliminated from competition" text )
How many teams eliminated b ziers from competition?
SELECT COUNT("Match points") FROM table_3968 WHERE "Eliminated from competition" = 'Béziers'
wikisql
CREATE TABLE table_46188 ( "Fin. Pos" text, "Car No." text, "Driver" text, "Team" text, "Laps" text, "Time/Retired" text, "Grid" text, "Laps Led" text, "Points" text )
How many points were scored by car number 10 that ended with a collision?
SELECT "Points" FROM table_46188 WHERE "Time/Retired" = 'collision' AND "Car No." = '10'
wikisql
CREATE TABLE table_name_5 ( lost INTEGER, played INTEGER )
What was the average amount of losses for teams with played less than 14?
SELECT AVG(lost) FROM table_name_5 WHERE played < 14
sql_create_context
CREATE TABLE schedule ( Cinema_ID int, Film_ID int, Date text, Show_times_per_day int, Price float ) 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 cine...
Give me a bar chart showing the number of films for each director.
SELECT Directed_by, COUNT(Directed_by) FROM film GROUP BY Directed_by
nvbench
CREATE TABLE table_name_77 ( college VARCHAR, name VARCHAR )
What college is Pat Thomas from?
SELECT college FROM table_name_77 WHERE name = "pat thomas"
sql_create_context
CREATE TABLE table_33297 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
What was the result of the game on august 30, 1968?
SELECT "Result" FROM table_33297 WHERE "Date" = 'august 30, 1968'
wikisql
CREATE TABLE table_1341884_20 ( candidates VARCHAR, first_elected VARCHAR )
Who were all the candidates when the first elected year was 1961?
SELECT candidates FROM table_1341884_20 WHERE first_elected = 1961
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
how many patients who are divorced had their lab test category as hematology?
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."CATEGORY" = "Hematology"
mimicsql_data
CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text ) CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text )
Show me a scatter plot for the relationship between average and minimum age of captains in each class.
SELECT AVG(age), MIN(age) FROM captain GROUP BY Class
nvbench
CREATE TABLE table_name_25 ( city VARCHAR, airport VARCHAR )
What city is Jaffna Airport in?
SELECT city FROM table_name_25 WHERE airport = "jaffna airport"
sql_create_context
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 marital status is widowed and diagnoses long title is other preterm infants, 750-999 grams?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "WIDOWED" AND diagnoses.long_title = "Other preterm infants, 750-999 grams"
mimicsql_data
CREATE TABLE table_17675675_2 ( tries_against VARCHAR, points_for VARCHAR )
With the given points of 667, what was the number of tries against?
SELECT tries_against FROM table_17675675_2 WHERE points_for = "667"
sql_create_context