table
stringlengths
33
7.14k
question
stringlengths
4
1.06k
output
stringlengths
2
4.44k
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
Top questions by Bayesian rating.
SELECT Id AS "post_link", upvotes, downvotes, Score, (upvotes + (AVG(upvotes) OVER ())) / (upvotes + downvotes + (AVG(upvotes + downvotes) OVER ())) AS br FROM (SELECT p.Id, COUNT(CASE v.VoteTypeId WHEN 2 THEN 1 ELSE NULL END) AS upvotes, COUNT(CASE v.VoteTypeId WHEN 3 THEN 1 ELSE NULL END) AS downvotes, MAX(p.Score) AS Score FROM Posts AS p INNER JOIN Votes AS v ON p.Id = v.PostId WHERE p.PostTypeId = 1 GROUP BY p.Id) AS innerQuery ORDER BY br DESC LIMIT 50
CREATE TABLE table_30888 ( "Code" text, "Subdivision name ( be ) (BGN/PCGN)" text, "Subdivision name ( be ) (GOST)" text, "Subdivision name ( ru ) (BGN/PCGN)" text, "Subdivision name ( ru ) (GOST)" text, "Subdivision category" text )
Which codes have subdivision names (BE) (BGN) of Homyel'skaya Voblasts'?
SELECT "Code" FROM table_30888 WHERE "Subdivision name ( be ) (BGN/PCGN)" = 'Homyel''skaya voblasts'
CREATE TABLE Skills_Required_To_Fix ( part_fault_id INTEGER, skill_id INTEGER ) CREATE TABLE Skills ( skill_id INTEGER, skill_code VARCHAR(20), skill_description VARCHAR(255) ) CREATE TABLE Part_Faults ( part_fault_id INTEGER, part_id INTEGER, fault_short_name VARCHAR(20), fault_description VARCHAR(255), other_fault_details VARCHAR(255) ) CREATE TABLE Engineer_Skills ( engineer_id INTEGER, skill_id INTEGER ) CREATE TABLE Fault_Log_Parts ( fault_log_entry_id INTEGER, part_fault_id INTEGER, fault_status VARCHAR(10) ) CREATE TABLE Assets ( asset_id INTEGER, maintenance_contract_id INTEGER, supplier_company_id INTEGER, asset_details VARCHAR(255), asset_make VARCHAR(20), asset_model VARCHAR(20), asset_acquired_date DATETIME, asset_disposed_date DATETIME, other_asset_details VARCHAR(255) ) CREATE TABLE Maintenance_Contracts ( maintenance_contract_id INTEGER, maintenance_contract_company_id INTEGER, contract_start_date DATETIME, contract_end_date DATETIME, other_contract_details VARCHAR(255) ) CREATE TABLE Maintenance_Engineers ( engineer_id INTEGER, company_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), other_details VARCHAR(255) ) CREATE TABLE Fault_Log ( fault_log_entry_id INTEGER, asset_id INTEGER, recorded_by_staff_id INTEGER, fault_log_entry_datetime DATETIME, fault_description VARCHAR(255), other_fault_details VARCHAR(255) ) CREATE TABLE Parts ( part_id INTEGER, part_name VARCHAR(255), chargeable_yn VARCHAR(1), chargeable_amount VARCHAR(20), other_part_details VARCHAR(255) ) CREATE TABLE Engineer_Visits ( engineer_visit_id INTEGER, contact_staff_id INTEGER, engineer_id INTEGER, fault_log_entry_id INTEGER, fault_status VARCHAR(10), visit_start_datetime DATETIME, visit_end_datetime DATETIME, other_visit_details VARCHAR(255) ) CREATE TABLE Third_Party_Companies ( company_id INTEGER, company_type VARCHAR(5), company_name VARCHAR(255), company_address VARCHAR(255), other_company_details VARCHAR(255) ) CREATE TABLE Staff ( staff_id INTEGER, staff_name VARCHAR(255), gender VARCHAR(1), other_staff_details VARCHAR(255) ) CREATE TABLE Asset_Parts ( asset_id INTEGER, part_id INTEGER )
How many staffs have contacted with each engineer? Give me a bar chart grouping by each engineer's last name, order the number of last name in descending order.
SELECT last_name, COUNT(last_name) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id = T3.engineer_id GROUP BY last_name ORDER BY COUNT(last_name) DESC
CREATE TABLE table_name_23 ( tv_time VARCHAR, date VARCHAR )
Which TV Time has a Date of january 2, 2005?
SELECT tv_time FROM table_name_23 WHERE date = "january 2, 2005"
CREATE TABLE table_30574 ( "School" text, "Gender" text, "Age Range" text, "Religious Affiliation" text, "Location" text, "School website" text )
What is the gender of the school which has the website http://www.nicholasbreakspearschool.co.uk/?
SELECT "Gender" FROM table_30574 WHERE "School website" = 'http://www.nicholasbreakspearschool.co.uk/'
CREATE TABLE table_44119 ( "Rank" real, "Title" text, "Studio" text, "Director" text, "Gross" text )
What is the rank of the film directed by Kevin Costner?
SELECT COUNT("Rank") FROM table_44119 WHERE "Director" = 'kevin costner'
CREATE TABLE table_46062 ( "Game" real, "October" real, "Opponent" text, "Score" text, "Record" text )
What is the average game number that was on october 19?
SELECT AVG("Game") FROM table_46062 WHERE "October" = '19'
CREATE TABLE table_name_15 ( craft VARCHAR, location VARCHAR )
What is the Craft used at Coniston Water?
SELECT craft FROM table_name_15 WHERE location = "coniston water"
CREATE TABLE table_26996293_3 ( cfl_team VARCHAR, college VARCHAR )
How many CFL teams drafted someone from mount allison college?
SELECT COUNT(cfl_team) FROM table_26996293_3 WHERE college = "Mount Allison"
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 diagnoses ( 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 )
give me the number of patients whose year of death is less than or equal to 2122 and drug code is beth5?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2122.0" AND prescriptions.formulary_drug_cd = "BETH5"
CREATE TABLE table_65419 ( "Branding" text, "Call-Sign" text, "Frequency" text, "Power (kw)" text, "Location" text )
What's the location when the branding is 1116 DXAS Zamboanga?
SELECT "Location" FROM table_65419 WHERE "Branding" = '1116 dxas zamboanga'
CREATE TABLE table_name_33 ( points INTEGER, extra_points VARCHAR, field_goals VARCHAR )
Who had a points average with 0 extra points and 0 field goals?
SELECT AVG(points) FROM table_name_33 WHERE extra_points = 0 AND field_goals > 0
CREATE TABLE table_name_79 ( share_of_seats VARCHAR, european_election__uk_ VARCHAR )
Which Share of seats has a European election (UK) of 2009?
SELECT share_of_seats FROM table_name_79 WHERE european_election__uk_ = 2009
CREATE TABLE table_name_7 ( date VARCHAR, venue VARCHAR )
Which date held the match at the City Stadium, Georgetown?
SELECT date FROM table_name_7 WHERE venue = "city stadium, georgetown"
CREATE TABLE table_72197 ( "Target" text, "Target Code (Allied)" text, "Luftwaffe unit (wing)" text, "Allied forces" text, "Effect on Allied Squadrons (according to official figures)" text )
Which Allied Force targetted Woensdrecht?
SELECT "Allied forces" FROM table_72197 WHERE "Target" = 'Woensdrecht'
CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5) ) CREATE TABLE Apartment_Bookings ( apt_booking_id INTEGER, apt_id INTEGER, guest_id INTEGER, booking_status_code CHAR(15), booking_start_date DATETIME, booking_end_date DATETIME ) CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME ) CREATE TABLE View_Unit_Status ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME, available_yn BIT ) CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) )
Find the number of booking start date for the apartments that have more than two bedrooms for each weekday in a bar chart.
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2
CREATE TABLE table_name_24 ( team VARCHAR, laps VARCHAR, driver VARCHAR )
What team had 10 Labs and the Driver was Alex Yoong?
SELECT team FROM table_name_24 WHERE laps = 10 AND driver = "alex yoong"
CREATE TABLE table_35500 ( "Date" text, "Home Team" text, "Score" text, "Away Team" text, "Venue" text )
What was the score at Spartan Stadium when San Jose was the Home team?
SELECT "Score" FROM table_35500 WHERE "Home Team" = 'san jose' AND "Venue" = 'spartan stadium'
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time )
on 07/28/2102, when was the last time that the arterial bp [diastolic] of patient 21454 was greater than 52.0?
SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 21454)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [diastolic]' AND d_items.linksto = 'chartevents') AND chartevents.valuenum > 52.0 AND STRFTIME('%y-%m-%d', chartevents.charttime) = '2102-07-28' ORDER BY chartevents.charttime DESC LIMIT 1
CREATE TABLE table_48673 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
what is the score on march 8?
SELECT "Score" FROM table_48673 WHERE "Date" = 'march 8'
CREATE TABLE table_64785 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the sum of the bronze medals when there were less than 8 total medals, 0 silver medals and a rank of 9?
SELECT SUM("Bronze") FROM table_64785 WHERE "Total" < '8' AND "Rank" = '9' AND "Silver" < '0'
CREATE TABLE sampledata15 ( sample_pk number, state text, year text, month text, day text, site text, commod text, source_id text, variety text, origin text, country text, disttype text, commtype text, claim text, quantity number, growst text, packst text, distst text ) CREATE TABLE resultsdata15 ( sample_pk number, commod text, commtype text, lab text, pestcode text, testclass text, concen number, lod number, conunit text, confmethod text, confmethod2 text, annotate text, quantitate text, mean text, extract text, determin text )
What are the country of product origins where pesticide residues were not detected?
SELECT T1.country FROM sampledata15 AS T1 JOIN resultsdata15 AS T2 ON T1.sample_pk = T2.sample_pk WHERE T2.concen = "0" GROUP BY T1.country
CREATE TABLE table_name_23 ( silver VARCHAR, gold VARCHAR, bronze VARCHAR, total VARCHAR, rank VARCHAR )
How many times is the total less than 15, rank less than 5, bronze is 4 and gold smaller than 3?
SELECT COUNT(silver) FROM table_name_23 WHERE total < 15 AND rank < 5 AND bronze = 4 AND gold < 3
CREATE TABLE Accounts ( account_id INTEGER, customer_id INTEGER, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255) ) CREATE TABLE Orders ( order_id INTEGER, customer_id INTEGER, date_order_placed DATETIME, order_details VARCHAR(255) ) CREATE TABLE Invoices ( invoice_number INTEGER, order_id INTEGER, invoice_date DATETIME ) CREATE TABLE Customers ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50) ) CREATE TABLE Invoice_Line_Items ( order_item_id INTEGER, invoice_number INTEGER, product_id INTEGER, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19,4), derived_product_cost DECIMAL(19,4), derived_vat_payable DECIMAL(19,4), derived_total_cost DECIMAL(19,4) ) CREATE TABLE Products ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15), unit_price DECIMAL(19,4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20) ) CREATE TABLE Product_Categories ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19,4) ) CREATE TABLE Financial_Transactions ( transaction_id INTEGER, account_id INTEGER, invoice_number INTEGER, transaction_type VARCHAR(15), transaction_date DATETIME, transaction_amount DECIMAL(19,4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255) ) CREATE TABLE Order_Items ( order_item_id INTEGER, order_id INTEGER, product_id INTEGER, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255) )
Show the number of accounts opened in each day. Bin the account open day by weekday and group by other account details in a stacked bar chart.
SELECT date_account_opened, COUNT(date_account_opened) FROM Accounts GROUP BY other_account_details
CREATE TABLE ref_colors ( color_code text, color_description text ) CREATE TABLE products ( product_id number, color_code text, product_category_code text, product_name text, typical_buying_price text, typical_selling_price text, product_description text, other_product_details text ) CREATE TABLE product_characteristics ( product_id number, characteristic_id number, product_characteristic_value text ) CREATE TABLE ref_product_categories ( product_category_code text, product_category_description text, unit_of_measure text ) CREATE TABLE ref_characteristic_types ( characteristic_type_code text, characteristic_type_description text ) CREATE TABLE characteristics ( characteristic_id number, characteristic_type_code text, characteristic_data_type text, characteristic_name text, other_characteristic_details text )
What are all the characteristic names of product 'sesame'?
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN characteristics AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
CREATE TABLE table_name_59 ( semi_finalist__number2 VARCHAR, year VARCHAR )
Who was the Semi-Finalist #2 in 2007?
SELECT semi_finalist__number2 FROM table_name_59 WHERE year = "2007"
CREATE TABLE table_30288 ( "Religion" text, "Births" real, "Conversions" text, "New adherents per year" real, "Growth rate" text )
Name the number of new adherents per year for confucianism
SELECT COUNT("New adherents per year") FROM table_30288 WHERE "Religion" = 'Confucianism'
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 ) 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 )
what is average age of patients whose gender is m and days of hospital stay is 27?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.days_stay = "27"
CREATE TABLE table_name_48 ( rank VARCHAR, studio VARCHAR )
What is the total number of ranks that had vestron as the studio?
SELECT COUNT(rank) FROM table_name_48 WHERE studio = "vestron"
CREATE TABLE table_14650162_1 ( pick__number VARCHAR, position VARCHAR )
How many picks played Tight end?
SELECT COUNT(pick__number) FROM table_14650162_1 WHERE position = "Tight End"
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
how many patients since 3 years ago were diagnosed with s/p thyroid surgery after antiarrhythmics - class iii antiarrhythmic within 2 months?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antiarrhythmics - class iii antiarrhythmic' AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(), '-3 year')) AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 's/p thyroid surgery' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-3 year')) AS t2 WHERE t1.treatmenttime < t2.diagnosistime AND DATETIME(t2.diagnosistime) BETWEEN DATETIME(t1.treatmenttime) AND DATETIME(t1.treatmenttime, '+2 month')
CREATE TABLE table_36704 ( "Conference" text, "Division" text, "Team" text, "City" text, "Home Stadium" text )
Which Division does the City being jacksonville, florida belong to?
SELECT "Division" FROM table_36704 WHERE "City" = 'jacksonville, florida'
CREATE TABLE table_29565541_2 ( stolen_ends INTEGER, l VARCHAR )
When 5 is the l what is the lowest amount of stolen ends?
SELECT MIN(stolen_ends) FROM table_29565541_2 WHERE l = 5
CREATE TABLE medicine_enzyme_interaction ( enzyme_id int, medicine_id int, interaction_type text ) CREATE TABLE enzyme ( id int, name text, Location text, Product text, Chromosome text, OMIM int, Porphyria text ) CREATE TABLE medicine ( id int, name text, Trade_Name text, FDA_approved text )
Show me a bar chart for what is the id and trade name of the medicines can interact with at least 3 enzymes?, sort total number in ascending order please.
SELECT Trade_Name, id FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id ORDER BY id
CREATE TABLE publication ( abstract varchar, cid int, citation_num int, jid int, pid int, reference_num int, title varchar, year int ) CREATE TABLE domain_keyword ( did int, kid int ) CREATE TABLE conference ( cid int, homepage varchar, name varchar ) CREATE TABLE writes ( aid int, pid int ) CREATE TABLE cite ( cited int, citing int ) CREATE TABLE domain_journal ( did int, jid int ) CREATE TABLE domain ( did int, name varchar ) CREATE TABLE author ( aid int, homepage varchar, name varchar, oid int ) CREATE TABLE organization ( continent varchar, homepage varchar, name varchar, oid int ) CREATE TABLE publication_keyword ( kid int, pid int ) CREATE TABLE domain_publication ( did int, pid int ) CREATE TABLE domain_conference ( cid int, did int ) CREATE TABLE domain_author ( aid int, did int ) CREATE TABLE keyword ( keyword varchar, kid int ) CREATE TABLE journal ( homepage varchar, jid int, name varchar )
return me the number of citations of ' Making database systems usable ' in each year .
SELECT year, SUM(citation_num) FROM publication WHERE title = 'Making database systems usable' GROUP BY year
CREATE TABLE table_name_41 ( world_record VARCHAR )
What's the 123kg of the Total world record?
SELECT 123 AS kg FROM table_name_41 WHERE world_record = "total"
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 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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
what is the primary disease and procedure icd9 code of subject id 74463?
SELECT demographic.diagnosis, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "74463"
CREATE TABLE table_name_38 ( result VARCHAR, date VARCHAR )
What was the result of the game that was played on february 27, 2000?
SELECT result FROM table_name_38 WHERE date = "february 27, 2000"
CREATE TABLE table_41820 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" text, "Record" text )
Who is the visitor when the record is 2-1?
SELECT "Visitor" FROM table_41820 WHERE "Record" = '2-1'
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 ) 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 )
what number of patients given the drug ciprofloxacin were male?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "M" AND prescriptions.drug = "Ciprofloxacin"
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
Of questions that have upvoted answers, how many have accepted answers?.
SELECT a.Id AS "Answer ID", p.Id AS "Question ID", p.Title AS "Title" FROM Posts AS p JOIN Posts AS a ON p.Id = a.ParentId WHERE p.PostTypeId = 1 AND a.OwnerUserId = '##UserId:int##' AND a.Score >= '##MinAnswerScore:int##' AND a.Id != p.AcceptedAnswerId
CREATE TABLE mountain ( Mountain_ID int, Name text, Height real, Prominence real, Range text, Country text ) CREATE TABLE climber ( Climber_ID int, Name text, Country text, Time text, Points real, Mountain_ID int )
How many climbers are from each country, and sort by the Y in ascending.
SELECT Country, COUNT(*) FROM climber GROUP BY Country ORDER BY COUNT(*)
CREATE TABLE table_7216 ( "Position" real, "Team" text, "Points" real, "Played" real, "Drawn" real, "Lost" real, "Against" real, "Difference" text )
What is the total number of points where there were 3 losses and a played number bigger than 12?
SELECT SUM("Points") FROM table_7216 WHERE "Lost" = '3' AND "Played" > '12'
CREATE TABLE table_name_36 ( damage__millions_usd__ VARCHAR, min_press___mbar__ VARCHAR, deaths VARCHAR )
What is the cost of 972 Min Press caused 52 death?
SELECT damage__millions_usd__ FROM table_name_36 WHERE min_press___mbar__ = "972" AND deaths = "52"
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 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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
what is marital status and admission type of subject id 15898?
SELECT demographic.marital_status, demographic.admission_type FROM demographic WHERE demographic.subject_id = "15898"
CREATE TABLE table_5682 ( "Gauge" text, "Railway" text, "Class" text, "Works no." text, "Year" text, "Builder" text )
Which railway has a class of 250 and year 1936?
SELECT "Railway" FROM table_5682 WHERE "Class" = '250' AND "Year" = '1936'
CREATE TABLE table_25800134_2 ( writer_s_ VARCHAR, season__number VARCHAR )
Who are all the writers of episodes in season 24?
SELECT writer_s_ FROM table_25800134_2 WHERE season__number = 24
CREATE TABLE table_26473176_1 ( series VARCHAR, position VARCHAR )
How many 'series' were in the 12th 'position?
SELECT COUNT(series) FROM table_26473176_1 WHERE position = "12th"
CREATE TABLE table_26591434_1 ( ratings__kansai_ VARCHAR, original_airdate VARCHAR )
What is the ratings for the original air date may 25, 2010 22.00 - 22.54?
SELECT ratings__kansai_ FROM table_26591434_1 WHERE original_airdate = "May 25, 2010 22.00 - 22.54"
CREATE TABLE table_29135051_3 ( guest_s_ VARCHAR, ratings VARCHAR )
who guest starred on the episode with a 1.44m rating
SELECT guest_s_ FROM table_29135051_3 WHERE ratings = "1.44m"
CREATE TABLE table_11545282_7 ( years_for_jazz VARCHAR, player VARCHAR )
How many years did Paul Griffin play for the Jazz?
SELECT COUNT(years_for_jazz) FROM table_11545282_7 WHERE player = "Paul Griffin"
CREATE TABLE table_name_4 ( genre VARCHAR, type VARCHAR, developer_s_ VARCHAR )
What type of 3D game did Valve Corporation release?
SELECT genre FROM table_name_4 WHERE type = "3d" AND developer_s_ = "valve corporation"
CREATE TABLE table_16799784_8 ( year_named INTEGER, latitude VARCHAR )
In what year was the feature at a 33.3S latitude named?
SELECT MAX(year_named) FROM table_16799784_8 WHERE latitude = "33.3S"
CREATE TABLE table_204_443 ( id number, "week" number, "date" text, "opponent" text, "result" text, "game site" text, "attendance" number, "bye" text )
total number of attendees at the two games against the new england patriots during the season
SELECT SUM("attendance") FROM table_204_443 WHERE "opponent" = 'new england patriots'
CREATE TABLE table_name_62 ( type VARCHAR, position VARCHAR, location VARCHAR )
what is the type when the position is ambassador and the location is rabat?
SELECT type FROM table_name_62 WHERE position = "ambassador" AND location = "rabat"
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id 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 ) 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 death status is 0 and diagnoses icd9 code is 4260?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.icd9_code = "4260"
CREATE TABLE table_name_16 ( country VARCHAR, olympics VARCHAR, name VARCHAR )
Which country in the 2008 summer olympics is vadim devyatovskiy from?
SELECT country FROM table_name_16 WHERE olympics = "2008 summer olympics" AND name = "vadim devyatovskiy"
CREATE TABLE table_204_100 ( id number, "date" text, "name of ship" text, "nationality" text, "tonnage" number, "fate" text )
what is the difference in tonnage between the heaviest and the lightest ships ?
SELECT MAX("tonnage") - MIN("tonnage") FROM table_204_100
CREATE TABLE table_name_43 ( opponents VARCHAR, partner VARCHAR, date VARCHAR )
Tell me the opponents for mashona washington november 21, 2009
SELECT opponents FROM table_name_43 WHERE partner = "mashona washington" AND date = "november 21, 2009"
CREATE TABLE table_name_28 ( away_team VARCHAR, home_team VARCHAR )
who is the away team when the home team is sydney spirit?
SELECT away_team FROM table_name_28 WHERE home_team = "sydney spirit"
CREATE TABLE table_66474 ( "City of license" text, "Identifier" text, "Frequency" text, "Power" text, "Class" text, "RECNet" text )
What power has A as the class, and 93.7 as the frequency?
SELECT "Power" FROM table_66474 WHERE "Class" = 'a' AND "Frequency" = '93.7'
CREATE TABLE table_name_13 ( australian_marquee VARCHAR, captain VARCHAR )
What Australian Marquee team is Michael Beauchamp a captain of?
SELECT australian_marquee FROM table_name_13 WHERE captain = "michael beauchamp"
CREATE TABLE table_1480455_1 ( population__2005_ VARCHAR, population_density___km_2__ VARCHAR )
What is the total number of population in the year 2005 where the population density 35.9 (/km 2)?
SELECT COUNT(population__2005_) FROM table_1480455_1 WHERE population_density___km_2__ = "35.9"
CREATE TABLE table_204_576 ( id number, "year" number, "best" text, "location" text, "date" text, "world rank" text )
which location has the best time other than brussels ?
SELECT "location" FROM table_204_576 WHERE "location" <> 'brussels' ORDER BY "best" LIMIT 1
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
find the drug name of drug code nalo4i.
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.formulary_drug_cd = "NALO4I"
CREATE TABLE table_31057 ( "Episode" real, "Airdate" text, "Iron Chef" text, "Challenger" text, "Theme Ingredient" text, "Winner" text )
What date did the episode air when guy grossi won?
SELECT "Airdate" FROM table_31057 WHERE "Winner" = 'Guy Grossi'
CREATE TABLE table_28262 ( "AB - Angry boar" text, "B - Bishop" text, "BA - Running Bear" text, "BB - Blind Bear" text, "BC - Beast Cadet" text )
what is b - bishop where ab - angry boar is vw - vertical wolf?
SELECT "B - Bishop" FROM table_28262 WHERE "AB - Angry boar" = 'VW - Vertical Wolf'
CREATE TABLE culture_company ( company_name text, type text, incorporated_in text, group_equity_shareholding number, book_club_id text, movie_id text ) CREATE TABLE movie ( movie_id number, title text, year number, director text, budget_million number, gross_worldwide number ) CREATE TABLE book_club ( book_club_id number, year number, author_or_editor text, book_title text, publisher text, category text, result text )
How many movie directors are there?
SELECT COUNT(DISTINCT director) FROM movie
CREATE TABLE Claims ( Claim_ID INTEGER, Policy_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER ) CREATE TABLE Customer_Policies ( Policy_ID INTEGER, Customer_ID INTEGER, Policy_Type_Code CHAR(15), Start_Date DATE, End_Date DATE ) CREATE TABLE Settlements ( Settlement_ID INTEGER, Claim_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER, Customer_Policy_ID INTEGER ) CREATE TABLE Customers ( Customer_ID INTEGER, Customer_Details VARCHAR(255) ) CREATE TABLE Payments ( Payment_ID INTEGER, Settlement_ID INTEGER, Payment_Method_Code VARCHAR(255), Date_Payment_Made DATE, Amount_Payment INTEGER )
Plot the number of payment method code by grouped by payment method code as a bar graph, and list by the total number from high to low.
SELECT Payment_Method_Code, COUNT(Payment_Method_Code) FROM Payments GROUP BY Payment_Method_Code ORDER BY COUNT(Payment_Method_Code) DESC
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int )
Return a bar chart about the distribution of Nationality and the sum of meter_100 , and group by attribute Nationality, sort by the X-axis from high to low.
SELECT Nationality, SUM(meter_100) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC
CREATE TABLE table_1997759_1 ( location VARCHAR, last_flew VARCHAR )
at what location is the last flew on 11 june 2000
SELECT location FROM table_1997759_1 WHERE last_flew = "11 June 2000"
CREATE TABLE table_189598_7 ( population_density__per_km²_ VARCHAR, name VARCHAR )
When buffalo narrows is the name how many measurements of population density per kilometer squared are there?
SELECT COUNT(population_density__per_km²_) FROM table_189598_7 WHERE name = "Buffalo Narrows"
CREATE TABLE table_25375093_1 ( season VARCHAR, position VARCHAR )
Name the season for position 4th
SELECT COUNT(season) FROM table_25375093_1 WHERE position = "4th"
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid 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 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 the number of patients who died in or before 2122 and lab test is prot.electrophoresis urine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2122.0" AND lab.label = "Prot. Electrophoresis, Urine"
CREATE TABLE table_name_37 ( score VARCHAR, attendance VARCHAR )
What is the score of the game with 1,125 people in attendance?
SELECT score FROM table_name_37 WHERE attendance = "1,125"
CREATE TABLE table_name_69 ( nominee_s_ VARCHAR, year VARCHAR, result VARCHAR )
Which nominees won before year 2005?
SELECT nominee_s_ FROM table_name_69 WHERE year < 2005 AND result = "won"
CREATE TABLE table_name_18 ( opponent VARCHAR, date VARCHAR )
What is Opponent, when Date is 8 April 1999?
SELECT opponent FROM table_name_18 WHERE date = "8 april 1999"
CREATE TABLE table_name_44 ( player VARCHAR, to_par VARCHAR, country VARCHAR )
Who is the player from Spain that has a +2 to par?
SELECT player FROM table_name_44 WHERE to_par = "+2" AND country = "spain"
CREATE TABLE table_65764 ( "Ship name" text, "Year built" real, "Length" text, "Crew" real, "Guests" real, "Staterooms" real, "Comments" text )
What is the total for guests with a ship name of rv indochina, and a crew smaller than 28?
SELECT COUNT("Guests") FROM table_65764 WHERE "Ship name" = 'rv indochina' AND "Crew" < '28'
CREATE TABLE table_name_60 ( venue VARCHAR, runs VARCHAR )
During runs 332, what was the venue?
SELECT venue FROM table_name_60 WHERE runs = "332"
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text )
Give me the comparison about the average of meter_100 over the Nationality , and group by attribute Nationality by a bar chart, and sort by the names from high to low.
SELECT Nationality, AVG(meter_100) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time )
since 2104, what are the top three most frequent lab tests ordered for patients in the same hospital encounter after having received 1 int mam-cor art bypass?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = '1 int mam-cor art bypass') AND STRFTIME('%y', procedures_icd.charttime) >= '2104') AS t1 JOIN (SELECT admissions.subject_id, labevents.itemid, labevents.charttime, admissions.hadm_id FROM labevents JOIN admissions ON labevents.hadm_id = admissions.hadm_id WHERE STRFTIME('%y', labevents.charttime) >= '2104') AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND t1.hadm_id = t2.hadm_id GROUP BY t2.itemid) AS t3 WHERE t3.c1 <= 3)
CREATE TABLE table_name_17 ( zone_2008 VARCHAR, services VARCHAR, station VARCHAR )
Which Zone 2008 has Services of greater anglia, and a Station of cheshunt?
SELECT zone_2008 FROM table_name_17 WHERE services = "greater anglia" AND station = "cheshunt"
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( 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 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 )
Calculate the average age of unmarried patients born after the year 2097
SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.dob_year > "2097"
CREATE TABLE table_40166 ( "School" text, "Location" text, "Enrolment" real, "Founded" real, "Denomination" text, "Boys/Girls" text, "Day/Boarding" text, "Year Entered Competition" real, "School Colors" text )
Which boys' school wears Royal Blue and Gold and entered the competition in 1929?
SELECT "School" FROM table_40166 WHERE "Boys/Girls" = 'boys' AND "Year Entered Competition" = '1929' AND "School Colors" = 'royal blue and gold'
CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight real )
What is the minimum weights for people of each sex? Show a bar chart, sort from low to high by the x-axis.
SELECT Sex, MIN(Weight) FROM people GROUP BY Sex ORDER BY Sex
CREATE TABLE table_name_14 ( theme VARCHAR, year VARCHAR, issue_price VARCHAR )
What theme is associated with a year before 2006 and Issue Price of $25.22?
SELECT theme FROM table_name_14 WHERE year < 2006 AND issue_price = "$25.22"
CREATE TABLE table_79078 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text )
What is Venue, when Status is 'Test Match', and when Against is '12'?
SELECT "Venue" FROM table_79078 WHERE "Status" = 'test match' AND "Against" = '12'
CREATE TABLE table_328 ( "Player" text, "No.(s)" text, "Height in Ft." text, "Position" text, "Years for Rockets" text, "School/Club Team/Country" text )
What player attended Loyola Marymount?
SELECT "Player" FROM table_328 WHERE "School/Club Team/Country" = 'Loyola Marymount'
CREATE TABLE table_43253 ( "Tournament" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text )
What 2002 tournament has 2008 career statistics?
SELECT "2002" FROM table_43253 WHERE "2008" = 'career statistics'
CREATE TABLE table_35312 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What is the Location Attendance when the Date was February 27?
SELECT "Location Attendance" FROM table_35312 WHERE "Date" = 'february 27'
CREATE TABLE table_name_23 ( rating VARCHAR, viewers__households_in_millions_ VARCHAR )
What was the rating of the season that had 18.17 million household viewers?
SELECT rating FROM table_name_23 WHERE viewers__households_in_millions_ = "18.17"
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
what is the length of stay of patient 002-56583 for the last intensive care unit stay?
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-56583') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1
CREATE TABLE table_22871239_5 ( high_rebounds VARCHAR, _number VARCHAR )
How many high rebound catagories are listed for game number 5?
SELECT COUNT(high_rebounds) FROM table_22871239_5 WHERE _number = 5
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other )
all votes and accepts users have cast for all your posts.
SELECT TotalUpVotes = SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END), TotalDownVotes = SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END), Accepts = SUM(CASE WHEN VoteTypeId = 1 THEN 1 ELSE 0 END) FROM Posts AS p INNER JOIN Votes AS v ON p.Id = v.PostId WHERE p.OwnerUserId = '##UserId##'
CREATE TABLE table_42284 ( "Tournament" text, "1998" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text )
What was 2011, when 2005 was 2R, and when 2003 was 2R?
SELECT "2011" FROM table_42284 WHERE "2005" = '2r' AND "2003" = '2r'
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
how many days has it been since the last time patient 011-55642's procedure during the current hospital encounter?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-55642' AND patient.hospitaldischargetime IS NULL)) ORDER BY treatment.treatmenttime DESC LIMIT 1
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text )
Return a bar chart about the distribution of name and ID , display from low to high by the x axis.
SELECT name, ID FROM swimmer ORDER BY name
CREATE TABLE table_15941 ( "Season" real, "Timeslot ( ET )" text, "Season premiere" text, "Season finale" text, "TV season" text, "Rank" text, "Viewers (millions)" text )
What is the season year where the rank is 39?
SELECT "TV season" FROM table_15941 WHERE "Rank" = '39'
CREATE TABLE table_name_55 ( fiscal_year INTEGER, headquarters VARCHAR, employees VARCHAR )
What is the average Fiscal Year of the firm Headquartered in noida, with less than 85,335 employees?
SELECT AVG(fiscal_year) FROM table_name_55 WHERE headquarters = "noida" AND employees < 85 OFFSET 335