context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_name_57 ( engine VARCHAR, points VARCHAR, year VARCHAR, entrant VARCHAR )
What is the engine for the bmw motorsport entrant with 123 points before 2004?
SELECT engine FROM table_name_57 WHERE year < 2004 AND entrant = "bmw motorsport" AND points = 123
sql_create_context
CREATE TABLE table_64386 ( "Rank" real, "Heat" real, "Athlete" text, "Country" text, "Time" real )
who is the athlete when the time is less than 11.13 and the country is belgium?
SELECT "Athlete" FROM table_64386 WHERE "Time" < '11.13' AND "Country" = 'belgium'
wikisql
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, ...
what are the prices for meropenem?
SELECT DISTINCT cost.cost FROM cost WHERE cost.eventtype = 'medication' AND cost.eventid IN (SELECT medication.medicationid FROM medication WHERE medication.drugname = 'meropenem')
eicu
CREATE TABLE table_21881 ( "Season" text, "Date" text, "Driver" text, "Team" text, "Chassis" text, "Engine" text, "Laps" text, "Miles (km)" text, "Race Time" text, "Average Speed (mph)" text, "Report" text )
When 2005 is the season how many drivers are there?
SELECT COUNT("Driver") FROM table_21881 WHERE "Season" = '2005'
wikisql
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...
find the number of government health insurance patients who had other electric countershock of heart.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.short_title = "Heart countershock NEC"
mimicsql_data
CREATE TABLE table_30191 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real )
What dat did episode 195 in the series originally air?
SELECT "Original air date" FROM table_30191 WHERE "No. in series" = '195'
wikisql
CREATE TABLE table_204_946 ( id number, "pos" number, "no" number, "driver" text, "team" text, "laps" number, "time/retired" text, "grid" number, "points" number )
how many finished above frnchitti ?
SELECT COUNT(*) FROM table_204_946 WHERE "pos" < (SELECT "pos" FROM table_204_946 WHERE "driver" = 'dario franchitti')
squall
CREATE TABLE table_19255192_1 ( fiscal_year INTEGER, total_vehicles VARCHAR )
What is the lowest fiscal year if total vehicles is 490?
SELECT MIN(fiscal_year) FROM table_19255192_1 WHERE total_vehicles = 490
sql_create_context
CREATE TABLE table_40609 ( "Name" text, "Novelty" text, "Status" text, "Authors" text, "Location" text )
What is Authors, when Novelty is Gen Nov, when Location is South Africa, and when Name is Criocephalosaurus?
SELECT "Authors" FROM table_40609 WHERE "Novelty" = 'gen nov' AND "Location" = 'south africa' AND "Name" = 'criocephalosaurus'
wikisql
CREATE TABLE table_27704187_7 ( location_attendance VARCHAR, team VARCHAR )
Where was the game against Detroit played?
SELECT location_attendance FROM table_27704187_7 WHERE team = "Detroit"
sql_create_context
CREATE TABLE txmzjzjlb ( 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...
能提供出门诊就诊45399366381的日期是多少吗?
SELECT txmzjzjlb.JZKSRQ FROM txmzjzjlb WHERE txmzjzjlb.JZLSH = '45399366381' UNION SELECT ftxmzjzjlb.JZKSRQ FROM ftxmzjzjlb WHERE ftxmzjzjlb.JZLSH = '45399366381'
css
CREATE TABLE table_204_353 ( id number, "no." number, "date/time" text, "aircraft" text, "foe" text, "result" text, "location" text, "notes" text )
what is the date after number 4 ?
SELECT "date/time" FROM table_204_353 WHERE id > (SELECT id FROM table_204_353 WHERE "no." = 4) ORDER BY id LIMIT 1
squall
CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paperfield ( fieldid int, paper...
What was the first paper on LSTM written ?
SELECT DISTINCT paper.year FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'LSTM' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid GROUP BY paper.year ORDER BY paper.year
scholar
CREATE TABLE mzb ( CLINIC_ID 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, INSU_TYPE text, IN...
列出医院3491233中不同疾病的平均患者年龄是多少,根据入院诊断疾病编码?
SELECT qtb.IN_DIAG_DIS_CD, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '3491233' GROUP BY qtb.IN_DIAG_DIS_CD UNION SELECT gyb.IN_DIAG_DIS_CD, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '3491233' GROUP BY gyb.IN_DIAG_DIS_CD UNION SELECT zyb.IN_DIAG_DIS_CD, AVG(zyb.PERSON_AGE) FROM zyb WHERE zyb....
css
CREATE TABLE order_items ( order_item_id number, product_id number, order_id number, order_item_status text, order_item_details text ) CREATE TABLE shipment_items ( shipment_id number, order_item_id number ) CREATE TABLE products ( product_id number, product_name text, product_...
Find all the order items whose product id is 11. What are the order item ids?
SELECT order_item_id FROM order_items WHERE product_id = 11
spider
CREATE TABLE table_name_4 ( opponent VARCHAR, date VARCHAR )
Who was the opponent on November 11, 2001?
SELECT opponent FROM table_name_4 WHERE date = "november 11, 2001"
sql_create_context
CREATE TABLE table_13998897_1 ( height_m___ft__ VARCHAR, frequency_mhz VARCHAR )
how many height m ( ft ) with frequency mhz being 100.1
SELECT COUNT(height_m___ft__) FROM table_13998897_1 WHERE frequency_mhz = "100.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...
列出病人48858661医疗记录中医疗费总额大于759.51元的入院诊断疾病编码和名称
SELECT OUT_DIAG_DIS_CD, OUT_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_ID = '48858661' AND MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc24 WHERE MED_AMOUT > 759.51)
css
CREATE TABLE table_2508633_8 ( position VARCHAR, nfl_team VARCHAR )
If the NFL team is the Minnesota Vikings, what is the position?
SELECT position FROM table_2508633_8 WHERE nfl_team = "Minnesota Vikings"
sql_create_context
CREATE TABLE table_20492 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Bills points" real, "Opponents" real, "Bills first downs" real, "Record" text )
When is the latest game the bills had 21 first downs
SELECT MIN("Game") FROM table_20492 WHERE "Bills first downs" = '21'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
how many patients whose age is less than 54 and drug name is succinylcholine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "54" AND prescriptions.drug = "Succinylcholine"
mimicsql_data
CREATE TABLE table_53925 ( "Year" real, "Network" text, "Lap-by-lap" text, "Pit reporters" text, "Host" text )
What network has lap-by-laps by Bill Flemming, and Pit reporter Chris Economaki?
SELECT "Network" FROM table_53925 WHERE "Lap-by-lap" = 'bill flemming' AND "Pit reporters" = 'chris economaki'
wikisql
CREATE TABLE submission ( College VARCHAR, Scores INTEGER )
Show the colleges that have both authors with submission score larger than 90 and authors with submission score smaller than 80.
SELECT College FROM submission WHERE Scores > 90 INTERSECT SELECT College FROM submission WHERE Scores < 80
sql_create_context
CREATE TABLE aircraft ( aid number, name text, distance number ) CREATE TABLE employee ( eid number, name text, salary number ) CREATE TABLE flight ( flno number, origin text, destination text, distance number, departure_date time, arrival_date time, price number, ...
Show names for all aircraft with at least two flights.
SELECT T2.name FROM flight AS T1 JOIN aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING COUNT(*) >= 2
spider
CREATE TABLE table_61631 ( "Fin. Pos" real, "Car No." real, "Driver" text, "Team" text, "Laps" real, "Time/Retired" text, "Grid" real, "Laps Led" real, "Points" text )
What is the highest Laps Led with a grid of less than 4 and a finishing position of 15?
SELECT MAX("Laps Led") FROM table_61631 WHERE "Grid" < '4' AND "Fin. Pos" = '15'
wikisql
CREATE TABLE table_name_8 ( japanese_name VARCHAR, korean_name_² VARCHAR )
Which Japanese name has a Korean name of ( ) gyeongchip?
SELECT japanese_name FROM table_name_8 WHERE korean_name_² = "경칩 (驚蟄) gyeongchip"
sql_create_context
CREATE TABLE table_204_215 ( id number, "airline" text, "destination(s)" text, "aircraft scheduled" text, "service date(s)" text, "comments" text )
does allegiant air fly to dallas or las vegas ?
SELECT "destination(s)" FROM table_204_215 WHERE "airline" = 'allegiant air'
squall
CREATE TABLE table_40669 ( "Name" text, "Location" text, "Type" text, "Completed" text, "List entry number" real )
What is the completed date of the church with list entry number 1068071?
SELECT "Completed" FROM table_40669 WHERE "Type" = 'church' AND "List entry number" = '1068071'
wikisql
CREATE TABLE table_51034 ( "Date" text, "Series" text, "Circuit" text, "City / State" text, "Winner" text, "Team" text )
What is the circuit on 19 Apr with Craig Lowndes as the winner?
SELECT "Circuit" FROM table_51034 WHERE "Winner" = 'craig lowndes' AND "Date" = '19 apr'
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, ...
find the number of emergency hospital admission patients who were admitted via emergency hospital room.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.admission_location = "EMERGENCY ROOM ADMIT"
mimicsql_data
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, war...
tell me patient 15135's hospital admission time during this year?
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 15135 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
mimic_iii
CREATE TABLE table_204_774 ( id number, "#" number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text )
who was his first opponent in the 2006 fifa world cup qualification round ?
SELECT "opponent" FROM table_204_774 WHERE "competition" = '2006 fifa world cup qualification' ORDER BY "date" LIMIT 1
squall
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...
provide the number of patients who had arteriography of cerebral arteries and were hospitalized for more than 5 days.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "5" AND procedures.short_title = "Contr cerebr arteriogram"
mimicsql_data
CREATE TABLE table_name_31 ( report VARCHAR, home_team VARCHAR )
what is the report when the home team is new zealand breakers?
SELECT report FROM table_name_31 WHERE home_team = "new zealand breakers"
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_...
what is the smallest aircraft available to fly on from PITTSBURGH to BALTIMORE
SELECT DISTINCT aircraft.aircraft_code FROM aircraft, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, equipment_sequence, flight WHERE aircraft.capacity = (SELECT MIN(AIRCRAFTalias1.capacity) FROM aircraft AS AIRCRAFTalias1, airport_service AS AIRPORT_SERVICEa...
atis
CREATE TABLE table_name_55 ( club VARCHAR, nationality VARCHAR, player VARCHAR )
What club did united states player ty harden play for?
SELECT club FROM table_name_55 WHERE nationality = "united states" AND player = "ty harden"
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...
在06年2月16日到2012年12月29日内,患者86192991的甲胎蛋白情况如何?
SELECT * 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 = jyjgzbb.BGDH WHERE hz_i...
css
CREATE TABLE table_204_607 ( id number, "season" number, "date" text, "location" text, "discipline" text, "place" text )
what was the finishing place of the last race in december 2010 ?
SELECT "place" FROM table_204_607 WHERE "date" = 12 AND "date" = 2010
squall
CREATE TABLE table_name_66 ( club_province VARCHAR, caps VARCHAR )
What club/province has 41 caps?
SELECT club_province FROM table_name_66 WHERE caps = 41
sql_create_context
CREATE TABLE table_41175 ( "Team" text, "Match" real, "Points" real, "Draw" real, "Lost" real )
Which average lost that has a match less than 14?
SELECT AVG("Lost") FROM table_41175 WHERE "Match" < '14'
wikisql
CREATE TABLE table_56771 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
Which venue did the home team score 22.23 (155) at?
SELECT "Venue" FROM table_56771 WHERE "Home team score" = '22.23 (155)'
wikisql
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 are the four most commonly ordered procedures in 2105 for patients who have previously been diagnosed with bone fracture(s) - clavicle in the same month?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'bone fracture(s) - clavicle' AND STRFTIM...
eicu
CREATE TABLE table_name_75 ( runners_up VARCHAR, venue VARCHAR )
What Runners-up have a Venue in Broadwood Stadium?
SELECT runners_up FROM table_name_75 WHERE venue = "broadwood stadium"
sql_create_context
CREATE TABLE table_23286223_8 ( high_points VARCHAR, record VARCHAR )
How many players did the most high points in the game with 39-22 record?
SELECT COUNT(high_points) FROM table_23286223_8 WHERE record = "39-22"
sql_create_context
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, return a bar chart about the distribution of name and the sum of code , and group by attribute name.
SELECT T2.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name
nvbench
CREATE TABLE table_3680 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (million)" text )
What is the title of the episode directed by Romeo Tirone?
SELECT "Title" FROM table_3680 WHERE "Directed by" = 'Romeo Tirone'
wikisql
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Give me the comparison about School_ID over the All_Neutral by a bar chart, and I want to display bar in ascending order.
SELECT All_Neutral, School_ID FROM basketball_match ORDER BY All_Neutral
nvbench
CREATE TABLE table_41699 ( "Tournament" text, "Wins" real, "Top-5" real, "Top-10" real, "Top-25" real, "Events" real, "Cuts made" real )
Which Top-10 has a Cuts made of 10, and a Top-5 larger than 1?
SELECT MIN("Top-10") FROM table_41699 WHERE "Cuts made" = '10' AND "Top-5" > '1'
wikisql
CREATE TABLE transactions ( transaction_id number, investor_id number, transaction_type_code text, date_of_transaction time, amount_of_transaction number, share_count text, other_details text ) CREATE TABLE sales ( sales_transaction_id number, sales_details text ) CREATE TABLE lots...
Show the transaction type code that occurs the fewest times.
SELECT transaction_type_code FROM transactions GROUP BY transaction_type_code ORDER BY COUNT(*) LIMIT 1
spider
CREATE TABLE table_203_125 ( id number, "club" text, "winners" number, "runner-ups" number, "winning years" text, "runner-up years" text )
how many years was sk sturm graz winner ?
SELECT "winners" FROM table_203_125 WHERE "club" = 'sk sturm graz'
squall
CREATE TABLE table_38688 ( "Type" text, "Actual Exponent" text, "Exp (biased)" text, "Exponent field" text, "Significand (fraction field)" text, "Value" text )
What's the Significant of a value 1.0?
SELECT "Significand (fraction field)" FROM table_38688 WHERE "Value" = '1.0'
wikisql
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost numbe...
count the number of patients who were diagnosed with septic arthritis and didn't return to the hospital within 2 months until 2102.
SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'septic arthritis' AND STRFTIME('%y', diagnosis.diagnosistime) <= '2102') AS t1) - (SELECT COUNT(DIST...
eicu
CREATE TABLE table_203_306 ( id number, "no." number, "title" text, "directed by" text, "written by" text, "original air date" text )
how many other episodes were written by john zinman other than reunion ?
SELECT COUNT("title") FROM table_203_306 WHERE "written by" = 'john zinman' AND "title" <> '"reunion"'
squall
CREATE TABLE table_59000 ( "Title" text, "Developer" text, "Genre" text, "Release date" text, "Version" real )
What is Version, when Genre is 'Action', and when Title is 'Hairball'?
SELECT "Version" FROM table_59000 WHERE "Genre" = 'action' AND "Title" = 'hairball'
wikisql
CREATE TABLE Maintenance_Contracts ( maintenance_contract_id INTEGER, maintenance_contract_company_id INTEGER, contract_start_date DATETIME, contract_end_date DATETIME, other_contract_details VARCHAR(255) ) CREATE TABLE Assets ( asset_id INTEGER, maintenance_contract_id INTEGER, supplie...
A stacked bar chart showing the number of faults for different fault short name and skills required to fix them. The x-axis is falut short name and group by skill description.
SELECT fault_short_name, COUNT(fault_short_name) FROM Part_Faults AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.part_fault_id = T2.part_fault_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id GROUP BY skill_description, fault_short_name
nvbench
CREATE TABLE people ( people_id number, name text, age number, height number, hometown text ) CREATE TABLE gymnast ( gymnast_id number, floor_exercise_points number, pommel_horse_points number, rings_points number, vault_points number, parallel_bars_points number, horizo...
How many distinct hometowns did these people have?
SELECT COUNT(DISTINCT hometown) FROM people
spider
CREATE TABLE table_23918 ( "Year" text, "Head Coach" text, "Regular Season Record (W-L)" text, "NEC Record" text, "Standing" text, "NEC Tournament Record" text )
Name the year for t-10th
SELECT "Year" FROM table_23918 WHERE "Standing" = 'T-10th'
wikisql
CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text ) CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text )
Draw a bar chart for what are the different ship flags, and how many ships have each?, show names in ascending order please.
SELECT Flag, COUNT(*) FROM Ship GROUP BY Flag ORDER BY Flag
nvbench
CREATE TABLE table_name_17 ( date VARCHAR, opponent VARCHAR, result VARCHAR, attendance VARCHAR )
On what date was the opponent Ayr United, the result 1 0, and the attendance more than 668?
SELECT date FROM table_name_17 WHERE result = "1–0" AND attendance > 668 AND opponent = "ayr united"
sql_create_context
CREATE TABLE table_name_1 ( draws INTEGER, al_ahly_wins INTEGER )
What is the average number of draws for Al Ahly wins over 59?
SELECT AVG(draws) FROM table_name_1 WHERE al_ahly_wins > 59
sql_create_context
CREATE TABLE table_60256 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text )
What is the venue of the match with more than 8 against and ireland as the opposing team?
SELECT "Venue" FROM table_60256 WHERE "Against" > '8' AND "Opposing Teams" = 'ireland'
wikisql
CREATE TABLE table_27003186_3 ( no_party_preference VARCHAR, city VARCHAR )
What is the no party preference when the city is murrieta?
SELECT no_party_preference FROM table_27003186_3 WHERE city = "Murrieta"
sql_create_context
CREATE TABLE table_72989 ( "Year" real, "Date (Opening)" text, "Date (Closing)" text, "Opening Film" text, "Number of Screening" text, "Award-Winning Film" text )
Which award-winning film has a screening number of 50 films 50 televised?
SELECT "Award-Winning Film" FROM table_72989 WHERE "Number of Screening" = '50 films 50 televised'
wikisql
CREATE TABLE assignedto ( scientist number, project text ) CREATE TABLE projects ( code text, name text, hours number ) CREATE TABLE scientists ( ssn number, name text )
List all the scientists' names, their projects' names, and the hours worked by that scientist on each project, in alphabetical order of project name, and then scientist name.
SELECT T1.name, T3.name, T3.hours FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn = T2.scientist JOIN projects AS T3 ON T2.project = T3.code ORDER BY T3.name, T1.name
spider
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, ...
知道在门诊就诊00282220286的病人的卡号以及卡类型是啥吗
SELECT zzmzjzjlb.KH, zzmzjzjlb.KLX FROM zzmzjzjlb WHERE zzmzjzjlb.JZLSH = '00282220286' UNION SELECT fzzmzjzjlb.KH, fzzmzjzjlb.KLX FROM fzzmzjzjlb WHERE fzzmzjzjlb.JZLSH = '00282220286'
css
CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE restriction ( restriction_c...
what flights from KANSAS CITY to CHICAGO next wednesday arrive at CHICAGO at about 7pm
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.arrival_time <= 1930 AND flight.arrival_time >= 1830) AND date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 19...
atis
CREATE TABLE table_37069 ( "Season" real, "Team" text, "Games" real, "Wins" real, "Losses" real, "Ties" real )
Which Season has Ties smaller than 1, and a Team of vancouver grizzlies, and Wins smaller than 1?
SELECT SUM("Season") FROM table_37069 WHERE "Ties" < '1' AND "Team" = 'vancouver grizzlies' AND "Wins" < '1'
wikisql
CREATE TABLE table_61604 ( "Location" text, "Partner" text, "Construction Start" text, "Inauguration Date" text, "Population Served" real, "Design flow (LPM)" real )
What Partner has a Construction Start of 2008 january?
SELECT "Partner" FROM table_61604 WHERE "Construction Start" = '2008 january'
wikisql
CREATE TABLE table_name_5 ( race VARCHAR, margin VARCHAR )
Which race has a Margin of 8?
SELECT race FROM table_name_5 WHERE margin = "8"
sql_create_context
CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases INTEGER, Drink TEXT ) CREATE TABLE appellations ( No INTEGER, Appelation TEXT, County TEXT, State TEXT, Area...
Give me a line chart about each year's maximum score .
SELECT Year, MAX(Score) FROM wine GROUP BY Year
nvbench
CREATE TABLE table_41593 ( "Animal" text, "Cell type" text, "Resting potential (mV)" text, "AP increase (mV)" text, "AP duration (ms)" text, "Conduction speed (m/s)" text )
What AP increase has an AP duration of 0.75?
SELECT "AP increase (mV)" FROM table_41593 WHERE "AP duration (ms)" = '0.75'
wikisql
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
Number of comments on each user's posts.
SELECT Users.DisplayName, COUNT(Posts.Id) AS number_of_posts, SUM(CommentCount) * 1.0 / COUNT(Posts.Id) AS number_of_comments_per_post FROM Users INNER JOIN Posts ON Posts.OwnerUserId = Users.Id GROUP BY DisplayName ORDER BY 2 DESC
sede
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...
provide the number of patients whose admission year is less than 2103 and procedure icd9 code is 40?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2103" AND procedures.icd9_code = "40"
mimicsql_data
CREATE TABLE table_3521 ( "Institution" text, "Location" text, "Founded" real, "Type" text, "Enrollment" real, "Nickname" text, "Joined" text, "Left" text, "Current Conference" text )
What is the enrollment for the institution nicknamed the panthers that left in 2012?
SELECT "Enrollment" FROM table_3521 WHERE "Left" = '2012' AND "Nickname" = 'Panthers'
wikisql
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE SuggestedEdits ( Id number, Pos...
Your *Best* questions: ViewVoteRatio per User. Ranks your top 100 'best' questions: those where viewers are most likely to upvote at the top.
WITH BaseData AS (SELECT p.Id, p.ViewCount, COUNT(v.Id) AS NrOfVotes FROM Posts AS p LEFT JOIN Votes AS v ON v.PostId = p.Id AND v.VoteTypeId = 2 WHERE p.PostTypeId = 1 AND p.OwnerUserId = '##UserId##' GROUP BY p.Id, p.ViewCount) SELECT Id AS "post_link", ViewCount, NrOfVotes, STR(NrOfVotes * 100.0 / ViewCount, 10, 2) ...
sede
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
what the age of patient 021-131895 was during their first hospital visit?
SELECT patient.age FROM patient WHERE patient.uniquepid = '021-131895' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1
eicu
CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, Date_of_Birth text ) CREATE TABLE entrepreneur ( Entrepreneur_ID int, People_ID int, Company text, Money_Requested real, Investor text )
Return a histogram on how many entrepreneurs correspond to each investor?, sort by the X in ascending.
SELECT Investor, COUNT(*) FROM entrepreneur GROUP BY Investor ORDER BY Investor
nvbench
CREATE TABLE table_11140 ( "Year" real, "Theme" text, "Artist" text, "Composition" text, "Mintage" real, "Issue Price" text )
What is the theme of the coin from before 2006?
SELECT "Theme" FROM table_11140 WHERE "Year" < '2006'
wikisql
CREATE TABLE domain ( did int, name varchar ) CREATE TABLE conference ( cid int, homepage varchar, name varchar ) CREATE TABLE domain_author ( aid int, did int ) CREATE TABLE journal ( homepage varchar, jid int, name varchar ) CREATE TABLE writes ( aid int, pid int ) ...
return me the total citations of papers in PVLDB in 2005 .
SELECT SUM(publication.citation_num) FROM journal, publication WHERE journal.name = 'PVLDB' AND publication.jid = journal.jid AND publication.year = 2005
academic
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TA...
retrieve the patient identifications of patients that were diagnosed with s/p exploratory laparotomy a year before.
SELECT patient.uniquepid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 's/p exploratory laparotomy' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year'))
eicu
CREATE TABLE buildings ( name VARCHAR, Height VARCHAR )
List the names of buildings in descending order of building height.
SELECT name FROM buildings ORDER BY Height DESC
sql_create_context
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those products with a price between 60 and 120, draw a bar chart about the distribution of name and manufacturer , and I want to sort from high to low by the total number.
SELECT Name, Manufacturer FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Manufacturer DESC
nvbench
CREATE TABLE table_name_44 ( team_1 VARCHAR )
What is the first round when team 1 was toulouse fc (d1)?
SELECT 1 AS st_round FROM table_name_44 WHERE team_1 = "toulouse fc (d1)"
sql_create_context
CREATE TABLE table_1036189_1 ( bullet_tip_color VARCHAR, other_features VARCHAR )
How many bullet tips colors had other features of a blue band on case base?
SELECT COUNT(bullet_tip_color) FROM table_1036189_1 WHERE other_features = "Blue band on case base"
sql_create_context
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...
Specify the route of adminsitration and code for the drug Gastroview (Diatrizoate Meglumine & Sodium)
SELECT prescriptions.formulary_drug_cd, prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Gastroview (Diatrizoate Meglumine & Sodium)"
mimicsql_data
CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimme...
Return a bar chart about the distribution of meter_300 and ID , could you display in descending by the X-axis?
SELECT meter_300, ID FROM swimmer ORDER BY meter_300 DESC
nvbench
CREATE TABLE table_2245 ( "Rank" real, "Runs" real, "Player" text, "Matches" real, "Innings" real, "Not Out" real, "Average" text )
What is the innings when the average is 36.48?
SELECT MAX("Innings") FROM table_2245 WHERE "Average" = '36.48'
wikisql
CREATE TABLE jybgb ( YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text, BGDH text, BGRQ time, JYLX number, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SQRGH text, SQRXM text, BGRGH text, BGRXM text, SHRGH ...
在检验结果指标的记录中标号为94553760413所对应的检验报告单号是多少呢?
SELECT BGDH FROM jyjgzbb WHERE JYZBLSH = '94553760413'
css
CREATE TABLE table_79774 ( "Region/Country" text, "Local name" text, "Network" text, "Dates aired" text, "Starring" text )
What is the local name for the episodes that aired in 1981?
SELECT "Local name" FROM table_79774 WHERE "Dates aired" = '1981'
wikisql
CREATE TABLE table_name_4 ( extra_points VARCHAR, touchdowns VARCHAR, field_goals VARCHAR )
How many Extra points have Touchdowns larger than 2, and Field goals larger than 0?
SELECT COUNT(extra_points) FROM table_name_4 WHERE touchdowns > 2 AND field_goals > 0
sql_create_context
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
在18年2月11日至18年6月8日内所有检验报告单中的标本采集部位患者78981064的是都在哪?
(SELECT jybgb.BBCJBW 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 = '78981064' AND jybgb.BGRQ BETWEEN '2018-02-11' AND '2018-06-08') U...
css
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0),...
Give the name of each department and the number of employees in each Plot them as bar chart, and could you display from low to high by the y-axis?
SELECT DEPARTMENT_NAME, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID GROUP BY T2.DEPARTMENT_NAME ORDER BY COUNT(*)
nvbench
CREATE TABLE table_name_61 ( winner VARCHAR, circuit VARCHAR )
Which driver won the Phillip Island Grand Prix Circuit?
SELECT winner FROM table_name_61 WHERE circuit = "phillip island grand prix circuit"
sql_create_context
CREATE TABLE table_name_79 ( number INTEGER, home_club VARCHAR, year_end VARCHAR )
Which Number has a Home Club of broomstones, and a Year End smaller than 1999?
SELECT MIN(number) FROM table_name_79 WHERE home_club = "broomstones" AND year_end < 1999
sql_create_context
CREATE TABLE table_62393 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real )
Name the Place which has To par of 5, in united states?
SELECT "Place" FROM table_62393 WHERE "Country" = 'united states' AND "To par" = '–5'
wikisql
CREATE TABLE table_2725949_6 ( podiums INTEGER, season VARCHAR )
Name the least podiums for 2009
SELECT MIN(podiums) FROM table_2725949_6 WHERE season = 2009
sql_create_context
CREATE TABLE table_name_73 ( points INTEGER, place VARCHAR, draw VARCHAR )
What is the number of points for the 7th placed song with a draw greater than 8?
SELECT MIN(points) FROM table_name_73 WHERE place = "7th" AND draw > 8
sql_create_context
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 )
What is the total number of captains in each rank and class? Let class as X-axis, and categorize by rank with a stacked bar chart, show names from high to low order please.
SELECT Class, COUNT(Class) FROM captain GROUP BY Rank, Class ORDER BY Class DESC
nvbench
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, ...
这个号码是95841621的病人在医院3219418的门诊诊断名称不含有煤的门诊就诊记录是哪几条?
SELECT * 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 = '95841621' AND hz_info.YLJGDM = '3219418' AND NOT wdmzjzjlb.JZZDSM LIKE '%煤%' UNION SELECT * FROM hz_info JOIN bdmzjzjlb ON hz_info.YLJGDM = bdmzjzjlb.YLJGDM AND h...
css
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE labevents ( row...
had patient 83499 undergone the insert vasc access dev operation since 2 years ago?
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'insert vasc access dev') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83499) AND DATETIME(proc...
mimic_iii