table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
⌀
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id...
what is the airfare for flights from DENVER to PITTSBURGH on DL
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city...
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, give me the comparison about price over the name , and group by attribute headquarter by a bar chart.
SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name
CREATE TABLE table_291 ( "Player" text, "Position" text, "School" text, "Hometown" text, "MLB Draft" text )
How many players have the hometown Pennsauken, NJ?
SELECT COUNT("Player") FROM table_291 WHERE "Hometown" = 'Pennsauken, NJ'
CREATE TABLE table_name_49 ( mixed_doubles VARCHAR, year VARCHAR )
Who won the Mixed Doubles in 2007?
SELECT mixed_doubles FROM table_name_49 WHERE year = "2007"
CREATE TABLE table_name_24 ( lost INTEGER, goals_against VARCHAR, points VARCHAR )
How many losses have 222 as the goals against, with points greater than 78?
SELECT SUM(lost) FROM table_name_24 WHERE goals_against = 222 AND points > 78
CREATE TABLE table_name_4 ( semifinal VARCHAR, athlete VARCHAR )
Hossein Ojaghi participated in what semifinal.
SELECT semifinal FROM table_name_4 WHERE athlete = "hossein ojaghi"
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic (...
get me the age of patient with patient id 3343.
SELECT demographic.age FROM demographic WHERE demographic.subject_id = "3343"
CREATE TABLE table_name_24 ( result VARCHAR, game_site VARCHAR, week VARCHAR )
What was the result for the game at Memorial Stadium in week 15?
SELECT result FROM table_name_24 WHERE game_site = "memorial stadium" AND week = 15
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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), ...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, give me the comparison about the average of department_id over the hire_date bin hire_date by weekday, display by the total number in desc.
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(DEPARTMENT_ID) DESC
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...
What number of patients with their lab test name as amylase were discharged at home health care?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.discharge_location = "HOME HEALTH CARE" AND lab.label = "Amylase"
CREATE TABLE Grants ( grant_id INTEGER, organisation_id INTEGER, grant_amount DECIMAL(19,4), grant_start_date DATETIME, grant_end_date DATETIME, other_details VARCHAR(255) ) CREATE TABLE Organisations ( organisation_id INTEGER, organisation_type VARCHAR(10), organisation_details VAR...
For all organizations that have grants of more than 6000 dollars, compare the number of details of the organizations with a bar chart, order by the y axis in descending.
SELECT organisation_details, COUNT(organisation_details) FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY organisation_details ORDER BY COUNT(organisation_details) DESC
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 ethnicity is black/african american and diagnoses icd9 code is 56210?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND diagnoses.icd9_code = "56210"
CREATE TABLE takes ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), grade varchar(2) ) CREATE TABLE time_slot ( time_slot_id varchar(4), day varchar(1), start_hr numeric(2), start_min numeric(2), end_hr numeric(2), end_min...
Return a histogram on what are the names and budgets of departments with budgets greater than the average?, and sort in ascending by the Y please.
SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department) ORDER BY budget
CREATE TABLE table_name_82 ( tns_sofres_5_26_09 VARCHAR, ipsos_5_25_09 VARCHAR )
Which TNS-Sofres 5/26/09 has an Ipsos 5/25/09 of 1%?
SELECT tns_sofres_5_26_09 FROM table_name_82 WHERE ipsos_5_25_09 = "1%"
CREATE TABLE table_name_27 ( drawn INTEGER, lost VARCHAR, points VARCHAR, against VARCHAR )
What is the highest number of draws with more than 15 points, an against of 19, and less than 3 losses?
SELECT MAX(drawn) FROM table_name_27 WHERE points > 15 AND against = 19 AND lost < 3
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
what is the number of patients whose age is less than 56 and drug name is voriconazole?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "56" AND prescriptions.drug = "Voriconazole"
CREATE TABLE table_name_29 ( dots VARCHAR, ellipsis VARCHAR )
What is the dot value when the ellipsis is 0.012345679 ?
SELECT dots FROM table_name_29 WHERE ellipsis = "0.012345679…"
CREATE TABLE table_name_7 ( monarch VARCHAR, left_office VARCHAR )
Who is the monarch that left office circa 1886?
SELECT monarch FROM table_name_7 WHERE left_office = "circa 1886"
CREATE TABLE Products ( product_id INTEGER, product_type_code VARCHAR(10), product_name VARCHAR(80), product_price DECIMAL(19,4) ) CREATE TABLE Departments ( department_id INTEGER, dept_store_id INTEGER, department_name VARCHAR(80) ) CREATE TABLE Customer_Orders ( order_id INTEGER, ...
Bar chart x axis product type code y axis maximal product price, order names from high to low order.
SELECT product_type_code, MAX(product_price) FROM Products GROUP BY product_type_code ORDER BY product_type_code DESC
CREATE TABLE table_dev_23 ( "id" int, "anemia" bool, "gender" string, "thyroid_disease" bool, "hemoglobin_a1c_hba1c" float, "tsh" int, "renal_disease" bool, "estimated_glomerular_filtration_rate_egfr" int, "hba1c" float, "insulin_requirement" float, "body_mass_index_bmi" floa...
hba1c < 10 % ; if hba1c < 6 % then total daily insulin must be >= 0.5 u / kg
SELECT * FROM table_dev_23 WHERE hba1c < 10 OR (hemoglobin_a1c_hba1c < 6 AND insulin_requirement >= 0.5)
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text,...
Top 100 SO Users from India. I m on 81st position
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location FROM Users WHERE LOWER(Location) LIKE '%india' AND LOWER(Id) LIKE '%taurus05' ORDER BY Reputation DESC LIMIT 100000
CREATE TABLE table_name_7 ( player VARCHAR, to_par VARCHAR, country VARCHAR )
Which Player has a To par of 2, and a Country of wales?
SELECT player FROM table_name_7 WHERE to_par = "–2" AND country = "wales"
CREATE TABLE table_5808 ( "Date" text, "Venue" text, "Opponent" text, "Score" text, "Competition" text )
Which competition had an opponent of Police at the Selayang Stadium?
SELECT "Competition" FROM table_5808 WHERE "Opponent" = 'police' AND "Venue" = 'selayang stadium'
CREATE TABLE table_456 ( "Episode" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text )
What is the song choice when the theme is not aired?
SELECT "Theme" FROM table_456 WHERE "Song choice" = 'Not Aired'
CREATE TABLE table_11449 ( "Date" text, "Opponents" text, "Result" text, "Score" text, "Competition" text, "Venue" text )
When were scottish football league xi the opponents with a score of 1-5?
SELECT "Date" FROM table_11449 WHERE "Opponents" = 'scottish football league xi' AND "Score" = '1-5'
CREATE TABLE table_9906 ( "Generation" text, "Birthday" text, "Birthplace" text, "Blood Type" text, "Agency" text )
What generation is the member born on 1992.12.23 in?
SELECT "Generation" FROM table_9906 WHERE "Birthday" = '1992.12.23'
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...
For each cinema, show the price and group them by film title in a stacked bar chart.
SELECT Title, Price FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID GROUP BY Name, Title
CREATE TABLE genre ( g_name varchar2(20), rating varchar2(10), most_popular_in varchar2(50) ) CREATE TABLE artist ( artist_name varchar2(50), country varchar2(20), gender varchar2(20), preferred_genre varchar2(50) ) CREATE TABLE song ( song_name varchar2(50), artist_name varchar2(5...
What are the names of all genres in alphabetical order, combined with its ratings. Show bar chart.
SELECT g_name, rating FROM genre ORDER BY g_name
CREATE TABLE table_15383 ( "Position" real, "Club" text, "Played" real, "Points" text, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
How many losses altogether were had by teams that won 12 times, had 40-4 points, and more than 57 goals?
SELECT SUM("Losses") FROM table_15383 WHERE "Wins" = '12' AND "Points" = '40-4' AND "Goals for" > '57'
CREATE TABLE table_name_17 ( played INTEGER, goals_for VARCHAR, goals_against VARCHAR )
What is the fewest games played for teams with 73 goals for and more than 69 goals against?
SELECT MIN(played) FROM table_name_17 WHERE goals_for = 73 AND goals_against > 69
CREATE TABLE table_name_28 ( power VARCHAR, model VARCHAR, years VARCHAR )
What is the power for model 2.0 tdi (cr) dpf, and a Years of 2010 2011?
SELECT power FROM table_name_28 WHERE model = "2.0 tdi (cr) dpf" AND years = "2010–2011"
CREATE TABLE table_name_27 ( matches VARCHAR, goals INTEGER )
How many goals/matches have 153 as the goals with matches greater than 352?
SELECT SUM(goals) / matches FROM table_name_27 WHERE goals = 153 AND matches > 352
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...
what is the number of patients whose admission type is emergency and drug route is iv?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND prescriptions.route = "IV"
CREATE TABLE table_62261 ( "Call sign" text, "Frequency MHz" real, "City of license" text, "Facility ID" real, "ERP W" real, "Height m ( ft )" text, "Class" text, "FCC info" text )
Which Class has a Facility ID greater than 85076 and a Call Sign of K289au?
SELECT "Class" FROM table_62261 WHERE "Facility ID" > '85076' AND "Call sign" = 'k289au'
CREATE TABLE table_76087 ( "engine model" text, "engine displacement" text, "valvetrain" text, "max. power : kW ( PS )" text, "rpm for max. power" text, "max. torque : Nm ( ft\u00b7lbf )" text, "rpm for max. torque" text )
What is the valvetrain with an engine model that is engine model?
SELECT "valvetrain" FROM table_76087 WHERE "engine model" = 'engine model'
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, ...
how many days have passed since patient 006-133605 received his or her last co/sorenson intake on the current intensive care unit visit?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', intakeoutput.intakeoutputtime)) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid =...
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, ...
how many patients are diagnosed for perforation of intestine and administered through si drug route?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Perforation of intestine" AND prescriptions.route = "SL"
CREATE TABLE table_17346 ( "#" real, "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" text, "Record" text, "Streak" text )
What is the leading scorer on february 1?
SELECT "Leading scorer" FROM table_17346 WHERE "Date" = 'February 1'
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE m...
when was the last time patient 70950 was diagnosed with hemopericardium until 2104?
SELECT diagnoses_icd.charttime FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hemopericardium') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 70950) AND STRFTIME('%y', ...
CREATE TABLE table_name_78 ( against INTEGER, lost INTEGER )
Which average against has a lost less than 1?
SELECT AVG(against) FROM table_name_78 WHERE lost < 1
CREATE TABLE table_name_46 ( place VARCHAR, player VARCHAR )
What place did Paul McGinley finish in?
SELECT place FROM table_name_46 WHERE player = "paul mcginley"
CREATE TABLE table_34300 ( "Round" real, "Pick" real, "Player" text, "Nationality" text, "School/Club Team" text )
What is the average pick number of Pennsylvania?
SELECT AVG("Pick") FROM table_34300 WHERE "School/Club Team" = 'pennsylvania'
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, ...
Show all names of vote types.
SELECT Id, Name FROM VoteTypes
CREATE TABLE table_name_24 ( laps VARCHAR, time_retired VARCHAR )
How many laps were ridden in the race that had a Time/Retired of +37.351?
SELECT COUNT(laps) FROM table_name_24 WHERE time_retired = "+37.351"
CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) CREATE TABLE View_Unit_Status ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME, available_yn BIT ) CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), ...
Draw a pie chart for how many bookings does each booking status have? List the booking status code and the number of corresponding bookings.
SELECT booking_status_code, COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code
CREATE TABLE table_204_778 ( id number, "code" number, "county" text, "former province" text, "area (km2)" number, "population\ncensus 2009" number, "capital" text )
which is the top county in terms of area ?
SELECT "county" FROM table_204_778 ORDER BY "area (km2)" DESC LIMIT 1
CREATE TABLE editor ( Editor_ID int, Name text, Age real ) CREATE TABLE journal_committee ( Editor_ID int, Journal_ID int, Work_Type text ) CREATE TABLE journal ( Journal_ID int, Date text, Theme text, Sales int )
Just show the id and name of each editor using a bar chart, order by the y axis in ascending.
SELECT T1.Name, T1.Editor_ID FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID ORDER BY T1.Editor_ID
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...
count the number of patients who had discharge location as snf and diagnoses titled coagulat defect nec/nos.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "SNF" AND diagnoses.short_title = "Coagulat defect NEC/NOS"
CREATE TABLE table_name_62 ( jersey__number INTEGER, birthplace VARCHAR, weight__kg_ VARCHAR )
What is the lowest jersey # that has evergreen park, illinois as the birthplace, with a weight (km) greater than 86?
SELECT MIN(jersey__number) FROM table_name_62 WHERE birthplace = "evergreen park, illinois" AND weight__kg_ > 86
CREATE TABLE table_name_6 ( brilliance_grade VARCHAR, crown_angle VARCHAR )
Which Brilliance Grade has a Crown angle of 41.1 ?
SELECT brilliance_grade FROM table_name_6 WHERE crown_angle = "41.1°"
CREATE TABLE table_name_99 ( numeric_decline_from_peak_population VARCHAR, percent_decline_from_peak_population VARCHAR )
what is the numeric decline from peak population when the perfect decline from peak population is -16.76%
SELECT numeric_decline_from_peak_population FROM table_name_99 WHERE percent_decline_from_peak_population = "-16.76%"
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime...
did there any organism in the first other microbiology test of patient 031-3355 in this year?
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355')) AND microlab.culturesite = 'other' AND DATETIME(microlab.cultureta...
CREATE TABLE table_15824796_3 ( title VARCHAR, original_air_date VARCHAR )
How many episodes aired on february 13, 1954?
SELECT COUNT(title) FROM table_15824796_3 WHERE original_air_date = "February 13, 1954"
CREATE TABLE table_37553 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
What was the score on March 23?
SELECT "Score" FROM table_37553 WHERE "Date" = 'march 23'
CREATE TABLE table_name_84 ( hdtv VARCHAR, content VARCHAR )
What is the HDTV when documentaries are the content?
SELECT hdtv FROM table_name_84 WHERE content = "documentaries"
CREATE TABLE table_name_97 ( year VARCHAR, supplier VARCHAR )
What is the Year for Supplier Kooga?
SELECT year FROM table_name_97 WHERE supplier = "kooga"
CREATE TABLE table_name_82 ( death VARCHAR, image VARCHAR )
What is the death date of elisabeth of lorraine?
SELECT death FROM table_name_82 WHERE image = "elisabeth of lorraine"
CREATE TABLE table_49220 ( "Date" text, "H/A/N" text, "Opponent" text, "Score" text, "Record" text )
What is the record for the Detroit Pistons on March 7?
SELECT "Record" FROM table_49220 WHERE "Opponent" = 'detroit pistons' AND "Date" = 'march 7'
CREATE TABLE table_72537 ( "Celebrity" text, "Famous for" text, "Entered" text, "Exited" text, "Finished" text )
Name the finished for exited day 13
SELECT "Finished" FROM table_72537 WHERE "Exited" = 'Day 13'
CREATE TABLE table_203_38 ( id number, "#" number, "title" text, "producer(s)" text, "performer(s)" text, "length" text )
which is longer , fire or die 4 ?
SELECT "title" FROM table_203_38 WHERE "title" IN ('"fire"', '"die 4"') ORDER BY "length" DESC LIMIT 1
CREATE TABLE table_name_93 ( decile INTEGER, name VARCHAR, gender VARCHAR, authority VARCHAR )
How many deciles have a Gender of coed, an Authority of state, and a Name of mount maunganui school?
SELECT SUM(decile) FROM table_name_93 WHERE gender = "coed" AND authority = "state" AND name = "mount maunganui school"
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE Apartment_Bookings ( apt_bookin...
Show the facility codes of apartments with more than 4 bedrooms, and count them by a bar chart, and I want to list by the bars from low to high.
SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code ORDER BY facility_code
CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ...
count the number of people who were diagnosed with ath ext ntv art ulcrtion but did not come back to the hospital within 2 months in 2105.
SELECT (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'ath ext nt...
CREATE TABLE table_name_47 ( loss VARCHAR, date VARCHAR )
What loss has october 1 as the date?
SELECT loss FROM table_name_47 WHERE date = "october 1"
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
How frequently does the class meet for MEMS 333 ?
SELECT DISTINCT course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_i...
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 ) ...
Find the maximum age of patients who are married and whose discharge location is rehab/distinct part hosp.
SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.discharge_location = "REHAB/DISTINCT PART HOSP"
CREATE TABLE table_name_55 ( team VARCHAR, location_attendance VARCHAR )
What team did the Heat play against at the TD Waterhouse Centre?
SELECT team FROM table_name_55 WHERE location_attendance = "td waterhouse centre"
CREATE TABLE order_items ( product_id VARCHAR, order_id VARCHAR ) CREATE TABLE orders ( customer_id VARCHAR, order_id VARCHAR ) CREATE TABLE products ( product_name VARCHAR, product_id VARCHAR ) CREATE TABLE customers ( customer_name VARCHAR, customer_id VARCHAR )
List the names of the customers who have once bought product 'food'.
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T4.product_name = "food" GROUP BY T1.customer_id HAVING COUNT(*) >= 1
CREATE TABLE table_name_67 ( away_team VARCHAR, home_team VARCHAR )
Who is the away team that played home team Footscray?
SELECT away_team FROM table_name_67 WHERE home_team = "footscray"
CREATE TABLE Employees ( employee_name VARCHAR, employee_id VARCHAR ) CREATE TABLE Documents_to_be_destroyed ( Destruction_Authorised_by_Employee_ID VARCHAR, Destroyed_by_Employee_ID VARCHAR )
What are the names of the employees who authorised the destruction and the employees who destroyed the corresponding documents?
SELECT T2.employee_name, T3.employee_name FROM Documents_to_be_destroyed AS T1 JOIN Employees AS T2 ON T1.Destruction_Authorised_by_Employee_ID = T2.employee_id JOIN Employees AS T3 ON T1.Destroyed_by_Employee_ID = T3.employee_id
CREATE TABLE table_name_58 ( additional_major_sponsor_s_ VARCHAR, additional_colour_s_ VARCHAR, year VARCHAR )
What are the additional major sponsors which correspond to the additional color black and a year 1984?
SELECT additional_major_sponsor_s_ FROM table_name_58 WHERE additional_colour_s_ = "black" AND year = 1984
CREATE TABLE workshop ( Workshop_ID int, Date text, Venue text, Name text ) CREATE TABLE submission ( Submission_ID int, Scores real, Author text, College text ) CREATE TABLE Acceptance ( Submission_ID int, Workshop_ID int, Result text )
How many workshops did each author submit to? Return the author name and the number of workshops Plot them as bar chart, and display bar in desc order.
SELECT Author, COUNT(DISTINCT T1.Workshop_ID) FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY Author DESC
CREATE TABLE table_21317 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location/Attendance" text, "Record" text )
Name the record for score of w 76-67
SELECT "Record" FROM table_21317 WHERE "Score" = 'W 76-67'
CREATE TABLE table_name_53 ( place VARCHAR, to_par VARCHAR, player VARCHAR )
WHich Place has a To par of 2, and a Player of bernhard langer?
SELECT place FROM table_name_53 WHERE to_par = "–2" AND player = "bernhard langer"
CREATE TABLE table_4864 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the name of the away team with glenferrie oval venue?
SELECT "Away team" FROM table_4864 WHERE "Venue" = 'glenferrie oval'
CREATE TABLE table_name_83 ( seat_order__right_to_left_ VARCHAR, series_3 VARCHAR )
How many Seat Orders (Right to Left) have a Series 3 of deborah meaden?
SELECT COUNT(seat_order__right_to_left_) FROM table_name_83 WHERE series_3 = "deborah meaden"
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
what is the insurance and primary disease of the patient id 2560?
SELECT demographic.insurance, demographic.diagnosis FROM demographic WHERE demographic.subject_id = "2560"
CREATE TABLE finrev_fed_key_17 ( state_code number, state text, #_records text ) CREATE TABLE finrev_fed_17 ( state_code number, idcensus number, school_district text, nces_id text, yr_data number, t_fed_rev number, c14 number, c25 number ) CREATE TABLE ndecoreexcel_math_gr...
What are the top five states in descending order in terms of revenue provided to school districts?
SELECT T2.state FROM finrev_fed_key_17 AS T2 JOIN finrev_fed_17 AS T1 ON T1.state_code = T2.state_code GROUP BY T1.state_code ORDER BY SUM(t_fed_rev)
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...
what was the first medication prescribed to patient 22782 since 92 months ago?
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 22782) AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-92 month') ORDER BY prescriptions.startdate LIMIT 1
CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int,...
i need to know information for flights leaving DALLAS on tuesday evening and returning to ATLANTA
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 = 'ATLANTA' AND date_day.day_number = 22 AND date_day.month_number = 3 AND ...
CREATE TABLE procedures ( 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 maximum days of hospital stay of patients whose primary disease is liver transplant?
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "LIVER TRANSPLANT"
CREATE TABLE table_76568 ( "Edition" text, "Round" text, "Date" text, "Partnering" text, "Against" text, "Surface" text, "Opponents" text, "Result" text )
What Edition had a Result of 6-3, 6-0, 6-2?
SELECT "Edition" FROM table_76568 WHERE "Result" = '6-3, 6-0, 6-2'
CREATE TABLE table_name_60 ( non__stop VARCHAR, aspirated_stop VARCHAR )
Which Non- stop has an Aspirated stop of ?
SELECT non__stop FROM table_name_60 WHERE aspirated_stop = "ㅎ"
CREATE TABLE furniture ( furniture_id number, name text, num_of_component number, market_rate number ) CREATE TABLE manufacturer ( manufacturer_id number, open_year number, name text, num_of_factories number, num_of_shops number ) CREATE TABLE furniture_manufacte ( manufacturer...
List all manufacturer names and ids ordered by their opening year.
SELECT name, manufacturer_id FROM manufacturer ORDER BY open_year
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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
how much nevirapine suspension was prescribed to patient 14990 last until 11/2104?
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14990) AND prescriptions.drug = 'nevirapine suspension' AND STRFTIME('%y-%m', prescriptions.startdate) <= '2104-11' ORDER BY prescriptions.startdate DESC LIMIT 1
CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adults INTEGER, Kids INTEGER ) CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, baseP...
Show the frequency of the decor of rooms that have a king bed using a pie chart.
SELECT decor, COUNT(decor) FROM Rooms WHERE bedType = 'King' GROUP BY decor
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, ...
Does the bounty system work?.
WITH bounty_answers AS (SELECT 1.0 * a.Score AS Score, CASE WHEN q.AcceptedAnswerId = a.Id THEN 1 ELSE 0 END AS accepted, CASE WHEN a.CreationDate < v.CreationDate THEN 'before' WHEN a.CreationDate > v.CreationDate THEN 'after' END AS rel_date FROM Posts AS q JOIN Posts AS a ON a.ParentId = q.Id JOIN Votes AS v ON v.Po...
CREATE TABLE table_63393 ( "Year" real, "Competition Description" text, "Location" text, "Apparatus" text, "Rank-Final" real, "Score-Final" real )
Which Score-Final has an Apparatus of floor exercise?
SELECT MAX("Score-Final") FROM table_63393 WHERE "Apparatus" = 'floor exercise'
CREATE TABLE table_34742 ( "Year" text, "Regular Season Champion(s)" text, "Record" text, "Tournament Champion" text, "Tournament venue" text, "Tournament city" text )
WHich Tournament venue has a Tournament Champion of duke and a Record of 15 1?
SELECT "Tournament venue" FROM table_34742 WHERE "Tournament Champion" = 'duke' AND "Record" = '15–1'
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type t...
what is the average cost in a hospital involving a laboratory test for albumin, body fluid during a year before?
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'albumin, body fluid')) AND DATETIME(cost.chargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'sta...
CREATE TABLE table_name_18 ( pos VARCHAR, date_to VARCHAR, name VARCHAR )
What is Pos., when Date To is '30 June 2009', and when Name is 'Eddie Johnson'?
SELECT pos FROM table_name_18 WHERE date_to = "30 june 2009" AND name = "eddie johnson"
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 was hired before 2002-06-21, give me the comparison about the sum of employee_id over the hire_date bin hire_date by weekday, and sort Y-axis in desc order please.
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY SUM(EMPLOYEE_ID) DESC
CREATE TABLE table_name_81 ( town VARCHAR, population_rank VARCHAR, municipality VARCHAR, population__2001_ VARCHAR )
What town is from the mol tai district municipality and has a population rank of 187 and a population less than 470 in 2001?
SELECT town FROM table_name_81 WHERE municipality = "molėtai district municipality" AND population__2001_ < 470 AND population_rank = 187
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
For section in ENSCEN 541 between 9:00 and 3:00 , what is the availability ?
SELECT DISTINCT course_offering.end_time, course_offering.section_number, course_offering.start_time FROM course, course_offering, semester WHERE course_offering.end_time <= '3:00' AND course_offering.start_time >= '9:00' AND course.course_id = course_offering.course_id AND course.department = 'ENSCEN' AND course.numbe...
CREATE TABLE Customers ( customer_id INTEGER, customer_type_code VARCHAR(20), address_line_1 VARCHAR(80), address_line_2 VARCHAR(80), town_city VARCHAR(80), state VARCHAR(80), email_address VARCHAR(255), phone_number VARCHAR(80) ) CREATE TABLE Complaints ( complaint_id INTEGER, ...
Return the average price of products that have each category code, and sort in ascending by the names.
SELECT product_category_code, AVG(product_price) FROM Products GROUP BY product_category_code ORDER BY product_category_code
CREATE TABLE assessment_notes ( notes_id number, student_id number, teacher_id number, date_of_notes time, text_of_notes text, other_details text ) CREATE TABLE behavior_incident ( incident_id number, incident_type_code text, student_id number, date_incident_start time, date...
What are the email addresses of teachers whose address has zip code '918'?
SELECT T2.email_address FROM addresses AS T1 JOIN teachers AS T2 ON T1.address_id = T2.address_id WHERE T1.zip_postcode = "918"
CREATE TABLE table_64510 ( "School" text, "Location" text, "Mascot" text, "Enrollment" real, "IHSAA Class" text, "IHSAA Football Class" text, "# / County" text )
What is the IHSAA class with 395 in enrollment?
SELECT "IHSAA Class" FROM table_64510 WHERE "Enrollment" = '395'
CREATE TABLE FlagTypes ( 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, DownVotes nu...
Asked but answers having less score. Questions we need to take a look at to increase our answered question rate.
SELECT questions.Id AS "post_link" FROM Posts AS questions JOIN Posts AS answers ON answers.ParentId = questions.Id WHERE questions.PostTypeId = 1 AND answers.PostTypeId = 2 AND questions.AcceptedAnswerId IS NULL AND questions.ClosedDate IS NULL GROUP BY questions.Id, questions.CreationDate HAVING MAX(answers.Score) = ...
CREATE TABLE table_52618 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the score of the home team when they played carlton?
SELECT "Home team score" FROM table_52618 WHERE "Away team" = 'carlton'
CREATE TABLE College ( cName varchar(20), state varchar(2), enr numeric(5,0) ) CREATE TABLE Player ( pID numeric(5,0), pName varchar(20), yCard varchar(3), HS numeric(5,0) ) CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3) )
A pie chart for finding the number of the name of all students who were in the tryout sorted in alphabetic order.
SELECT pName, COUNT(pName) FROM Player AS T1 JOIN Tryout AS T2 ON T1.pID = T2.pID GROUP BY pName ORDER BY T1.pName