schema
stringlengths 28
5.65k
| question
stringlengths 0
990
| rejected
stringlengths 2
4.44k
| chosen
stringlengths 4
9.17k
| weight
float64 0
8.95
|
---|---|---|---|---|
CREATE TABLE table_1341586_14 (result VARCHAR, incumbent VARCHAR)
|
How did the election end for Terry L. Bruce?
|
SELECT result FROM table_1341586_14 WHERE incumbent = "Terry L. Bruce"
|
SELECT "result" FROM "table_1341586_14" WHERE "Terry L. Bruce" = "incumbent"
| 0.074219 |
CREATE TABLE table_name_6 (rank INT, notes VARCHAR, country VARCHAR)
|
What is the sum of the rank of the rower with an r note from Australia?
|
SELECT SUM(rank) FROM table_name_6 WHERE notes = "r" AND country = "australia"
|
SELECT SUM("rank") FROM "table_name_6" WHERE "australia" = "country" AND "notes" = "r"
| 0.083984 |
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT)
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL)
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT)
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other)
CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT)
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE PostTypes (Id DECIMAL, Name TEXT)
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT)
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT)
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT)
|
find duplicates that have their targets as duplicates.
|
SELECT MONTH(CURRENT_TIMESTAMP())
|
SELECT MONTH(CURRENT_TIMESTAMP())
| 0.032227 |
CREATE TABLE table_204_292 (id DECIMAL, "no." DECIMAL, "name" TEXT, "class" DECIMAL, "games" DECIMAL, "minutes" DECIMAL, "points" DECIMAL, "2 points\ ( made/attempts ) " TEXT, "2 points\ ( % ) " DECIMAL, "3 points\ ( made/attempts ) " TEXT, "3 points\ ( % ) " DECIMAL, "free throws\ ( made/attempts ) " TEXT, "free throws\ ( % ) " DECIMAL, "rebounds offensive" DECIMAL, "rebounds defensive" DECIMAL, "rebounds total" DECIMAL, "assists" DECIMAL, "turnovers" DECIMAL, "steals" DECIMAL, "blocked shots" DECIMAL, "personal fouls" DECIMAL, "fouls drawn" DECIMAL)
|
who had more steals than any other player ?
|
SELECT "name" FROM table_204_292 ORDER BY "steals" DESC LIMIT 1
|
SELECT "name" FROM "table_204_292" ORDER BY "steals" DESC NULLS LAST LIMIT 1
| 0.074219 |
CREATE TABLE table_9394 ("Round" FLOAT, "Pick" FLOAT, "Player" TEXT, "Nationality" TEXT, "School/Club Team" TEXT)
|
How many round values are associated with Cleveland McCrae?
|
SELECT COUNT("Round") FROM table_9394 WHERE "Player" = 'cleveland mccrae'
|
SELECT COUNT("Round") FROM "table_9394" WHERE "Player" = 'cleveland mccrae'
| 0.073242 |
CREATE TABLE table_24889 ("English short name ( upper/lower case ) " TEXT, "Alpha-2 code" TEXT, "Alpha-3 code" TEXT, "Numeric code" FLOAT, "ISO 3166-2 codes" TEXT)
|
What is the Alpha 3 code for the area also known as FO?
|
SELECT "Alpha-3 code" FROM table_24889 WHERE "Alpha-2 code" = 'FO'
|
SELECT "Alpha-3 code" FROM "table_24889" WHERE "Alpha-2 code" = 'FO'
| 0.066406 |
CREATE TABLE table_16323766_3 (evening_gown VARCHAR, preliminary_average VARCHAR)
|
What was the evening gown score for the one who had a preliminary average of 8.121 (8)?
|
SELECT evening_gown FROM table_16323766_3 WHERE preliminary_average = "8.121 (8)"
|
SELECT "evening_gown" FROM "table_16323766_3" WHERE "8.121 (8)" = "preliminary_average"
| 0.084961 |
CREATE TABLE table_name_88 (year INT, bronze VARCHAR)
|
WHAT YEAR HAS A BRONZE OF VALENTIN NOVIKOV?
|
SELECT AVG(year) FROM table_name_88 WHERE bronze = "valentin novikov"
|
SELECT AVG("year") FROM "table_name_88" WHERE "bronze" = "valentin novikov"
| 0.073242 |
CREATE TABLE table_71526 ("Tournament" TEXT, "2001" TEXT, "2002" TEXT, "2003" TEXT, "2005" TEXT, "2006" TEXT, "2007" TEXT, "2008" TEXT, "2009" TEXT, "2010" TEXT, "2011" TEXT, "2012" TEXT)
|
What was the value in 2006 when 2003 was not held and 2012 was A?
|
SELECT "2006" FROM table_71526 WHERE "2003" = 'not held' AND "2012" = 'a'
|
SELECT "2006" FROM "table_71526" WHERE "2003" = 'not held' AND "2012" = 'a'
| 0.073242 |
CREATE TABLE table_name_48 (time_retired VARCHAR, grid VARCHAR)
|
What is the time of the driver on grid 7?
|
SELECT time_retired FROM table_name_48 WHERE grid = 7
|
SELECT "time_retired" FROM "table_name_48" WHERE "grid" = 7
| 0.057617 |
CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL)
CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL)
CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL)
CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL)
CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR)
CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR)
CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL)
|
For those employees who was hired before 2002-06-21, a bar chart shows the distribution of hire_date and the average of salary bin hire_date by time.
|
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21'
|
SELECT "HIRE_DATE", AVG("SALARY") FROM "employees" WHERE "HIRE_DATE" < '2002-06-21'
| 0.081055 |
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 TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
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 lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
|
how many patients have undergone the lab test name ethanol?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Ethanol"
|
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Ethanol" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id"
| 0.150391 |
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)
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 (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 TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
|
provide the number of patients whose diagnoses icd9 code is e8786 and lab test abnormal status is abnormal?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "E8786" AND lab.flag = "abnormal"
|
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "E8786" = "diagnoses"."icd9_code" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "abnormal" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
| 0.253906 |
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 compartment_class (compartment VARCHAR, class_type VARCHAR)
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 city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR)
CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR)
CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT)
CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT)
CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR)
CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT)
CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT)
CREATE TABLE month (month_number INT, month_name TEXT)
CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT)
CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT)
CREATE TABLE days (days_code VARCHAR, day_name VARCHAR)
CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR)
CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR)
CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT)
CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT)
CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT)
CREATE TABLE flight_fare (flight_id INT, fare_id INT)
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_miles INT, pressurized VARCHAR)
CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT)
CREATE TABLE code_description (code VARCHAR, description 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 INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR)
CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT)
|
show me ground transportation in DENVER
|
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'DENVER' AND ground_service.city_code = city.city_code
|
SELECT DISTINCT "ground_service"."transport_type" FROM "city" JOIN "ground_service" ON "city"."city_code" = "ground_service"."city_code" WHERE "city"."city_name" = 'DENVER'
| 0.167969 |
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, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
CREATE TABLE procedures (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)
|
what is discharge time and procedure icd9 code of subject id 91588?
|
SELECT demographic.dischtime, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "91588"
|
SELECT "demographic"."dischtime", "procedures"."icd9_code" FROM "demographic" JOIN "procedures" ON "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "91588" = "demographic"."subject_id"
| 0.185547 |
CREATE TABLE table_70817 ("Date" TEXT, "Course" TEXT, "Distance" TEXT, "Type" TEXT, "Winner" TEXT, "Race Leader" TEXT)
|
On what date was the race course from Rome to Naples?
|
SELECT "Date" FROM table_70817 WHERE "Course" = 'rome to naples'
|
SELECT "Date" FROM "table_70817" WHERE "Course" = 'rome to naples'
| 0.064453 |
CREATE TABLE table_name_23 (away_team VARCHAR, venue VARCHAR)
|
What away team played at Brunswick Street Oval?
|
SELECT away_team FROM table_name_23 WHERE venue = "brunswick street oval"
|
SELECT "away_team" FROM "table_name_23" WHERE "brunswick street oval" = "venue"
| 0.077148 |
CREATE TABLE table_35061 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" FLOAT, "Result" TEXT)
|
What's the average year Charles N. Felton was re-elected?
|
SELECT AVG("First elected") FROM table_35061 WHERE "Result" = 're-elected' AND "Incumbent" = 'charles n. felton'
|
SELECT AVG("First elected") FROM "table_35061" WHERE "Incumbent" = 'charles n. felton' AND "Result" = 're-elected'
| 0.111328 |
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 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 TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear 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)
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
|
count the number of patients whose year of death is less than or equal to 2126 and drug code is ggac5l?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2126.0" AND prescriptions.formulary_drug_cd = "GGAC5L"
|
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "GGAC5L" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "2126.0" >= "demographic"."dod_year"
| 0.232422 |
CREATE TABLE table_56735 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
|
On February 10, what was the location attendance?
|
SELECT "Location Attendance" FROM table_56735 WHERE "Date" = 'february 10'
|
SELECT "Location Attendance" FROM "table_56735" WHERE "Date" = 'february 10'
| 0.074219 |
CREATE TABLE table_20403667_2 (crop_damaged__in_lakh_inr__ VARCHAR, public_property_damaged__in_lakh_inr__ VARCHAR)
|
How many crops were damaged when the public property damage was 1,03,049.60?
|
SELECT crop_damaged__in_lakh_inr__ FROM table_20403667_2 WHERE public_property_damaged__in_lakh_inr__ = "1,03,049.60"
|
SELECT "crop_damaged__in_lakh_inr__" FROM "table_20403667_2" WHERE "1,03,049.60" = "public_property_damaged__in_lakh_inr__"
| 0.120117 |
CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR)
CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT)
CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT)
CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT)
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 fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR)
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_miles INT, pressurized VARCHAR)
CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT)
CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT)
CREATE TABLE code_description (code VARCHAR, description TEXT)
CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT)
CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR)
CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT)
CREATE TABLE flight_fare (flight_id INT, fare_id INT)
CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR)
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, time_elapsed INT, to_airport VARCHAR)
CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT)
CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT)
CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT)
CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT)
CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR)
CREATE TABLE month (month_number INT, month_name TEXT)
CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR)
CREATE TABLE days (days_code VARCHAR, day_name VARCHAR)
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)
|
i would like to book a flight on US FIRST class from CLEVELAND to MIAMI on 2 22
|
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 AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis AS FARE_BASIS_0, fare_basis AS FARE_BASIS_1, flight, flight_fare WHERE (((DATE_DAY_0.day_number = 22 AND DATE_DAY_0.month_number = 2 AND DATE_DAY_0.year = 1991 AND DATE_DAY_1.day_number = 22 AND DATE_DAY_1.month_number = 2 AND DATE_DAY_1.year = 1991 AND DAYS_0.day_name = DATE_DAY_0.day_name AND DAYS_1.day_name = DATE_DAY_1.day_name AND FARE_BASIS_0.class_type = 'FIRST' AND FARE_BASIS_1.basis_days = DAYS_1.days_code AND fare.fare_basis_code = FARE_BASIS_0.fare_basis_code AND fare.fare_basis_code = FARE_BASIS_1.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.flight_days = DAYS_0.days_code AND flight.flight_id = flight_fare.flight_id) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MIAMI' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CLEVELAND' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.airline_code = 'US'
|
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "date_day" AS "DATE_DAY_0" ON "DATE_DAY_0"."day_number" = 22 AND "DATE_DAY_0"."month_number" = 2 AND "DATE_DAY_0"."year" = 1991 JOIN "date_day" AS "DATE_DAY_1" ON "DATE_DAY_1"."day_number" = 22 AND "DATE_DAY_1"."month_number" = 2 AND "DATE_DAY_1"."year" = 1991 JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'CLEVELAND' JOIN "days" AS "DAYS_0" ON "DATE_DAY_0"."day_name" = "DAYS_0"."day_name" JOIN "days" AS "DAYS_1" ON "DATE_DAY_1"."day_name" = "DAYS_1"."day_name" JOIN "fare_basis" AS "FARE_BASIS_1" ON "DAYS_1"."days_code" = "FARE_BASIS_1"."basis_days" JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "DAYS_0"."days_code" = "flight"."flight_days" AND "flight"."airline_code" = 'US' JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "flight_fare" ON "flight"."flight_id" = "flight_fare"."flight_id" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'MIAMI' JOIN "fare" ON "FARE_BASIS_1"."fare_basis_code" = "fare"."fare_basis_code" AND "fare"."fare_id" = "flight_fare"."fare_id" JOIN "fare_basis" AS "FARE_BASIS_0" ON "FARE_BASIS_0"."class_type" = 'FIRST' AND "FARE_BASIS_0"."fare_basis_code" = "fare"."fare_basis_code"
| 1.393555 |
CREATE TABLE contacts (contact_id DECIMAL, customer_id DECIMAL, gender TEXT, first_name TEXT, last_name TEXT, contact_phone TEXT)
CREATE TABLE customer_orders (order_id DECIMAL, customer_id DECIMAL, order_date TIME, order_status_code TEXT)
CREATE TABLE addresses (address_id DECIMAL, line_1_number_building TEXT, city TEXT, zip_postcode TEXT, state_province_county TEXT, country TEXT)
CREATE TABLE customers (customer_id DECIMAL, payment_method_code TEXT, customer_number TEXT, customer_name TEXT, customer_address TEXT, customer_phone TEXT, customer_email TEXT)
CREATE TABLE customer_address_history (customer_id DECIMAL, address_id DECIMAL, date_from TIME, date_to TIME)
CREATE TABLE products (product_id DECIMAL, product_type_code TEXT, product_name TEXT, product_price DECIMAL)
CREATE TABLE order_items (order_item_id DECIMAL, order_id DECIMAL, product_id DECIMAL, order_quantity TEXT)
|
Show the product type and name for the products with price higher than 1000 or lower than 500.
|
SELECT product_type_code, product_name FROM products WHERE product_price > 1000 OR product_price < 500
|
SELECT "product_type_code", "product_name" FROM "products" WHERE "product_price" < 500 OR "product_price" > 1000
| 0.109375 |
CREATE TABLE table_48958 ("Round" FLOAT, "Pick" FLOAT, "Overall" FLOAT, "Name" TEXT, "Position" TEXT, "College" TEXT)
|
How much Overall has a Pick of 10, and a Round smaller than 8, and a Position of e, and a College of tennessee?
|
SELECT COUNT("Overall") FROM table_48958 WHERE "Pick" = '10' AND "Round" < '8' AND "Position" = 'e' AND "College" = 'tennessee'
|
SELECT COUNT("Overall") FROM "table_48958" WHERE "College" = 'tennessee' AND "Pick" = '10' AND "Position" = 'e' AND "Round" < '8'
| 0.125977 |
CREATE TABLE table_41709 ("Team 1" TEXT, "Agg." TEXT, "Team 2" TEXT, "1st leg" TEXT, "2nd leg" TEXT)
|
Which Team 2 had a Team 1of joe public?
|
SELECT "Team 2" FROM table_41709 WHERE "Team 1" = 'joe public'
|
SELECT "Team 2" FROM "table_41709" WHERE "Team 1" = 'joe public'
| 0.0625 |
CREATE TABLE table_23563375_11 (result VARCHAR, opponent VARCHAR)
|
What was the score against Loic Didavi?
|
SELECT result FROM table_23563375_11 WHERE opponent = "Loic Didavi"
|
SELECT "result" FROM "table_23563375_11" WHERE "Loic Didavi" = "opponent"
| 0.071289 |
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT)
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL)
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME)
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
|
count the number of patients who had taken a hematocrit test in the previous year.
|
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hematocrit') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year'))
|
WITH "_u_0" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'hematocrit' GROUP BY "itemid"), "_u_1" AS (SELECT "labevents"."hadm_id" FROM "labevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "labevents"."itemid" WHERE DATETIME("labevents"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_0"."" IS NULL GROUP BY "hadm_id") SELECT COUNT(DISTINCT "admissions"."subject_id") FROM "admissions" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "admissions"."hadm_id" WHERE NOT "_u_1"."" IS NULL
| 0.548828 |
CREATE TABLE election (Election_ID INT, Counties_Represented TEXT, District INT, Delegate TEXT, Party INT, First_Elected FLOAT, Committee TEXT)
CREATE TABLE party (Party_ID INT, Year FLOAT, Party TEXT, Governor TEXT, Lieutenant_Governor TEXT, Comptroller TEXT, Attorney_General TEXT, US_Senate TEXT)
CREATE TABLE county (County_Id INT, County_name TEXT, Population FLOAT, Zip_code TEXT)
|
Which committees have delegates from the Democratic party, and count them by a pie chart
|
SELECT Committee, COUNT(Committee) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic" GROUP BY Committee
|
SELECT "Committee", COUNT("Committee") FROM "election" AS "T1" JOIN "party" AS "T2" ON "Democratic" = "T2"."Party" AND "T1"."Party" = "T2"."Party_ID" GROUP BY "Committee"
| 0.166016 |
CREATE TABLE table_19945 ("#" FLOAT, "Season" FLOAT, "Bowl game" TEXT, "Result" TEXT, "Opponent" TEXT, "Stadium" TEXT, "Location" TEXT, "Attendance" TEXT)
|
What is the stadium where the attendance was 75,406?
|
SELECT "Stadium" FROM table_19945 WHERE "Attendance" = '75,406'
|
SELECT "Stadium" FROM "table_19945" WHERE "Attendance" = '75,406'
| 0.063477 |
CREATE TABLE table_204_350 (id DECIMAL, "date" TEXT, "opponents" TEXT, "venue" TEXT, "result" TEXT, "scorers" TEXT, "attendance" DECIMAL, "report 1" TEXT, "report 2" TEXT)
|
what was the largest difference in goals scored in any game ?
|
SELECT MAX(ABS("result" - "result")) FROM table_204_350
|
SELECT MAX(ABS("result" - "result")) FROM "table_204_350"
| 0.055664 |
CREATE TABLE table_21598 ("Release" FLOAT, "Title" TEXT, "Start" FLOAT, "Pieces" FLOAT, "Board ( inches ) " TEXT, "Board ( cm ) " TEXT, "Type" TEXT, "New units New units when compared to the original A&A: Classic version of the game." TEXT, "Playable Powers" TEXT)
|
What titles were released in 2006?
|
SELECT "Title" FROM table_21598 WHERE "Release" = '2006'
|
SELECT "Title" FROM "table_21598" WHERE "Release" = '2006'
| 0.056641 |
CREATE TABLE table_name_9 (score VARCHAR, date VARCHAR)
|
What was the score on 20/6/97?
|
SELECT score FROM table_name_9 WHERE date = "20/6/97"
|
SELECT "score" FROM "table_name_9" WHERE "20/6/97" = "date"
| 0.057617 |
CREATE TABLE table_name_35 (preliminary INT, state VARCHAR, interview VARCHAR)
|
What is the best preliminary for a contestant from New Mexico with interview less than 9.533?
|
SELECT MAX(preliminary) FROM table_name_35 WHERE state = "new mexico" AND interview < 9.533
|
SELECT MAX("preliminary") FROM "table_name_35" WHERE "interview" < 9.533 AND "new mexico" = "state"
| 0.09668 |
CREATE TABLE table_name_16 (result VARCHAR, district VARCHAR, party VARCHAR, first_elected VARCHAR)
|
Which republican was first elected in 1886 in the district of ohio 17?
|
SELECT result FROM table_name_16 WHERE party = "republican" AND first_elected = "1886" AND district = "ohio 17"
|
SELECT "result" FROM "table_name_16" WHERE "1886" = "first_elected" AND "district" = "ohio 17" AND "party" = "republican"
| 0.118164 |
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, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
CREATE TABLE procedures (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 prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
|
what is the number of patients with drug code warf2 who were tested for other body fluids in the fluid lab test?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "WARF2" AND lab.fluid = "Other Body Fluid"
|
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Other Body Fluid" = "lab"."fluid" AND "demographic"."hadm_id" = "lab"."hadm_id" JOIN "prescriptions" ON "WARF2" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
| 0.282227 |
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'
|
SELECT "Record" FROM "table_49220" WHERE "Date" = 'march 7' AND "Opponent" = 'detroit pistons'
| 0.091797 |
CREATE TABLE table_name_92 (date INT, score_in_the_final VARCHAR)
|
How many Dates have a Score in the final of 6 4, 6 2?
|
SELECT SUM(date) FROM table_name_92 WHERE score_in_the_final = "6–4, 6–2"
|
SELECT SUM("date") FROM "table_name_92" WHERE "6–4, 6–2" = "score_in_the_final"
| 0.077148 |
CREATE TABLE table_name_15 (tournament VARCHAR, opponents_in_the_final VARCHAR)
|
What is the Tournament with a Opponents in the final with rod laver fred stolle?
|
SELECT tournament FROM table_name_15 WHERE opponents_in_the_final = "rod laver fred stolle"
|
SELECT "tournament" FROM "table_name_15" WHERE "opponents_in_the_final" = "rod laver fred stolle"
| 0.094727 |
CREATE TABLE table_56005 ("Player" TEXT, "Team" TEXT, "Opponent" TEXT, "Year" FLOAT, "Score" TEXT, "Outcome" TEXT)
|
Which score had Essendon as an opponent and Steven Clark as a player?
|
SELECT "Score" FROM table_56005 WHERE "Opponent" = 'essendon' AND "Player" = 'steven clark'
|
SELECT "Score" FROM "table_56005" WHERE "Opponent" = 'essendon' AND "Player" = 'steven clark'
| 0.09082 |
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 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 TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear 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)
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
|
count the number of patients with lab test item id 50801.
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "50801"
|
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "50801" = "lab"."itemid" AND "demographic"."hadm_id" = "lab"."hadm_id"
| 0.149414 |
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME)
CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME)
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT)
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME)
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME)
CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
|
how many times do patient 006-195310 visit the hospital until 2104?
|
SELECT COUNT(DISTINCT patient.patienthealthsystemstayid) FROM patient WHERE patient.uniquepid = '006-195310' AND STRFTIME('%y', patient.hospitaladmittime) <= '2104'
|
SELECT COUNT(DISTINCT "patient"."patienthealthsystemstayid") FROM "patient" WHERE "patient"."uniquepid" = '006-195310' AND STRFTIME('%y', "patient"."hospitaladmittime") <= '2104'
| 0.173828 |
CREATE TABLE table_204_503 (id DECIMAL, "year" DECIMAL, "competition" TEXT, "venue" TEXT, "position" TEXT, "notes" TEXT)
|
how many times did imma clopes compete ?
|
SELECT COUNT(*) FROM table_204_503
|
SELECT COUNT(*) FROM "table_204_503"
| 0.035156 |
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 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, route TEXT, drug_dose 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, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
|
provide the number of patients whose primary disease is bladder cancer/sda and year of birth is less than 1821?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "BLADDER CANCER/SDA" AND demographic.dob_year < "1821"
|
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "1821" > "demographic"."dob_year" AND "BLADDER CANCER/SDA" = "demographic"."diagnosis"
| 0.157227 |
CREATE TABLE PostTypes (Id DECIMAL, Name TEXT)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT)
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT)
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT)
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT)
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL)
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other)
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT)
|
select * from votes where id = 418;.
|
SELECT * FROM Votes WHERE UserId = 418
|
SELECT * FROM "Votes" WHERE "UserId" = 418
| 0.041016 |
CREATE TABLE table_25008327_8 (polish VARCHAR, belarusian VARCHAR)
|
What is every value for Polish when Balarusian is ?
|
SELECT polish FROM table_25008327_8 WHERE belarusian = "ноч"
|
SELECT "polish" FROM "table_25008327_8" WHERE "belarusian" = "ноч"
| 0.064453 |
CREATE TABLE table_name_20 (area__km_2__ VARCHAR, population INT)
|
What's the sum of the Area (KM 2) that's got a Population that's smaller than 90?
|
SELECT COUNT(area__km_2__) FROM table_name_20 WHERE population < 90
|
SELECT COUNT("area__km_2__") FROM "table_name_20" WHERE "population" < 90
| 0.071289 |
CREATE TABLE table_203_643 (id DECIMAL, "year" DECIMAL, "award" TEXT, "group" TEXT, "result" TEXT, "notes" TEXT)
|
how many times has he been nominated in total ?
|
SELECT COUNT(*) FROM table_203_643 WHERE "result" = 'nominated'
|
SELECT COUNT(*) FROM "table_203_643" WHERE "result" = 'nominated'
| 0.063477 |
CREATE TABLE injury_accident (game_id INT, id INT, Player TEXT, Injury TEXT, Number_of_matches TEXT, Source TEXT)
CREATE TABLE stadium (id INT, name TEXT, Home_Games INT, Average_Attendance FLOAT, Total_Attendance FLOAT, Capacity_Percentage FLOAT)
CREATE TABLE game (stadium_id INT, id INT, Season INT, Date TEXT, Home_team TEXT, Away_team TEXT, Score TEXT, Competition TEXT)
|
I want to see trend the number of season over season by Away_team, list by the x axis in ascending.
|
SELECT Season, COUNT(Season) FROM game GROUP BY Away_team ORDER BY Season
|
SELECT "Season", COUNT("Season") FROM "game" GROUP BY "Away_team" ORDER BY "Season" NULLS FIRST
| 0.092773 |
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL)
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME)
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT)
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
|
have any sc 28 pg medications ever been given to patient 28443 during the current hospital encounter?
|
SELECT COUNT(*) > 0 FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28443 AND admissions.dischtime IS NULL)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sc 28 pg' AND d_items.linksto = 'inputevents_cv')
|
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."dischtime" IS NULL AND "admissions"."subject_id" = 28443 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'sc 28 pg' AND "d_items"."linksto" = 'inputevents_cv' GROUP BY "itemid") SELECT COUNT(*) > 0 FROM "inputevents_cv" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "inputevents_cv"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "inputevents_cv"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL
| 0.704102 |
CREATE TABLE table_47330 ("Round" FLOAT, "Pick" FLOAT, "Player" TEXT, "Position" TEXT, "School" TEXT)
|
How many picks had less than 11 rounds and a player of Charley Casey?
|
SELECT SUM("Pick") FROM table_47330 WHERE "Round" < '11' AND "Player" = 'charley casey'
|
SELECT SUM("Pick") FROM "table_47330" WHERE "Player" = 'charley casey' AND "Round" < '11'
| 0.086914 |
CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME)
CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME)
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME)
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME)
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT)
CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
|
what is the name of the drug that was prescribed to patient 002-38474 in the same hospital visit after diagnosis with ventricular tachycardia - with hemodynamic compromise until 07/2105?
|
SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-38474') AND diagnosis.diagnosisname = 'ventricular tachycardia - with hemodynamic compromise' AND STRFTIME('%y-%m', diagnosis.diagnosistime) <= '2105-07') AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-38474') AND STRFTIME('%y-%m', medication.drugstarttime) <= '2105-07') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid
|
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '002-38474' GROUP BY "patienthealthsystemstayid"), "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime", "patient"."patienthealthsystemstayid" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" LEFT JOIN "_u_0" AS "_u_1" ON "_u_1"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_1"."" IS NULL AND STRFTIME('%y-%m', "medication"."drugstarttime") <= '2105-07') SELECT "t2"."drugname" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" JOIN "t2" AS "t2" ON "diagnosis"."diagnosistime" < "t2"."drugstarttime" AND "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "patient"."uniquepid" = "t2"."uniquepid" WHERE "diagnosis"."diagnosisname" = 'ventricular tachycardia - with hemodynamic compromise' AND NOT "_u_0"."" IS NULL AND STRFTIME('%y-%m', "diagnosis"."diagnosistime") <= '2105-07'
| 1.114258 |
CREATE TABLE table_name_10 (frequency__inbound_outbound_ VARCHAR, train_name VARCHAR)
|
What is the frequency of the train named Garib nwaz exp?
|
SELECT frequency__inbound_outbound_ FROM table_name_10 WHERE train_name = "garib nwaz exp"
|
SELECT "frequency__inbound_outbound_" FROM "table_name_10" WHERE "garib nwaz exp" = "train_name"
| 0.09375 |
CREATE TABLE table_27833186_1 (rider_names VARCHAR, horse_name VARCHAR)
|
How many different riders are there that won riding Omr Tsunami?
|
SELECT COUNT(rider_names) FROM table_27833186_1 WHERE horse_name = "OMR Tsunami"
|
SELECT COUNT("rider_names") FROM "table_27833186_1" WHERE "OMR Tsunami" = "horse_name"
| 0.083984 |
CREATE TABLE table_32376 ("Season" TEXT, "Team" TEXT, "League Apps" FLOAT, "League Goals" FLOAT, "Cup Apps" FLOAT, "Cup Goals" FLOAT)
|
How many league apps in the season with more than 2 cup goals and more than 6 cup apps?
|
SELECT SUM("League Apps") FROM table_32376 WHERE "Cup Goals" > '2' AND "Cup Apps" > '6'
|
SELECT SUM("League Apps") FROM "table_32376" WHERE "Cup Apps" > '6' AND "Cup Goals" > '2'
| 0.086914 |
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL)
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT)
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME)
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
|
what's patient 51675's maximum value of monocytes until 40 months ago?
|
SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51675) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'monocytes') AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-40 month')
|
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 51675 GROUP BY "hadm_id"), "_u_1" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'monocytes' GROUP BY "itemid") SELECT MAX("labevents"."valuenum") FROM "labevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "labevents"."hadm_id" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "labevents"."itemid" WHERE DATETIME("labevents"."charttime") <= DATETIME(CURRENT_TIME(), '-40 month') AND NOT "_u_0"."" IS NULL AND NOT "_u_1"."" IS NULL
| 0.541016 |
CREATE TABLE table_27700 ("Round" FLOAT, "Circuit" TEXT, "Location" TEXT, "Date" TEXT, "Pole position" TEXT, "Fastest lap" TEXT, "Winning driver" TEXT, "Winning team" TEXT, "Supporting" TEXT)
|
How many rounds did Alex Ardoin achieved a fastest lap?
|
SELECT COUNT("Round") FROM table_27700 WHERE "Fastest lap" = 'Alex Ardoin'
|
SELECT COUNT("Round") FROM "table_27700" WHERE "Fastest lap" = 'Alex Ardoin'
| 0.074219 |
CREATE TABLE table_63794 ("Year" FLOAT, "Award" TEXT, "Work" TEXT, "Category" TEXT, "Result" TEXT)
|
What is the result of the choice tv actor: drama category?
|
SELECT "Result" FROM table_63794 WHERE "Category" = 'choice tv actor: drama'
|
SELECT "Result" FROM "table_63794" WHERE "Category" = 'choice tv actor: drama'
| 0.076172 |
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME)
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT)
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME)
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME)
CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME)
|
tell me the name of the output patient 027-210868 had last on the first intensive care unit visit?
|
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-210868') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime LIMIT 1) AND intakeoutput.cellpath LIKE '%output%' ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1
|
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '027-210868' GROUP BY "patienthealthsystemstayid") SELECT "intakeoutput"."celllabel" FROM "intakeoutput" WHERE "intakeoutput"."cellpath" LIKE '%output%' AND "intakeoutput"."patientunitstayid" IN (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND NOT "patient"."unitdischargetime" IS NULL ORDER BY "patient"."unitadmittime" NULLS FIRST LIMIT 1) ORDER BY "intakeoutput"."intakeoutputtime" DESC NULLS LAST LIMIT 1
| 0.615234 |
CREATE TABLE table_name_83 (winner VARCHAR, stages VARCHAR, year VARCHAR)
|
Who won the 17 staged event in 1987?
|
SELECT winner FROM table_name_83 WHERE stages = "17" AND year = "1987"
|
SELECT "winner" FROM "table_name_83" WHERE "17" = "stages" AND "1987" = "year"
| 0.076172 |
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 TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
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 lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
|
how many of the patients on government insurance had icd9 code 2219?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.icd9_code = "2219"
|
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "2219" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "Government" = "demographic"."insurance"
| 0.217773 |
CREATE TABLE table_11318462_29 (location VARCHAR, school VARCHAR)
|
What is the location of the school named Brisbane Girls' Grammar School?
|
SELECT location FROM table_11318462_29 WHERE school = "Brisbane Girls' Grammar school"
|
SELECT "location" FROM "table_11318462_29" WHERE "Brisbane Girls' Grammar school" = "school"
| 0.089844 |
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, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear 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 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)
|
tell me the number of patients on chlorothiazide prescription who have been hospitalized for more than 11 days.
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "11" AND prescriptions.drug = "Chlorothiazide"
|
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "Chlorothiazide" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "11" < "demographic"."days_stay"
| 0.223633 |
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL)
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT)
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME)
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
|
what are the three most commonly ordered procedures for patients who have been diagnosed with neuralgia/neuritis nos previously during the same month?
|
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 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 = 'neuralgia/neuritis nos')) AS t1 JOIN (SELECT admissions.subject_id, procedures_icd.icd9_code, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND DATETIME(t1.charttime, 'start of month') = DATETIME(t2.charttime, 'start of month') GROUP BY t2.icd9_code) AS t3 WHERE t3.c1 <= 3)
|
WITH "t2" AS (SELECT "admissions"."subject_id", "procedures_icd"."icd9_code", "procedures_icd"."charttime" FROM "procedures_icd" JOIN "admissions" ON "admissions"."hadm_id" = "procedures_icd"."hadm_id"), "t3" AS (SELECT "t2"."icd9_code", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnoses_icd" JOIN "d_icd_diagnoses" ON "d_icd_diagnoses"."icd9_code" = "diagnoses_icd"."icd9_code" AND "d_icd_diagnoses"."short_title" = 'neuralgia/neuritis nos' JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" JOIN "t2" AS "t2" ON "admissions"."subject_id" = "t2"."subject_id" AND "diagnoses_icd"."charttime" < "t2"."charttime" AND DATETIME("diagnoses_icd"."charttime", 'start of month') = DATETIME("t2"."charttime", 'start of month') GROUP BY "t2"."icd9_code"), "_u_1" AS (SELECT "t3"."icd9_code" FROM "t3" AS "t3" WHERE "t3"."c1" <= 3 GROUP BY "icd9_code") SELECT "d_icd_procedures"."short_title" FROM "d_icd_procedures" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "d_icd_procedures"."icd9_code" WHERE NOT "_u_1"."" IS NULL
| 1.030273 |
CREATE TABLE table_name_36 (result VARCHAR, opponent VARCHAR)
|
What was the result against opponent Amanda Lucas?
|
SELECT result FROM table_name_36 WHERE opponent = "amanda lucas"
|
SELECT "result" FROM "table_name_36" WHERE "amanda lucas" = "opponent"
| 0.068359 |
CREATE TABLE table_75487 ("Rank" FLOAT, "Nation" TEXT, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
|
Which Total is the lowest one that has a Rank smaller than 1?
|
SELECT MIN("Total") FROM table_75487 WHERE "Rank" < '1'
|
SELECT MIN("Total") FROM "table_75487" WHERE "Rank" < '1'
| 0.055664 |
CREATE TABLE table_name_15 (score VARCHAR, to_par VARCHAR, player VARCHAR)
|
What is the Score that has a To standard of 3, and a Player of Jim Furyk?
|
SELECT score FROM table_name_15 WHERE to_par = "–3" AND player = "jim furyk"
|
SELECT "score" FROM "table_name_15" WHERE "jim furyk" = "player" AND "to_par" = "–3"
| 0.082031 |
CREATE TABLE table_name_94 (f_laps VARCHAR, wins VARCHAR, points VARCHAR, poles VARCHAR)
|
What F/Laps listing has entries of n/a Points, 1 Poles, and 0 Wins?
|
SELECT f_laps FROM table_name_94 WHERE points = "n/a" AND poles = "1" AND wins = "0"
|
SELECT "f_laps" FROM "table_name_94" WHERE "0" = "wins" AND "1" = "poles" AND "n/a" = "points"
| 0.091797 |
CREATE TABLE table_name_84 (glider VARCHAR, pilot VARCHAR)
|
What glider did thomas gostner pilot?
|
SELECT glider FROM table_name_84 WHERE pilot = "thomas gostner"
|
SELECT "glider" FROM "table_name_84" WHERE "pilot" = "thomas gostner"
| 0.067383 |
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT)
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL)
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME)
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
|
how many hours has it been since patient 8116's first test for phosphate on this hospital encounter?
|
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'phosphate') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 8116 AND admissions.dischtime IS NULL) ORDER BY labevents.charttime LIMIT 1
|
WITH "_u_0" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'phosphate' GROUP BY "itemid"), "_u_1" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."dischtime" IS NULL AND "admissions"."subject_id" = 8116 GROUP BY "hadm_id") SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "labevents"."charttime")) FROM "labevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "labevents"."itemid" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "labevents"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND NOT "_u_1"."" IS NULL ORDER BY "labevents"."charttime" NULLS FIRST LIMIT 1
| 0.601563 |
CREATE TABLE table_name_4 (to_par VARCHAR, year_s__won VARCHAR)
|
What was the winning to par score of the 1993 PGA Championship?
|
SELECT to_par FROM table_name_4 WHERE year_s__won = "1993"
|
SELECT "to_par" FROM "table_name_4" WHERE "1993" = "year_s__won"
| 0.0625 |
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other)
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE PostTypes (Id DECIMAL, Name TEXT)
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT)
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL)
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT)
CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT)
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT)
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT)
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT)
|
Top 'R' and 'Machine-Learning' Vote Getters with A Website.
|
SELECT Users.DisplayName, Users.Id, sub.totalVotes, Users.WebsiteUrl FROM (SELECT Users.Id, Tags.TagName, COUNT(*) AS totalVotes 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 Votes.VoteTypeId = 2 INNER JOIN Users ON Posts.OwnerUserId = Users.Id WHERE Tags.TagName IN ('r', 'machine-learning') AND Posts.PostTypeId IN (1, 2) GROUP BY Users.Id, Tags.TagName) AS sub INNER JOIN Users ON Users.Id = sub.Id WHERE sub.TagName = 'machine-learning' AND Users.WebsiteUrl != '' ORDER BY sub.totalVotes DESC LIMIT 25
|
WITH "sub" AS (SELECT "Users"."Id", "Tags"."TagName", COUNT(*) AS "totalVotes" FROM "Tags" JOIN "PostTags" ON "PostTags"."TagId" = "Tags"."Id" JOIN "Posts" ON "PostTags"."PostId" = "Posts"."ParentId" AND "Posts"."PostTypeId" IN (1, 2) JOIN "Users" ON "Posts"."OwnerUserId" = "Users"."Id" JOIN "Votes" ON "Posts"."Id" = "Votes"."PostId" AND "Votes"."VoteTypeId" = 2 WHERE "Tags"."TagName" IN ('r', 'machine-learning') GROUP BY "Users"."Id", "Tags"."TagName") SELECT "Users"."DisplayName", "Users"."Id", "sub"."totalVotes", "Users"."WebsiteUrl" FROM "sub" AS "sub" JOIN "Users" ON "Users"."Id" = "sub"."Id" AND "Users"."WebsiteUrl" <> '' WHERE "sub"."TagName" = 'machine-learning' ORDER BY "sub"."totalVotes" DESC NULLS LAST LIMIT 25
| 0.713867 |
CREATE TABLE table_13502 ("Rank" TEXT, "Nation" TEXT, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
|
what is the most silver when bronze is more than 0, total is more than 1, gold is more than 0 and the nation is china (chn)?
|
SELECT MAX("Silver") FROM table_13502 WHERE "Bronze" > '0' AND "Total" > '1' AND "Gold" > '0' AND "Nation" = 'china (chn)'
|
SELECT MAX("Silver") FROM "table_13502" WHERE "Bronze" > '0' AND "Gold" > '0' AND "Nation" = 'china (chn)' AND "Total" > '1'
| 0.121094 |
CREATE TABLE STUDENT (STU_NUM INT, STU_LNAME VARCHAR, STU_FNAME VARCHAR, STU_INIT VARCHAR, STU_DOB DATETIME, STU_HRS INT, STU_CLASS VARCHAR, STU_GPA FLOAT, STU_TRANSFER DECIMAL, DEPT_CODE VARCHAR, STU_PHONE VARCHAR, PROF_NUM INT)
CREATE TABLE ENROLL (CLASS_CODE VARCHAR, STU_NUM INT, ENROLL_GRADE VARCHAR)
CREATE TABLE EMPLOYEE (EMP_NUM INT, EMP_LNAME VARCHAR, EMP_FNAME VARCHAR, EMP_INITIAL VARCHAR, EMP_JOBCODE VARCHAR, EMP_HIREDATE DATETIME, EMP_DOB DATETIME)
CREATE TABLE CLASS (CLASS_CODE VARCHAR, CRS_CODE VARCHAR, CLASS_SECTION VARCHAR, CLASS_TIME VARCHAR, CLASS_ROOM VARCHAR, PROF_NUM INT)
CREATE TABLE COURSE (CRS_CODE VARCHAR, DEPT_CODE VARCHAR, CRS_DESCRIPTION VARCHAR, CRS_CREDIT FLOAT)
CREATE TABLE DEPARTMENT (DEPT_CODE VARCHAR, DEPT_NAME VARCHAR, SCHOOL_CODE VARCHAR, EMP_NUM INT, DEPT_ADDRESS VARCHAR, DEPT_EXTENSION VARCHAR)
CREATE TABLE PROFESSOR (EMP_NUM INT, DEPT_CODE VARCHAR, PROF_OFFICE VARCHAR, PROF_EXTENSION VARCHAR, PROF_HIGH_DEGREE VARCHAR)
|
Return a bar chart on how many classes are held in each department?, list bars in descending order.
|
SELECT DEPT_CODE, COUNT(*) FROM CLASS AS T1 JOIN COURSE AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY DEPT_CODE ORDER BY DEPT_CODE DESC
|
SELECT "DEPT_CODE", COUNT(*) FROM "CLASS" AS "T1" JOIN "COURSE" AS "T2" ON "T1"."CRS_CODE" = "T2"."CRS_CODE" GROUP BY "DEPT_CODE" ORDER BY "DEPT_CODE" DESC NULLS LAST
| 0.162109 |
CREATE TABLE Rooms (RoomId TEXT, roomName TEXT, beds INT, bedType TEXT, maxOccupancy INT, basePrice INT, decor TEXT)
CREATE TABLE Reservations (Code INT, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate FLOAT, LastName TEXT, FirstName TEXT, Adults INT, Kids INT)
|
Bar chart, X is bed type and the Y-axis is their appearance frequency, I want to list by the y-axis in desc.
|
SELECT bedType, COUNT(bedType) FROM Rooms WHERE decor = "traditional" GROUP BY bedType ORDER BY COUNT(bedType) DESC
|
SELECT "bedType", COUNT("bedType") FROM "Rooms" WHERE "decor" = "traditional" GROUP BY "bedType" ORDER BY COUNT("bedType") DESC NULLS LAST
| 0.134766 |
CREATE TABLE table_name_63 (venue VARCHAR, year VARCHAR, result VARCHAR)
|
What is Venue, when Year is 2005, and when Result is 8th?
|
SELECT venue FROM table_name_63 WHERE year = 2005 AND result = "8th"
|
SELECT "venue" FROM "table_name_63" WHERE "8th" = "result" AND "year" = 2005
| 0.074219 |
CREATE TABLE table_9531 ("Date" TEXT, "Tournament" TEXT, "Winning score" TEXT, "Margin of victory" TEXT, "Runner ( s ) -up" TEXT)
|
Who was the runner(s)-up when the winning score was 13 (75-68-68=211)?
|
SELECT "Runner(s)-up" FROM table_9531 WHERE "Winning score" = '–13 (75-68-68=211)'
|
SELECT "Runner(s)-up" FROM "table_9531" WHERE "Winning score" = '–13 (75-68-68=211)'
| 0.082031 |
CREATE TABLE table_35311 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
|
What was the team that has a High rebounds of popeye jones (14), and when the Record was 16-28?
|
SELECT "Team" FROM table_35311 WHERE "High rebounds" = 'popeye jones (14)' AND "Record" = '16-28'
|
SELECT "Team" FROM "table_35311" WHERE "High rebounds" = 'popeye jones (14)' AND "Record" = '16-28'
| 0.09668 |
CREATE TABLE table_79946 ("Date" TEXT, "City" TEXT, "Event" TEXT, "Winner" TEXT, "Prize" TEXT)
|
When was the event in Dublin?
|
SELECT "Date" FROM table_79946 WHERE "City" = 'dublin'
|
SELECT "Date" FROM "table_79946" WHERE "City" = 'dublin'
| 0.054688 |
CREATE TABLE customers (first_name VARCHAR, last_name VARCHAR, id VARCHAR)
CREATE TABLE invoices (total INT, customer_id VARCHAR)
|
List the top 10 customers by total gross sales. List customers' first and last name and total gross sales.
|
SELECT T1.first_name, T1.last_name, SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10
|
SELECT "T1"."first_name", "T1"."last_name", SUM("T2"."total") FROM "customers" AS "T1" JOIN "invoices" AS "T2" ON "T1"."id" = "T2"."customer_id" GROUP BY "T1"."id" ORDER BY SUM("T2"."total") DESC NULLS LAST LIMIT 10
| 0.209961 |
CREATE TABLE table_name_51 (examples VARCHAR, australian VARCHAR)
|
What are the examples for the Australian ?
|
SELECT examples FROM table_name_51 WHERE australian = "æ"
|
SELECT "examples" FROM "table_name_51" WHERE "australian" = "æ"
| 0.061523 |
CREATE TABLE table_61226 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" TEXT)
|
Which Week has a Result of w 23 22?
|
SELECT "Week" FROM table_61226 WHERE "Result" = 'w 23–22'
|
SELECT "Week" FROM "table_61226" WHERE "Result" = 'w 23–22'
| 0.057617 |
CREATE TABLE table_36262 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Venue" TEXT, "Attendance" FLOAT)
|
Opponent of chicago bears involved what date?
|
SELECT "Date" FROM table_36262 WHERE "Opponent" = 'chicago bears'
|
SELECT "Date" FROM "table_36262" WHERE "Opponent" = 'chicago bears'
| 0.06543 |
CREATE TABLE table_27712180_7 (high_points VARCHAR, score VARCHAR)
|
Name the high points for w 90 77 (ot)
|
SELECT high_points FROM table_27712180_7 WHERE score = "W 90–77 (OT)"
|
SELECT "high_points" FROM "table_27712180_7" WHERE "W 90–77 (OT)" = "score"
| 0.073242 |
CREATE TABLE table_20311 ("Week #" TEXT, "Theme" TEXT, "Song choice" TEXT, "Original artist" TEXT, "Order #" TEXT, "Result" TEXT)
|
Who was the original artist when the order number is 9?
|
SELECT "Original artist" FROM table_20311 WHERE "Order #" = '9'
|
SELECT "Original artist" FROM "table_20311" WHERE "Order #" = '9'
| 0.063477 |
CREATE TABLE table_73552 ("Game" FLOAT, "Date" TEXT, "Opponent" TEXT, "Score" TEXT, "Location" TEXT, "Attendance" FLOAT, "Record" TEXT, "Points" FLOAT)
|
What scores happened to be on February 9?
|
SELECT "Score" FROM table_73552 WHERE "Date" = 'February 9'
|
SELECT "Score" FROM "table_73552" WHERE "Date" = 'February 9'
| 0.05957 |
CREATE TABLE table_52033 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Date" TEXT)
|
What is the Home team score at junction oval?
|
SELECT "Home team" FROM table_52033 WHERE "Venue" = 'junction oval'
|
SELECT "Home team" FROM "table_52033" WHERE "Venue" = 'junction oval'
| 0.067383 |
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT)
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME)
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL)
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
|
was patient 4401 excreting any drain out #2 sump in 12/2105?
|
SELECT COUNT(*) > 0 FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 4401)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'drain out #2 sump' AND d_items.linksto = 'outputevents') AND STRFTIME('%y-%m', outputevents.charttime) = '2105-12'
|
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 4401 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'drain out #2 sump' AND "d_items"."linksto" = 'outputevents' GROUP BY "itemid") SELECT COUNT(*) > 0 FROM "outputevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "outputevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "outputevents"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%y-%m', "outputevents"."charttime") = '2105-12'
| 0.728516 |
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 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)
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 TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
|
count the number of patients with drug code keto15i who were admitted in hospital via clinic referral/premature.
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND prescriptions.formulary_drug_cd = "KETO15I"
|
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "KETO15I" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "CLINIC REFERRAL/PREMATURE" = "demographic"."admission_location"
| 0.260742 |
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL)
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME)
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT)
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT)
|
count the number of patients who were diagnosed with asphyxiation/strangulat and who didn't come back to the hospital in the same month in the last year.
|
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 = 'asphyxiation/strangulat') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1) - (SELECT COUNT(DISTINCT t2.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 = 'asphyxiation/strangulat') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 JOIN admissions ON t2.subject_id = admissions.subject_id WHERE t2.charttime < admissions.admittime AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND DATETIME(t2.charttime, 'start of month') = DATETIME(admissions.admittime, 'start of month'))
|
WITH "_u_0" AS (SELECT "d_icd_diagnoses"."icd9_code" FROM "d_icd_diagnoses" WHERE "d_icd_diagnoses"."short_title" = 'asphyxiation/strangulat') SELECT (SELECT COUNT(DISTINCT "admissions"."subject_id") FROM "diagnoses_icd" JOIN "_u_0" AS "_u_0" ON "_u_0"."icd9_code" = "diagnoses_icd"."icd9_code" JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" WHERE DATETIME("diagnoses_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) - (SELECT COUNT(DISTINCT "admissions_2"."subject_id") FROM "diagnoses_icd" JOIN "_u_0" AS "_u_2" ON "_u_2"."icd9_code" = "diagnoses_icd"."icd9_code" JOIN "admissions" AS "admissions_2" ON "admissions_2"."hadm_id" = "diagnoses_icd"."hadm_id" JOIN "admissions" ON "admissions"."admittime" > "diagnoses_icd"."charttime" AND "admissions"."subject_id" = "admissions_2"."subject_id" AND DATETIME("admissions"."admittime", 'start of month') = DATETIME("diagnoses_icd"."charttime", 'start of month') AND DATETIME("admissions"."admittime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') WHERE DATETIME("diagnoses_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year'))
| 1.174805 |
CREATE TABLE table_66571 ("State and District of Columbia" TEXT, "Obese adults" TEXT, "Overweight ( incl. obese ) adults" TEXT, "Obese children and adolescents" TEXT, "Obesity rank" FLOAT)
|
What's the count for obese children and adolescents ranked 48?
|
SELECT "Obese children and adolescents" FROM table_66571 WHERE "Obesity rank" = '48'
|
SELECT "Obese children and adolescents" FROM "table_66571" WHERE "Obesity rank" = '48'
| 0.083984 |
CREATE TABLE table_name_54 (gold INT, nation VARCHAR, bronze VARCHAR)
|
Name the fewest gold for tanzania with bronze less than 0
|
SELECT MIN(gold) FROM table_name_54 WHERE nation = "tanzania" AND bronze < 0
|
SELECT MIN("gold") FROM "table_name_54" WHERE "bronze" < 0 AND "nation" = "tanzania"
| 0.082031 |
CREATE TABLE table_name_88 (team_2 VARCHAR, team_1 VARCHAR)
|
Who was Team 2 when Team 1 was Am rica?
|
SELECT team_2 FROM table_name_88 WHERE team_1 = "américa"
|
SELECT "team_2" FROM "table_name_88" WHERE "américa" = "team_1"
| 0.061523 |
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 (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 TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear 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)
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
|
how many patients' year of birth is before 2121 with joint fluid as the lab test fluid?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2121" AND lab.fluid = "Joint Fluid"
|
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Joint Fluid" = "lab"."fluid" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "2121" > "demographic"."dob_year"
| 0.193359 |
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PostTypes (Id DECIMAL, Name TEXT)
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT)
CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT)
CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other)
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT)
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT)
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT)
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL)
|
Top 500 users from Pakistan.
|
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%pakistan%' OR UPPER(Location) LIKE '%PAK' ORDER BY Reputation DESC LIMIT 500
|
SELECT ROW_NUMBER() OVER (ORDER BY "Reputation" DESC NULLS LAST) AS "#", "Id" AS "user_link", "Reputation" FROM "Users" WHERE LOWER("Location") LIKE '%pakistan%' OR UPPER("Location") LIKE '%PAK' ORDER BY "Reputation" DESC NULLS LAST LIMIT 500
| 0.236328 |
CREATE TABLE Has_Allergy (StuID INT, Allergy VARCHAR)
CREATE TABLE Allergy_Type (Allergy VARCHAR, AllergyType VARCHAR)
CREATE TABLE Student (StuID INT, LName VARCHAR, Fname VARCHAR, Age INT, Sex VARCHAR, Major INT, Advisor INT, city_code VARCHAR)
|
Show the average age for male and female students with a pie chart.
|
SELECT Sex, AVG(Age) FROM Student GROUP BY Sex
|
SELECT "Sex", AVG("Age") FROM "Student" GROUP BY "Sex"
| 0.052734 |
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT)
CREATE TABLE PostTypes (Id DECIMAL, Name TEXT)
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT)
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT)
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT)
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL)
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other)
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT)
CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
|
Find time difference between 1st and second post on the site.
|
SELECT ph.UserId, ph.PostId, pht.Id, pht.Name, ph.CreationDate, ph.Text FROM PostHistory AS ph INNER JOIN PostHistoryTypes AS pht ON pht.Id = ph.PostHistoryTypeId WHERE ph.UserId > 0 AND NOT ph.UserId IS NULL ORDER BY ph.UserId LIMIT 100
|
SELECT "ph"."UserId", "ph"."PostId", "pht"."Id", "pht"."Name", "ph"."CreationDate", "ph"."Text" FROM "PostHistory" AS "ph" JOIN "PostHistoryTypes" AS "pht" ON "ph"."PostHistoryTypeId" = "pht"."Id" WHERE "ph"."UserId" > 0 AND NOT "ph"."UserId" IS NULL ORDER BY "ph"."UserId" NULLS FIRST LIMIT 100
| 0.288086 |
CREATE TABLE table_name_7 (game VARCHAR, attendance VARCHAR)
|
What is the total number of Game, when Attendance is '18,568'?
|
SELECT COUNT(game) FROM table_name_7 WHERE attendance = 18 OFFSET 568
|
SELECT COUNT("game") FROM "table_name_7" WHERE "attendance" = 18 OFFSET 568
| 0.073242 |
CREATE TABLE table_name_78 (fatalities VARCHAR, time VARCHAR)
|
What number of Fatalties is associated with the Time of 12:38:46?
|
SELECT fatalities FROM table_name_78 WHERE time = "12:38:46"
|
SELECT "fatalities" FROM "table_name_78" WHERE "12:38:46" = "time"
| 0.064453 |
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, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear 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 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)
|
what is lab test name of subject name tracy farmer?
|
SELECT lab.label FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Tracy Farmer"
|
SELECT "lab"."label" FROM "demographic" JOIN "lab" ON "demographic"."hadm_id" = "lab"."hadm_id" WHERE "Tracy Farmer" = "demographic"."name"
| 0.135742 |
CREATE TABLE table_23755 ("Condition" TEXT, "Prothrombin time" TEXT, "Partial thromboplastin time" TEXT, "Bleeding time" TEXT, "Platelet count" TEXT)
|
In what conditions are both the platelet count and prothrombin time unaffected?
|
SELECT "Condition" FROM table_23755 WHERE "Platelet count" = 'Unaffected' AND "Prothrombin time" = 'Unaffected'
|
SELECT "Condition" FROM "table_23755" WHERE "Platelet count" = 'Unaffected' AND "Prothrombin time" = 'Unaffected'
| 0.110352 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.