context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, ...
在患者云乐人的医疗记录中,查一下医疗费总额高过1367.6元的入院诊断疾病编码和名称
SELECT t_kc21.IN_DIAG_DIS_CD, t_kc21.IN_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_NM = '云乐人' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 1367.6)
css
CREATE TABLE table_name_5 ( film_title_used_in_nomination VARCHAR, original_title VARCHAR )
What title was used in the nomination of Matrimonio All'Italiana?
SELECT film_title_used_in_nomination FROM table_name_5 WHERE original_title = "matrimonio all'italiana"
sql_create_context
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_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) ...
did patient 95986 undergo surgery during this year?
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95986) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
mimic_iii
CREATE TABLE table_24853 ( "Year" text, "Date" text, "Driver" text, "Team" text, "Manufacturer" text, "Laps" text, "Miles (km)" text, "Race Time" text, "Average Speed (mph)" text, "Report" text )
Who is the manufacturer for the date of June 22?
SELECT "Manufacturer" FROM table_24853 WHERE "Date" = 'June 22'
wikisql
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, a...
please show me all one way FIRST class flights from INDIANAPOLIS to MEMPHIS
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, fare_basis, flight, flight_fare WHERE ((fare_basis.class_type = 'FIRST' AND fare.fare_basis_code = fare_basis.fare_basis_code) AND CITY_1.city_code = AIRPORT_SERVICE_1....
atis
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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), ...
For all employees who have the letters D or S in their first name, a line chart shows the trend of salary over hire_date , and I want to order HIRE_DATE from low to high order please.
SELECT HIRE_DATE, SALARY FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE
nvbench
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decima...
For all employees who have the letters D or S in their first name, show me about the distribution of job_id and the sum of manager_id , and group by attribute job_id in a bar chart, display from low to high by the y axis please.
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID)
nvbench
CREATE TABLE table_name_34 ( russian VARCHAR, translation VARCHAR )
What Russian word translates to bucket?
SELECT russian FROM table_name_34 WHERE translation = "bucket"
sql_create_context
CREATE TABLE table_203_466 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
who had more silvers ? colmbia or the bahamas
SELECT "nation" FROM table_203_466 WHERE "nation" IN ('colombia', 'bahamas') ORDER BY "silver" DESC LIMIT 1
squall
CREATE TABLE table_name_18 ( lost INTEGER, points VARCHAR, drawn VARCHAR )
What's the lost when there were more than 16 points and had a drawn less than 1?
SELECT SUM(lost) FROM table_name_18 WHERE points > 16 AND drawn < 1
sql_create_context
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
根据不同的科室名称和入院诊断疾病名称,保留平均年龄小于27岁的记录,并且列出编码为3966295的医院所有医疗就诊记录中患者的平均年龄是多少岁?
SELECT MED_ORG_DEPT_NM, IN_DIAG_DIS_NM, AVG(PERSON_AGE) FROM t_kc21 WHERE MED_SER_ORG_NO = '3966295' GROUP BY MED_ORG_DEPT_NM, IN_DIAG_DIS_NM HAVING AVG(PERSON_AGE) < 27
css
CREATE TABLE table_1473672_4 ( position VARCHAR, player VARCHAR )
Name the position for ron lalonde
SELECT position FROM table_1473672_4 WHERE player = "Ron Lalonde"
sql_create_context
CREATE TABLE table_36521 ( "Name" text, "Capacity" text, "Type" text, "Power" text, "Torque" text )
What torque does 1.9 diesel with 1905 cc have?
SELECT "Torque" FROM table_36521 WHERE "Name" = '1.9 diesel' AND "Capacity" = '1905 cc'
wikisql
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 food_service ( meal_code text, meal_number int, compartment text, meal_description...
what does S/ designate as a meal
SELECT DISTINCT compartment, meal_code, meal_description, meal_number FROM food_service WHERE meal_code = 'S/'
atis
CREATE TABLE Services ( Service_ID INTEGER, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255) ) CREATE TABLE Invoices ( Invoice_ID INTEGER, Order...
Find the order dates of the orders with price above 1000, and count them by a bar chart
SELECT Order_Date, COUNT(Order_Date) FROM Customer_Orders AS T1 JOIN Order_Items AS T2 ON T1.Order_ID = T2.Order_ID JOIN Products AS T3 ON T2.Product_ID = T3.Product_ID WHERE T3.Product_Price > 1000
nvbench
CREATE TABLE table_21652 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Attendance" real, "Record" text, "Points" real )
What was the score of the game on December 11?
SELECT "Score" FROM table_21652 WHERE "Date" = 'December 11'
wikisql
CREATE TABLE table_75053 ( "Date" text, "Result" text, "Score" text, "Brazil scorers" text, "Competition" text )
What is the result when the score is 4-0?
SELECT "Result" FROM table_75053 WHERE "Score" = '4-0'
wikisql
CREATE TABLE table_30617 ( "IME Exchange (Including spot, credit and forward transactions)" text, "2007/08" text, "2008/09" text, "2009/10" text, "2010/11" text )
What is the 2010/11 number when the 2007/08 is 772.6?
SELECT "2010/11" FROM table_30617 WHERE "2007/08" = '772.6'
wikisql
CREATE TABLE table_name_30 ( years VARCHAR, losses VARCHAR, ties VARCHAR, wins VARCHAR )
What years did the person coach who had more than 1 tie, mess than 311 wins and 174 losses?
SELECT years FROM table_name_30 WHERE ties > 1 AND wins < 311 AND losses = 174
sql_create_context
CREATE TABLE table_37149 ( "Frequency" text, "Call sign" text, "Branding" text, "Format" text, "Owner" text )
What is the frequency of the station owned by the Canadian Broadcasting Corporation and branded as CBC Radio One?
SELECT "Frequency" FROM table_37149 WHERE "Owner" = 'canadian broadcasting corporation' AND "Branding" = 'cbc radio one'
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...
在医院2061785入院的诊断疾病编码中列出那些不同疾病的平均患者年龄是多大岁数?
SELECT t_kc21.IN_DIAG_DIS_CD, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '2061785' GROUP BY t_kc21.IN_DIAG_DIS_CD
css
CREATE TABLE table_18424435_4 ( us_air_date VARCHAR, canadian_viewers__million_ VARCHAR )
What was the air date in the U.S. for the episode that had 1.452 million Canadian viewers?
SELECT us_air_date FROM table_18424435_4 WHERE canadian_viewers__million_ = "1.452"
sql_create_context
CREATE TABLE table_name_45 ( director_s_ VARCHAR, rank VARCHAR, film VARCHAR )
Who directed the nominated film 'blood on his hands'?
SELECT director_s_ FROM table_name_45 WHERE rank = "nominated" AND film = "blood on his hands"
sql_create_context
CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufac...
what is the least expensive flight available from DALLAS FORT WORTH to SAN FRANCISCO
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, fare, flight, flight_fare WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS FORT WOR...
atis
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM t...
列出首诊医生以及其他所有接诊医生在门诊就诊16949706262里面的工号都是什么?
SELECT ZZYSGH, QTJZYSGH FROM mzjzjlb WHERE JZLSH = '16949706262'
css
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, Creatio...
Number of [vote type] on [post type] posted by users under [reputation].
SELECT FLOOR(Users.Reputation / 10) * 10 AS "reputation_interval", COUNT(CAST(Votes.Id AS INT)) FROM Posts INNER JOIN Users ON Posts.OwnerUserId = Users.Id INNER JOIN Votes ON Votes.PostId = Posts.Id WHERE Posts.PostTypeId = @postType AND Users.Reputation <= @reputation AND Votes.VoteTypeId = @voteType GROUP BY FLOOR(U...
sede
CREATE TABLE table_28303 ( "Branding" text, "Callsign" text, "Ch. #" text, "Station Type" text, "Power kW (ERP)" text, "Location (Transmitter Site)" text )
What is the station type of DWMC-TV?
SELECT "Station Type" FROM table_28303 WHERE "Callsign" = 'DWMC-TV'
wikisql
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, Cr...
Top 20 posts in a week.
SELECT Id AS "post_link", Title, Score FROM Posts WHERE Posts.CreationDate > CURRENT_TIMESTAMP() - 7 ORDER BY Score DESC LIMIT 20
sede
CREATE TABLE table_24402 ( "Team name" text, "Races" real, "Won" real, "RR1 Pts." real, "RR2 Pts." real, "RR3 Pts." real, "RR4 Pts." text, "Total Pts." real, "Ranking" real )
When 20 is the rr4 points what is the lowest rr3 points?
SELECT MIN("RR3 Pts.") FROM table_24402 WHERE "RR4 Pts." = '20'
wikisql
CREATE TABLE table_10617 ( "Entrant" text, "Constructor" text, "Chassis" text, "Engine" text, "Tyre" text, "Driver" text, "Rounds" text )
In what rounds did Luigi Fagioli drive for Alfa Romeo SPA?
SELECT "Rounds" FROM table_10617 WHERE "Entrant" = 'alfa romeo spa' AND "Driver" = 'luigi fagioli'
wikisql
CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME ) CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, ...
Show the apartment type codes and the corresponding number of apartments sorted by the number of apartments in ascending order. Show bar chart.
SELECT apt_type_code, COUNT(*) FROM Apartments GROUP BY apt_type_code ORDER BY COUNT(*)
nvbench
CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )...
does YX have any flights from MONTREAL to NASHVILLE
SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((flight.airline_code = 'YX') AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NASHVILLE' AND flight.to_airport = AIRPORT_...
atis
CREATE TABLE table_9357 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Bills points" real, "Opponents" real, "Bills first downs" real, "Record" text, "'Attendance" real )
What game did the Buffalo Bills' opponents earn more than 28 points?
SELECT "Game" FROM table_9357 WHERE "Opponents" > '28'
wikisql
CREATE TABLE hz_info_mzjzjlb ( JZLSH number, YLJGDM number, mzjzjlb_id number ) 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 ...
患者27139108在医院7709781中的门诊就诊记录里有哪些门诊诊断名称中有多少不包含(的?
SELECT * FROM hz_info JOIN mzjzjlb 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.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.mzjzjlb...
css
CREATE TABLE table_53255 ( "Player" text, "Nationality" text, "Position" text, "Years for Jazz" text, "School/Club Team" text )
What school does Wayne Cooper play for?
SELECT "School/Club Team" FROM table_53255 WHERE "Player" = 'wayne cooper'
wikisql
CREATE TABLE table_name_82 ( silver INTEGER, total VARCHAR, gold VARCHAR, rank VARCHAR )
What is the average silver with more than 0 gold, a Rank of 1, and a Total smaller than 30?
SELECT AVG(silver) FROM table_name_82 WHERE gold > 0 AND rank = "1" AND total < 30
sql_create_context
CREATE TABLE table_name_26 ( Id VARCHAR )
What is the average 2006 value with a 2010 value of 417.9 and a 2011 value greater than 426.7?
SELECT AVG(2006) FROM table_name_26 WHERE 2010 = 417.9 AND 2011 > 426.7
sql_create_context
CREATE TABLE table_256286_61 ( type VARCHAR, yes_votes VARCHAR )
What is the type when yes votes are 546255?
SELECT type FROM table_256286_61 WHERE yes_votes = 546255
sql_create_context
CREATE TABLE table_64378 ( "Round" real, "Dates" text, "Rally Name" text, "Rally HQ" text, "Support Category" text, "Surface" text )
Where was adac rally deutschland's rally HQ?
SELECT "Rally HQ" FROM table_64378 WHERE "Rally Name" = 'adac rally deutschland'
wikisql
CREATE TABLE table_204_838 ( id number, "year" number, "award" text, "category" text, "nominated work" text, "result" text )
how many years are listed ?
SELECT COUNT(DISTINCT "year") FROM table_204_838
squall
CREATE TABLE table_204_920 ( id number, "goal" number, "date" text, "location" text, "opponent" text, "lineup" text, "min" number, "assist/pass" text, "score" text, "result" text, "competition" text )
what is the total goals on this chart
SELECT SUM("result") FROM table_204_920
squall
CREATE TABLE table_name_45 ( hometown VARCHAR, height VARCHAR )
What's the hometown of the player who is 6-4?
SELECT hometown FROM table_name_45 WHERE height = "6-4"
sql_create_context
CREATE TABLE table_20394 ( "N\u00b0" text, "Television service" text, "Country" text, "Language" text, "Content" text, "DAR" text, "HDTV" text, "PPV" text, "Package/Option" text )
What are the values of n for cinema content provided by Sky Cinema +24 on its Sky Cinema package?
SELECT "N\u00b0" FROM table_20394 WHERE "Package/Option" = 'Sky Cinema' AND "Content" = 'cinema' AND "Television service" = 'Sky Cinema +24'
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, ...
count the number of patients whose language is engl and year of birth is less than 2069?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.language = "ENGL" AND demographic.dob_year < "2069"
mimicsql_data
CREATE TABLE table_name_17 ( week VARCHAR, opponent VARCHAR, attendance VARCHAR )
Which total number of Week has an Opponent of at new orleans saints, and an Attendance larger than 53,448?
SELECT COUNT(week) FROM table_name_17 WHERE opponent = "at new orleans saints" AND attendance > 53 OFFSET 448
sql_create_context
CREATE TABLE table_34435 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Ground" text, "Crowd" text, "Date" text, "Time" text, "Report" text )
What is the time of the Essendon home team game?
SELECT "Time" FROM table_34435 WHERE "Home team" = 'essendon'
wikisql
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE program ( progr...
Which upper level classes are worth 10 credits ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.credits = 10 AND program_course.category LIKE 'ULCS'
advising
CREATE TABLE table_73958 ( "Year" text, "Winner" text, "Runner-up" text, "Result" text, "Venues" text, "Attendance" real, "Entries" real )
How many games had red star as the runner up?
SELECT COUNT("Attendance") FROM table_73958 WHERE "Runner-up" = 'Red Star'
wikisql
CREATE TABLE table_name_5 ( apogee VARCHAR, date VARCHAR )
Which Apogee was on 1959-02-20?
SELECT apogee FROM table_name_5 WHERE date = "1959-02-20"
sql_create_context
CREATE TABLE table_13026799_1 ( championship VARCHAR, margin VARCHAR )
What championship had a margin of playoff 2?
SELECT championship FROM table_13026799_1 WHERE margin = "Playoff 2"
sql_create_context
CREATE TABLE body_builder ( Body_Builder_ID int, People_ID int, Snatch real, Clean_Jerk real, Total real ) CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, Birth_Date text, Birth_Place text )
What is the relationship between Body_Builder_ID and Snatch ?
SELECT Body_Builder_ID, Snatch FROM body_builder
nvbench
CREATE TABLE table_78965 ( "Date" text, "Ship Name" text, "Tonnage" text, "Ship Type" text, "Location" text, "Disposition of Ship" text )
With 14 under the date, what is the tonnage of the ship?
SELECT "Tonnage" FROM table_78965 WHERE "Date" = '14'
wikisql
CREATE TABLE exhibition_record ( Exhibition_ID int, Date text, Attendance int ) CREATE TABLE artist ( Artist_ID int, Name text, Country text, Year_Join int, Age int ) CREATE TABLE exhibition ( Exhibition_ID int, Year int, Theme text, Artist_ID int, Ticket_Price real...
Show all artist names and the number of exhibitions for each artist in a bar chart.
SELECT Name, COUNT(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.Artist_ID = T2.Artist_ID GROUP BY T1.Artist_ID
nvbench
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownV...
Questions with letter transpositions of 'Android' in the title. case-insensitive
SELECT Id AS "post_link", CreationDate FROM Posts WHERE PostTypeId = 1 AND (Title LIKE '%nadroid%' COLLATE SQL_Latin1_General_CP1_CI_AS OR Title LIKE '%adnroid%' COLLATE SQL_Latin1_General_CP1_CI_AS OR Title LIKE '%anrdoid%' COLLATE SQL_Latin1_General_CP1_CI_AS OR Title LIKE '%andorid%' COLLATE SQL_Latin1_General_CP1_C...
sede
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...
get me the number of private insurance patients who had phys referral/normal deli admission.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.admission_location = "PHYS REFERRAL/NORMAL DELI"
mimicsql_data
CREATE TABLE table_12674 ( "Mininera DFL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
How many against for the Moyston-Willaura team with 4 losses and fewer than 2 byes?
SELECT MAX("Against") FROM table_12674 WHERE "Losses" = '4' AND "Mininera DFL" = 'moyston-willaura' AND "Byes" < '2'
wikisql
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE T...
What percentile am I in for a given tag for a given location?. Determines where you rank in a given tag as of the last data load
SELECT STR(NTILE(100) OVER (ORDER BY SUM(answers.Score) DESC), 3) + '%' AS "top", ROW_NUMBER() OVER (ORDER BY SUM(answers.Score) DESC) AS "ranking", Users.Id AS "user_link", SUM(answers.Score) AS "total_score" FROM Tags JOIN PostTags ON Tags.Id = PostTags.TagId AND Tags.TagName = '##TagName##' JOIN Posts AS questions O...
sede
CREATE TABLE table_13828 ( "Date" real, "Ships sunk (Pola)" text, "Tonnage" text, "U-boats destroyed (KuK)" text, "U-boats destroyed (Pola)" text )
What's the highest Date listed that has U-boats destroyed (Pola) of 1?
SELECT MAX("Date") FROM table_13828 WHERE "U-boats destroyed (Pola)" = '1'
wikisql
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...
医院8925142所有就诊的记录里面根据不同的科室和不同的出院诊断疾病编码查询个人自费的部分与总的医疗费用相比的最小值,把最后的结果按升序来排列
SELECT t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_CD, MIN(t_kc24.PER_EXP / t_kc24.MED_AMOUT) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '8925142' GROUP BY t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_CD ORDER BY MIN(t_kc24.PER_EXP / t_kc24.MED_AMOUT)
css
CREATE TABLE table_19698421_1 ( total_votes INTEGER, year VARCHAR )
What was the total number of votes in the 2005 elections?
SELECT MIN(total_votes) FROM table_19698421_1 WHERE year = "2005"
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...
查询病人54632164在医院1907633的门诊诊断信息中不存在牙龈二字的门诊就诊记录详情
SELECT * FROM hz_info JOIN mzjzjlb 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.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.mzjzjlb...
css
CREATE TABLE table_60655 ( "Mission" text, "Location" text, "Type" text, "Head of Mission" text, "Position" text, "List" text )
what is the type when the position is ambassador and the location is rabat?
SELECT "Type" FROM table_60655 WHERE "Position" = 'ambassador' AND "Location" = 'rabat'
wikisql
CREATE TABLE table_57386 ( "Player" text, "Date of Birth" text, "Batting Style" text, "Bowling Style" text, "First Class Team" text )
What bowling style does First Class Team, Griqualand West have?
SELECT "Bowling Style" FROM table_57386 WHERE "First Class Team" = 'griqualand west'
wikisql
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
77759408的患者自10.9.4起,到13.6.24止,看过的最主要的病是什么
SELECT gwyjzb.IN_DIAG_DIS_CD, gwyjzb.IN_DIAG_DIS_NM FROM gwyjzb WHERE gwyjzb.PERSON_ID = '77759408' AND gwyjzb.IN_HOSP_DATE BETWEEN '2010-09-04' AND '2013-06-24' GROUP BY gwyjzb.IN_DIAG_DIS_CD ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT fgwyjzb.IN_DIAG_DIS_CD, fgwyjzb.IN_DIAG_DIS_NM FROM fgwyjzb WHERE fgwyjzb.PERSON_ID...
css
CREATE TABLE table_73189 ( "Series #" real, "Episode #" real, "Title" text, "Directed by" text, "Written by" text, "Original airdate" text )
What is the episode number for series 17?
SELECT "Episode #" FROM table_73189 WHERE "Series #" = '17'
wikisql
CREATE TABLE table_name_67 ( round INTEGER, position VARCHAR, pick__number VARCHAR )
Position of guard, and a Pick # larger than 9 is what highest round?
SELECT MAX(round) FROM table_name_67 WHERE position = "guard" AND pick__number > 9
sql_create_context
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 ...
had patient 89875 been prescribed metoprolol tartrate, furosemide, or hydralazine hcl since 11/2104?
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 89875) AND prescriptions.drug IN ('furosemide', 'metoprolol tartrate', 'hydralazine hcl') AND STRFTIME('%y-%m', prescriptions.startdate) >= '2104-11'
mimic_iii
CREATE TABLE t_kc21 ( 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, ...
医院1343392给54049149这个病人开过单价最高的药是什么?查一下药品名称、编码及单价
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.UNIVALENT FROM t_kc22 WHERE t_kc21_t_kc22.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '54049149' AND t_kc21.MED_SER_ORG_NO = '1343392') ORDER BY t_kc22.UNIVALENT DESC LIMIT 1
css
CREATE TABLE table_77839 ( "Round" real, "Player" text, "Position" text, "Nationality" text, "College/Junior/Club Team (League)" text )
What nationality is the draft pick with w position from leninogorsk (russia-2)?
SELECT "Nationality" FROM table_77839 WHERE "Position" = 'w' AND "College/Junior/Club Team (League)" = 'leninogorsk (russia-2)'
wikisql
CREATE TABLE table_203_614 ( id number, "#" number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text )
what venue was the latest match played at ?
SELECT "venue" FROM table_203_614 ORDER BY "date" DESC LIMIT 1
squall
CREATE TABLE table_2970978_1 ( ___ave_on_prev_season VARCHAR, competition VARCHAR )
What is every value for average on previous season if the competition is league two?
SELECT ___ave_on_prev_season FROM table_2970978_1 WHERE competition = "League Two"
sql_create_context
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, ...
User with highest average comment score.
SELECT c.UserId AS "user_link", c.UserDisplayName, AVG(CAST(c.Score AS FLOAT)) AS "average_score", SUM(c.Score) AS "total_score", COUNT(c.Id) AS "total_count", 'site://users/' + CAST(c.UserId AS TEXT) + '?tab=activity&sort=comments' AS "link_to_comments" FROM Comments AS c GROUP BY c.UserId, c.UserDisplayName HAVING CO...
sede
CREATE TABLE table_name_98 ( exaltation VARCHAR, domicile VARCHAR, fall VARCHAR )
Which exaltation has a domicile of Saturn and a fall of Jupiter?
SELECT exaltation FROM table_name_98 WHERE domicile = "saturn" AND fall = "jupiter"
sql_create_context
CREATE TABLE table_204_784 ( id number, "player" text, "league" number, "cup" number, "europa league" number, "total" number )
how many players had a total of 4 ?
SELECT COUNT("player") FROM table_204_784 WHERE "total" = 4
squall
CREATE TABLE table_12186237_1 ( circuit VARCHAR )
Who is the 125cc winnder for the Phillip Island circuit?
SELECT 125 AS cc_winner FROM table_12186237_1 WHERE circuit = "Phillip Island"
sql_create_context
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ...
get user post subject tags.
SELECT Users.Id AS user_id, COUNT(DISTINCT userPostsBeforeT.TagId) AS NumSubjectAreas FROM Users AS users LEFT JOIN (SELECT OwnerUserId, PostId, PostTypeId, PT.TagId FROM Posts AS P JOIN PostTags AS PT ON P.Id = Pt.PostId) AS userPostsBeforeT ON userPostsBeforeT.OwnerUserId = Users.Id AND userPostsBeforeT.PostTypeId = ...
sede
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
how many patients whose insurance is private and discharge location is left against medical advi?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI"
mimicsql_data
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 drug name of subject name paul edwards?
SELECT prescriptions.drug FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.name = "Paul Edwards"
mimicsql_data
CREATE TABLE table_name_35 ( car_model VARCHAR, manufacturer VARCHAR, driver VARCHAR )
What Car Model has the Manufacturer of Saab, and Driver Dean Randle?
SELECT car_model FROM table_name_35 WHERE manufacturer = "saab" AND driver = "dean randle"
sql_create_context
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellv...
what is the direct bilirubin change and difference of patient 012-27355 last measured on the first hospital visit compared to the first value measured on the first hospital visit?
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 = '012-27355' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi...
eicu
CREATE TABLE table_32063 ( "Title" text, "Japan" text, "North America" text, "Europe" text, "Australia" text )
Tell me the title for japan august 23, 2012
SELECT "Title" FROM table_32063 WHERE "Japan" = 'august 23, 2012'
wikisql
CREATE TABLE table_23308178_6 ( attendance INTEGER, date VARCHAR )
What was the lowest attendance for games played on december 23?
SELECT MIN(attendance) FROM table_23308178_6 WHERE date = "December 23"
sql_create_context
CREATE TABLE table_25518547_3 ( mls_team VARCHAR, affiliation VARCHAR )
How many teams drafted players from the University of Maryland?
SELECT COUNT(mls_team) FROM table_25518547_3 WHERE affiliation = "University of Maryland"
sql_create_context
CREATE TABLE Invoices ( invoice_number INTEGER, invoice_date DATETIME, invoice_details VARCHAR(255) ) CREATE TABLE Order_Items ( order_item_id INTEGER, product_id INTEGER, order_id INTEGER, order_item_status VARCHAR(10), order_item_details VARCHAR(255) ) CREATE TABLE Shipment_Items ( ...
What are the dates of the orders made by the customer named 'Jeramie', and count them by a line chart
SELECT date_order_placed, COUNT(date_order_placed) FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = "Jeramie"
nvbench
CREATE TABLE table_name_99 ( network VARCHAR, name VARCHAR )
What's the network of BBTV Channel 7?
SELECT network FROM table_name_99 WHERE name = "bbtv channel 7"
sql_create_context
CREATE TABLE table_42293 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
What is the lowest week for December 26, 1999
SELECT MIN("Week") FROM table_42293 WHERE "Date" = 'december 26, 1999'
wikisql
CREATE TABLE table_20360535_4 ( original_air_date VARCHAR, directed_by VARCHAR, written_by VARCHAR )
what is the original air date of the episode directed by Ben Jones and written by Steven Melching?
SELECT original_air_date FROM table_20360535_4 WHERE directed_by = "Ben Jones" AND written_by = "Steven Melching"
sql_create_context
CREATE TABLE individuals ( individual_id number, individual_first_name text, individual_middle_name text, inidividual_phone text, individual_email text, individual_address text, individual_last_name text ) CREATE TABLE party_services ( booking_id number, customer_id number, serv...
Count the number of cities in the state of Colorado.
SELECT COUNT(*) FROM addresses WHERE state_province_county = "Colorado"
spider
CREATE TABLE table_name_92 ( date VARCHAR, opposing_team VARCHAR )
What day was United States the opposing team?
SELECT date FROM table_name_92 WHERE opposing_team = "united states"
sql_create_context
CREATE TABLE table_name_84 ( Id VARCHAR )
What is the 2006 that has a 2r in 2004, and a 2r in 2005?
SELECT 2006 FROM table_name_84 WHERE 2004 = "2r" AND 2005 = "2r"
sql_create_context
CREATE TABLE table_22858557_1 ( championship VARCHAR, opponent_in_final VARCHAR )
How many championships have there been with Steffi Graf?
SELECT championship FROM table_22858557_1 WHERE opponent_in_final = "Steffi Graf"
sql_create_context
CREATE TABLE table_203_248 ( id number, "code" text, "year" number )
what was the lowest year stamped ?
SELECT MIN("year") FROM table_203_248
squall
CREATE TABLE table_38922 ( "Year (Ceremony)" real, "Original title" text, "English title" text, "Director" text, "Result" text )
What is the English title of the film Directed by Jayme Monjardim?
SELECT "English title" FROM table_38922 WHERE "Director" = 'jayme monjardim'
wikisql
CREATE TABLE table_name_9 ( kickoff_ VARCHAR, a_ VARCHAR, attendance VARCHAR )
Which kickoff had an attendance of 58,120?
SELECT kickoff_ AS "a_" FROM table_name_9 WHERE attendance = "58,120"
sql_create_context
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
Give me the comparison about the average of Team_ID over the ACC_Road , and group by attribute ACC_Road, I want to sort in desc by the Y-axis.
SELECT ACC_Road, AVG(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY AVG(Team_ID) DESC
nvbench
CREATE TABLE table_72739 ( "Episode Number" real, "Air Date" text, "Guest Host" text, "Musical Guest (Song performed)" text, "Who knows the most about the guest host? Panelists" text, "Coat Of Cash Wearing Celebrity" text )
Name the least number of episodes for the panelists of reggie yates and kelly osbourne
SELECT MIN("Episode Number") FROM table_72739 WHERE "Who knows the most about the guest host? Panelists" = 'Reggie Yates and Kelly Osbourne'
wikisql
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number...
Upvote : Top user in kerala - VB.NET.
SELECT Users.Id AS "user_link", TagName, COUNT(*) AS UpVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id AND VoteTypeId = 2 INNER JOIN Users ON Users.Id = Posts.OwnerUserId WHERE LOWER(Location) LIKE '%kottaya...
sede
CREATE TABLE actor ( Actor_ID int, Name text, Musical_ID int, Character text, Duration text, age int ) CREATE TABLE musical ( Musical_ID int, Name text, Year int, Award text, Category text, Nominee text, Result text )
Show different nominees and the number of musicals they have been nominated in a bar chart, show Nominee from low to high order.
SELECT Nominee, COUNT(*) FROM musical GROUP BY Nominee ORDER BY Nominee
nvbench
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE ReviewRejectionReasons ( Id number, N...
User with most questions asked.
SELECT Users.Id AS "user_link", QuestionCounts.PostsCount AS "number_of_questions", AnswerCounts.PostsCount AS "number_of_answers" FROM (SELECT OwnerUserId, COUNT(Id) AS PostsCount FROM Posts WHERE PostTypeId = 1 GROUP BY OwnerUserId) AS QuestionCounts, (SELECT OwnerUserId, COUNT(Id) AS PostsCount FROM Posts WHERE Post...
sede
CREATE TABLE video_games ( gameid number, gname text, gtype text ) CREATE TABLE sportsinfo ( stuid number, sportname text, hoursperweek number, gamesplayed number, onscholarship text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text...
What are the ids of all students who played video games and sports?
SELECT stuid FROM sportsinfo INTERSECT SELECT stuid FROM plays_games
spider