instruction stringlengths 0 1.06k | input stringlengths 11 5.3k | response stringlengths 2 4.44k |
|---|---|---|
Which Week has an Air Date of august 30, 2008? | CREATE TABLE table_78861 ("Week" real,"Event" text,"Air Date" text,"Winning team" text,"Winners club" text) | SELECT "Week" FROM table_78861 WHERE "Air Date" = 'august 30, 2008' |
What year did J. Jones, trearddur bay build a boat with a current status of tbsc? | CREATE TABLE table_name_54 (year_built VARCHAR,current_status VARCHAR,boat_builder VARCHAR) | SELECT year_built FROM table_name_54 WHERE current_status = "tbsc" AND boat_builder = "j. jones, trearddur bay" |
Who made the decision when toronto was the home team? | CREATE TABLE table_46337 ("Date" text,"Visitor" text,"Score" text,"Home" text,"Decision" text,"Record" text) | SELECT "Decision" FROM table_46337 WHERE "Home" = 'toronto' |
let me know the gender and short title of diagnoses for patient with patient id 2560. | 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 ... | SELECT demographic.gender, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "2560" |
What is the losing bonus when the points are 24? | CREATE TABLE table_19103 ("Club" text,"Played" text,"Won" text,"Drawn" text,"Lost" text,"Points for" text,"Points against" text,"Tries for" text,"Tries against" text,"Try bonus" text,"Losing bonus" text,"Points" text) | SELECT "Losing bonus" FROM table_19103 WHERE "Points" = '24' |
Will HUMGEN 821 have more than one lecture section next semester , and if so , how many ? | CREATE TABLE area (course_id int,area varchar)CREATE TABLE requirement (requirement_id int,requirement varchar,college varchar)CREATE TABLE ta (campus_job_id int,student_id int,location varchar)CREATE TABLE program (program_id int,name varchar,college varchar,introduction varchar)CREATE TABLE gsi (course_offering_id in... | SELECT COUNT(*) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'HUMGEN' AND course.number = 821 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016 |
Give the building that the instructor who teaches the greatest number of courses lives in. | CREATE TABLE faculty (facid number,lname text,fname text,rank text,sex text,phone number,room text,building text)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number,advisor number,city_code text)CREATE TABLE course (cid text,cname text,credits number,instructor number,days text,hou... | SELECT T2.building FROM course AS T1 JOIN faculty AS T2 ON T1.instructor = T2.facid GROUP BY T1.instructor ORDER BY COUNT(*) DESC LIMIT 1 |
What is the number of patients with primary disease pneumonia who were discharged home? | 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 ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.diagnosis = "PNEUMONIA" |
How many points in 87/88 for racing de c rdoba? | CREATE TABLE table_19354 ("Team" text,"Average" text,"Points" real,"Played" real,"1987-88" text,"1988-89" text,"1989-90" real) | SELECT "1987-88" FROM table_19354 WHERE "Team" = 'Racing de Córdoba' |
In the Champions league is the forward position smaller than 6.0 | CREATE TABLE table_17505751_5 (Champions VARCHAR,position VARCHAR,league VARCHAR) | SELECT COUNT(Champions) AS league FROM table_17505751_5 WHERE position = "Forward" AND league < 6.0 |
What is the total prominence number in m of ethiopia, which has a col in m of 1728 and an elevation less than 3,358? | CREATE TABLE table_name_27 (prominence__m_ VARCHAR,elevation__m_ VARCHAR,country VARCHAR,col__m_ VARCHAR) | SELECT COUNT(prominence__m_) FROM table_name_27 WHERE country = "ethiopia" AND col__m_ = 1728 AND elevation__m_ < 3 OFFSET 358 |
Return a bar chart about the distribution of meter_200 and the average of ID , and group by attribute meter_200, and order from high to low by the bars. | 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 stadium (ID int,name text,Capacity int,City text,Country text,Opening_year int)CREATE TABLE record (ID int,Result text,Swimmer_ID int,Ev... | SELECT meter_200, AVG(ID) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC |
Bar chart of maximal product price from each product type code, show in desc by the maximal product price please. | CREATE TABLE Customers (customer_id INTEGER,payment_method_code VARCHAR(10),customer_code VARCHAR(20),customer_name VARCHAR(80),customer_address VARCHAR(255),customer_phone VARCHAR(80),customer_email VARCHAR(80))CREATE TABLE Suppliers (supplier_id INTEGER,supplier_name VARCHAR(80),supplier_phone VARCHAR(80))CREATE TABL... | SELECT product_type_code, MAX(product_price) FROM Products GROUP BY product_type_code ORDER BY MAX(product_price) DESC |
How many years did he have an average finish of 29.2? | CREATE TABLE table_20686 ("Year" real,"Starts" real,"Wins" real,"Top 10" real,"Avg. Start" text,"Avg. Finish" text,"Winnings" text,"Position" text,"Team(s)" text) | SELECT COUNT("Winnings") FROM table_20686 WHERE "Avg. Finish" = '29.2' |
Calculate the total number of patients from hispanic or latino or puertorican ethnic origin who remained admitted in the hospital for more than 17 days. | 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 ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND demographic.days_stay > "17" |
Show the number of different competition types with a bar graph, list in asc by the Y please. | CREATE TABLE player (Player_ID int,name text,Position text,Club_ID int,Apps real,Tries real,Goals text,Points real)CREATE TABLE club_rank (Rank real,Club_ID int,Gold real,Silver real,Bronze real,Total real)CREATE TABLE club (Club_ID int,name text,Region text,Start_year text)CREATE TABLE competition (Competition_ID int,... | SELECT Competition_type, COUNT(Competition_type) FROM competition GROUP BY Competition_type ORDER BY COUNT(Competition_type) |
how many patients whose ethnicity is white and lab test name is total protein, pleural? | 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 diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "WHITE" AND lab.label = "Total Protein, Pleural" |
where is the district where the incumbent is del latta? | CREATE TABLE table_1341598_36 (district VARCHAR,incumbent VARCHAR) | SELECT district FROM table_1341598_36 WHERE incumbent = "Del Latta" |
What is the number of patients who had procedure icd9 code 3950 and died in or before 2133? | 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 diagnoses (subject_id text,hadm_id text,icd9_code text,short_title text,long_title ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2133.0" AND procedures.icd9_code = "3950" |
What's the tournamnet name that has a 2001 of 1r and 2011? | CREATE TABLE table_43250 ("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) | SELECT "Tournament" FROM table_43250 WHERE "2001" = '1r' AND "2011" = 'a' |
What was the smallest crowd at junction oval? | CREATE TABLE table_53655 ("Home team" text,"Home team score" text,"Away team" text,"Away team score" text,"Venue" text,"Crowd" real,"Date" text) | SELECT MIN("Crowd") FROM table_53655 WHERE "Venue" = 'junction oval' |
Which player went to the college Southern California? | CREATE TABLE table_11677691_4 (player VARCHAR,college VARCHAR) | SELECT player FROM table_11677691_4 WHERE college = "Southern California" |
Who played over 37 games and had 202 assists? | CREATE TABLE table_name_20 (name VARCHAR,games VARCHAR,assists VARCHAR) | SELECT name FROM table_name_20 WHERE games > 37 AND assists = 202 |
Which club had round of group stage round 1 and 5? | CREATE TABLE table_59759 ("Round" text,"Club" text,"Home" text,"Away" text,"Aggregate" text) | SELECT "Club" FROM table_59759 WHERE "Round" = 'group stage round 1 and 5' |
Can you tell me the Series that has the Wins of 0, and the Season of a 2002? | CREATE TABLE table_44594 ("Season" text,"Series" text,"Team Name" text,"Races" real,"Poles" real,"Wins" real,"Points" real,"Final Placing" text) | SELECT "Series" FROM table_44594 WHERE "Wins" = '0' AND "Season" = '2002' |
What is the most first elected for james c. davis? | CREATE TABLE table_18454 ("District" text,"Incumbent" text,"Party" text,"First elected" real,"Result" text,"Candidates" text) | SELECT MAX("First elected") FROM table_18454 WHERE "Incumbent" = 'James C. Davis' |
Which the highest Round has a Player of mike williams, and a Pick # larger than 4? | CREATE TABLE table_name_12 (round INTEGER,player VARCHAR,pick__number VARCHAR) | SELECT MAX(round) FROM table_name_12 WHERE player = "mike williams" AND pick__number > 4 |
What league has a 10 for round with Paul Cain? | CREATE TABLE table_5639 ("Round" real,"Player" text,"Position" text,"Nationality" text,"College/Junior/Club Team (League)" text) | SELECT "College/Junior/Club Team (League)" FROM table_5639 WHERE "Round" = '10' AND "Player" = 'paul cain' |
Which Time has a Lane smaller than 4, and a Rank larger than 6? | CREATE TABLE table_63105 ("Rank" real,"Lane" real,"Name" text,"Nationality" text,"Time" real) | SELECT AVG("Time") FROM table_63105 WHERE "Lane" < '4' AND "Rank" > '6' |
Show me about the distribution of All_Neutral and School_ID in a bar chart. | CREATE TABLE university (School_ID int,School text,Location text,Founded real,Affiliation text,Enrollment real,Nickname text,Primary_conference text)CREATE TABLE basketball_match (Team_ID int,School_ID int,Team_Name text,ACC_Regular_Season text,ACC_Percent text,ACC_Home text,ACC_Road text,All_Games text,All_Games_Perce... | SELECT All_Neutral, School_ID FROM basketball_match |
Who was the opponent when the method was points (4 x 0)? | CREATE TABLE table_12628 ("Result" text,"Opponent" text,"Method" text,"Event" text,"Notes" text) | SELECT "Opponent" FROM table_12628 WHERE "Method" = 'points (4 x 0)' |
What was the location of the match that had a result of 3-3? | CREATE TABLE table_name_13 (location VARCHAR,result VARCHAR) | SELECT location FROM table_name_13 WHERE result = "3-3" |
What is the fewest number of silver medals won by Canada with fewer than 3 total medals? | CREATE TABLE table_79580 ("Rank" text,"Nation" text,"Gold" real,"Silver" real,"Bronze" real,"Total" real) | SELECT MIN("Silver") FROM table_79580 WHERE "Nation" = 'canada' AND "Total" < '3' |
patients with loss of consciousness or ( glasgow < 14 ) | CREATE TABLE table_test_2 ("id" int,"loss_of_consciousness" bool,"gender" string,"bleeding" int,"systolic_blood_pressure_sbp" int,"stroke" bool,"renal_disease" bool,"hemorrhagic_diathesis" bool,"transient_ischemic_attack" bool,"creatinine_clearance_cl" float,"dementia" bool,"glasgow_come_score_gcs" int,"prior_creatinin... | SELECT * FROM table_test_2 WHERE loss_of_consciousness = 1 OR glasgow_come_score_gcs < 14 |
what is the number of patients whose insurance is medicaid and diagnoses icd9 code is 3569? | 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 ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Medicaid" AND diagnoses.icd9_code = "3569" |
In 1975, what was the final round? | CREATE TABLE table_name_1 (final_round VARCHAR,year VARCHAR) | SELECT final_round FROM table_name_1 WHERE year = "1975" |
what's the character name with voice actor (englbeingh 1997 / saban) being ian james corlett | CREATE TABLE table_19131 ("Character Name" text,"Voice Actor (Japanese)" text,"Voice Actor (English 1997 / Saban)" text,"Voice Actor (English 1998 / Pioneer)" text,"Voice Actor (English 2006 / FUNimation)" text) | SELECT "Character Name" FROM table_19131 WHERE "Voice Actor (English 1997 / Saban)" = 'Ian James Corlett' |
What is the A-side for catalog 902? | CREATE TABLE table_name_87 (a_side VARCHAR,catalog_number VARCHAR) | SELECT a_side FROM table_name_87 WHERE catalog_number = "902" |
What was the venue when Jerran Hart won? | CREATE TABLE table_name_20 (venue VARCHAR,winner VARCHAR) | SELECT venue FROM table_name_20 WHERE winner = "jerran hart" |
get the number of patients who are diagnosed with acute parametritis and pelvic cellulitis. | 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 ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Acute parametritis and pelvic cellulitis" |
Show me Independent Studies courses that have 15 credits . | CREATE TABLE course_offering (offering_id int,course_id int,semester int,section_number int,start_time time,end_time time,monday varchar,tuesday varchar,wednesday varchar,thursday varchar,friday varchar,saturday varchar,sunday varchar,has_final_project varchar,has_final_exam varchar,textbook varchar,class_address varch... | SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%Independent Studies%' OR name LIKE '%Independent Studies%') AND credits = 15 |
If the earning amount is $309,886, what is the money list ranking? | CREATE TABLE table_22081847_1 (money_list_rank VARCHAR,earnings__$_ VARCHAR) | SELECT money_list_rank FROM table_22081847_1 WHERE earnings__$_ = "309,886" |
Plot how many date of transaction over date of transaction in a line chart, and list X-axis from high to low order. | CREATE TABLE Lots (lot_id INTEGER,investor_id INTEGER,lot_details VARCHAR(255))CREATE TABLE Transactions_Lots (transaction_id INTEGER,lot_id INTEGER)CREATE TABLE Transactions (transaction_id INTEGER,investor_id INTEGER,transaction_type_code VARCHAR(10),date_of_transaction DATETIME,amount_of_transaction DECIMAL(19,4),sh... | SELECT date_of_transaction, COUNT(date_of_transaction) FROM Transactions ORDER BY date_of_transaction DESC |
how many patients are primary diagnosed for st elevated myocardial infarction or cardiac cath and have a lab test for blood? | 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 demographic (subject_id text,hadm_id text,name text,marita... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND lab.fluid = "Blood" |
What is every score when the date is January 2? | CREATE TABLE table_30423 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Record" text) | SELECT "Score" FROM table_30423 WHERE "Date" = 'January 2' |
For what tournament was Bubba Watson the runner-up? | CREATE TABLE table_name_29 (tournament VARCHAR,runner_s__up VARCHAR) | SELECT tournament FROM table_name_29 WHERE runner_s__up = "bubba watson" |
Name the 2012 for 2011 being 1r | CREATE TABLE table_name_5 (Id VARCHAR) | SELECT 2012 FROM table_name_5 WHERE 2011 = "1r" |
what was the age of patient 97733 during this hospital encounter? | CREATE TABLE procedures_icd (row_id number,subject_id number,hadm_id number,icd9_code text,charttime time)CREATE TABLE d_icd_procedures (row_id number,icd9_code text,short_title text,long_title text)CREATE TABLE transfers (row_id number,subject_id number,hadm_id number,icustay_id number,eventtype text,careunit text,war... | SELECT admissions.age FROM admissions WHERE admissions.subject_id = 97733 AND admissions.dischtime IS NULL |
what flights are there from NEWARK to CHICAGO on CO | CREATE TABLE time_zone (time_zone_code text,time_zone_name text,hours_from_gmt int)CREATE TABLE flight_fare (flight_id int,fare_id 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,gro... | 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, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CHICAGO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NEWAR... |
What is the region containing the Constitutional Province of Callao? | CREATE TABLE table_21004 ("Province" text,"Population" real,"Region" text,"Name of City" text,"Districts" real) | SELECT "Region" FROM table_21004 WHERE "Province" = 'Constitutional Province of Callao' |
What was the record in the win 7 streak? | CREATE TABLE table_38716 ("Date" text,"Opponent" text,"Result" text,"Score" text,"Record" text,"Streak" text) | SELECT "Record" FROM table_38716 WHERE "Streak" = 'win 7' |
what is the one year survival probability for patients who were prescribed nateglinide after having been diagnosed with poison-antipsychotic nec? | CREATE TABLE outputevents (row_id number,subject_id number,hadm_id number,icustay_id number,charttime time,itemid number,value number)CREATE TABLE cost (row_id number,subject_id number,hadm_id number,event_type text,event_id number,chargetime time,cost number)CREATE TABLE diagnoses_icd (row_id number,subject_id number,... | SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 1 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd... |
Which situation has an original u.s. airdate of December 5, 2007? | CREATE TABLE table_14570857_1 (situation VARCHAR,original_us_airdate VARCHAR) | SELECT situation FROM table_14570857_1 WHERE original_us_airdate = "December 5, 2007" |
How did the match end when she played with caroline wozniacki? | CREATE TABLE table_25505246_8 (outcome VARCHAR,partner VARCHAR) | SELECT outcome FROM table_25505246_8 WHERE partner = "Caroline Wozniacki" |
how many patients got prescriptions for zosyn during a year before? | CREATE TABLE allergy (allergyid number,patientunitstayid number,drugname text,allergyname text,allergytime time)CREATE TABLE treatment (treatmentid number,patientunitstayid number,treatmentname text,treatmenttime time)CREATE TABLE patient (uniquepid text,patienthealthsystemstayid number,patientunitstayid number,gender ... | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'zosyn' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) |
count the number of patients whose age is less than 86 and diagnoses long title is wheelchair dependence? | 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 lab (subject_id text,hadm_id text,itemid text,charttime te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "86" AND diagnoses.long_title = "Wheelchair dependence" |
how many chassis in the 80 's were penske 's ? | CREATE TABLE table_204_939 (id number,"year" number,"chassis" text,"engine" text,"start" text,"finish" text) | SELECT COUNT("chassis") FROM table_204_939 WHERE "chassis" = 'penske' |
Who is the opponent of the game played on November 20, 1995? | CREATE TABLE table_42179 ("Week" real,"Date" text,"Opponent" text,"Result" text,"Attendance" text) | SELECT "Opponent" FROM table_42179 WHERE "Date" = 'november 20, 1995' |
what are the five most commonly prescribed medications for patients that have been previously prescribed neomycin-polymyxin-bacitracin during the same hospital encounter, until 4 years ago? | 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 microbiologyevents (row_id number,subject_id number,hadm_id number,charttime time,spec_type_desc text,org_name text)C... | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate, admissions.hadm_id FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'neomycin-polymyxin-bacitracin' AND DATETIME(p... |
How many customers are there in the customer type with the most customers? | CREATE TABLE customers (customer_type_code VARCHAR) | SELECT COUNT(*) FROM customers GROUP BY customer_type_code ORDER BY COUNT(*) DESC LIMIT 1 |
What are the distinct registration dates and the election cycles? | CREATE TABLE voting_record (stuid number,registration_date text,election_cycle text,president_vote number,vice_president_vote number,secretary_vote number,treasurer_vote number,class_president_vote number,class_senator_vote number)CREATE TABLE student (stuid number,lname text,fname text,age number,sex text,major number... | SELECT DISTINCT registration_date, election_cycle FROM voting_record |
How many courses are in the Psychology department for each year? Return a line chart, and display X-axis in desc order. | CREATE TABLE time_slot (time_slot_id varchar(4),day varchar(1),start_hr numeric(2),start_min numeric(2),end_hr numeric(2),end_min numeric(2))CREATE TABLE classroom (building varchar(15),room_number varchar(7),capacity numeric(4,0))CREATE TABLE takes (ID varchar(5),course_id varchar(8),sec_id varchar(8),semester varchar... | SELECT year, COUNT(year) FROM course AS T1 JOIN section AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY year DESC |
what is the days of hospital stay and lab test name of subject id 32418? | 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... | SELECT demographic.days_stay, lab.label FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.subject_id = "32418" |
Which game has a high rebound of Evans (7) and a high assist of Evans, Ollie (3)? | CREATE TABLE table_52678 ("Game" real,"Date" text,"Team" text,"Score" text,"High points" text,"High rebounds" text,"High assists" text,"Location Attendance" text,"Series" text) | SELECT MAX("Game") FROM table_52678 WHERE "High rebounds" = 'evans (7)' AND "High assists" = 'evans, ollie (3)' |
Name the home for 21-17 | CREATE TABLE table_69942 ("Date" text,"Visitor" text,"Result" text,"Score" text,"Home" text,"Record" text,"Attendance" real) | SELECT "Home" FROM table_69942 WHERE "Score" = '21-17' |
How many completion students in each day? Return a line chart grouping by date of completion, rank by the x axis from low to high. | CREATE TABLE Courses (course_id INTEGER,author_id INTEGER,subject_id INTEGER,course_name VARCHAR(120),course_description VARCHAR(255))CREATE TABLE Student_Course_Enrolment (registration_id INTEGER,student_id INTEGER,course_id INTEGER,date_of_enrolment DATETIME,date_of_completion DATETIME)CREATE TABLE Course_Authors_and... | SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment GROUP BY date_of_completion ORDER BY date_of_completion |
What is Permanent Account, when Updated In Past 30 Days is 10324? | CREATE TABLE table_name_96 (permanent_account VARCHAR,updated_in_past_30_days VARCHAR) | SELECT permanent_account FROM table_name_96 WHERE updated_in_past_30_days = "10324" |
What country was the player, rod pampling, from who placed t10? | CREATE TABLE table_name_43 (country VARCHAR,place VARCHAR,player VARCHAR) | SELECT country FROM table_name_43 WHERE place = "t10" AND player = "rod pampling" |
How many weeks are teams playing agains the Barcelona dragons? | CREATE TABLE table_3166 ("Week" real,"Date" text,"Kickoff" text,"Opponent" text,"Final score" text,"Team record" text,"Game site" text,"Attendance" real) | SELECT COUNT("Week") FROM table_3166 WHERE "Opponent" = 'Barcelona Dragons' |
What is Career with the franchise [b ], when Player is 'Willie Anderson Category:Articles with hCards'? | CREATE TABLE table_8380 ("Pick" real,"Player" text,"Pos." text,"Nationality" text,"Team" text,"Previous team" text,"NBA years [a ]" text,"Career with the franchise [b ]" text) | SELECT "Career with the franchise [b ]" FROM table_8380 WHERE "Player" = 'willie anderson category:articles with hcards' |
What is the Points with an Against smaller than 16? | CREATE TABLE table_name_51 (points INTEGER,against INTEGER) | SELECT AVG(points) FROM table_name_51 WHERE against < 16 |
Show me about the distribution of meter_200 and the sum of meter_100 , and group by attribute meter_200 in a bar chart, and show by the x axis in desc. | 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)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... | SELECT meter_200, SUM(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC |
who finished earlier , hindoocraft or spokane ? | CREATE TABLE table_204_330 (id number,"finished" text,"horse" text,"jockey" text,"trainer" text,"owner" text,"time / behind" text) | SELECT "horse" FROM table_204_330 WHERE "horse" IN ('hindoocraft', 'spokane') ORDER BY "finished" LIMIT 1 |
what was the score in the loss to tapani (0-1)? | CREATE TABLE table_15510 ("Date" text,"Opponent" text,"Score" text,"Loss" text,"Attendance" real,"Series" text) | SELECT "Score" FROM table_15510 WHERE "Loss" = 'tapani (0-1)' |
Celebrities from Ukraine (top 500 users ordered by profile views to rep points). | CREATE TABLE ReviewTaskTypes (Id number,Name text,Description text)CREATE TABLE VoteTypes (Id number,Name text)CREATE TABLE PostTags (PostId number,TagId number)CREATE TABLE PostTypes (Id number,Name text)CREATE TABLE PostFeedback (Id number,PostId number,IsAnonymous boolean,VoteTypeId number,CreationDate time)CREATE T... | SELECT ROW_NUMBER() OVER (ORDER BY 'views_to_rep' DESC) AS "#", * FROM (SELECT u.Id AS "user_link", u.Views, u.Reputation, 1. * u.Views / u.Reputation AS "views_to_rep" FROM Users AS u WHERE u.Location LIKE '%Ukraine%') AS q ORDER BY 'views_to_rep' DESC LIMIT 500 |
What is the pts for 2004, and the ro event? | CREATE TABLE table_name_6 (pts VARCHAR,year VARCHAR,event VARCHAR) | SELECT pts FROM table_name_6 WHERE year = "2004" AND event = "ro" |
how much taller in oliver venno than rait rikberg ? | CREATE TABLE table_203_116 (id number,"no." number,"player" text,"birth date" text,"weight" number,"height" number,"position" text,"current club" text) | SELECT (SELECT "height" FROM table_203_116 WHERE "player" = 'oliver venno') - (SELECT "height" FROM table_203_116 WHERE "player" = 'rait rikberg') |
what is the number of patients whose age is less than 68 and drug type is base? | 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... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "68" AND prescriptions.drug_type = "BASE" |
Questions eligible for APL bounty by Adam. | 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 Posts (Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score ... | SELECT Q.Id AS "post_link", Q.Score, Q.AnswerCount, Q.ClosedDate FROM Posts AS Q WHERE Q.PostTypeId = 1 AND Q.Body LIKE '%help.dyalog.com%' OR EXISTS(SELECT * FROM Posts AS A WHERE A.ParentId = Q.Id AND A.PostTypeId = 2 AND A.Body LIKE '%help.dyalog.com%') ORDER BY Q.ClosedDate, Q.AnswerCount, Q.Score DESC |
How many extra points did Germany Schultz score? | CREATE TABLE table_3397 ("Player" text,"Touchdowns (5 points)" real,"Extra points 1 point" real,"Field goals (4 points)" real,"Safeties (2 points)" real,"Total Points" real) | SELECT "Extra points 1 point" FROM table_3397 WHERE "Player" = 'Germany Schultz' |
What are the hometowns that are shared by at least two gymnasts? | CREATE TABLE people (people_id number,name text,age number,height number,hometown text)CREATE TABLE gymnast (gymnast_id number,floor_exercise_points number,pommel_horse_points number,rings_points number,vault_points number,parallel_bars_points number,horizontal_bar_points number,total_points number) | SELECT T2.hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.gymnast_id = T2.people_id GROUP BY T2.hometown HAVING COUNT(*) >= 2 |
What is GTO Winning Team Mike Keyser's RND number? | CREATE TABLE table_18904 ("Rnd" real,"Circuit" text,"GTO Winning Team" text,"GTU Winning Team" text,"TO Winning Team" text,"TU Winning Team" text,"Results" text) | SELECT "Rnd" FROM table_18904 WHERE "GTO Winning Team" = 'Mike Keyser' |
Who plays at Victoria Park? | CREATE TABLE table_name_14 (away_team VARCHAR,venue VARCHAR) | SELECT away_team FROM table_name_14 WHERE venue = "victoria park" |
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the trend about department_id over hire_date . | CREATE TABLE job_history (EMPLOYEE_ID decimal(6,0),START_DATE date,END_DATE date,JOB_ID varchar(10),DEPARTMENT_ID decimal(4,0))CREATE TABLE countries (COUNTRY_ID varchar(2),COUNTRY_NAME varchar(40),REGION_ID decimal(10,0))CREATE TABLE jobs (JOB_ID varchar(10),JOB_TITLE varchar(35),MIN_SALARY decimal(6,0),MAX_SALARY dec... | SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
Who directed the episodes that aired December 15, 1956? | CREATE TABLE table_25800134_1 (director VARCHAR,airdate VARCHAR) | SELECT director FROM table_25800134_1 WHERE airdate = "December 15, 1956" |
How many people attended the game where Fitzroy was the away team? | CREATE TABLE table_name_44 (crowd VARCHAR,away_team VARCHAR) | SELECT COUNT(crowd) FROM table_name_44 WHERE away_team = "fitzroy" |
give me the number of patients whose admission type is urgent and lab test name is wbc, joint fluid? | 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 ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.label = "WBC, Joint Fluid" |
find all films in which ' Rowan Atkinson ' acted as ' Mr. Bean | CREATE TABLE producer (pid int,gender text,name text,nationality text,birth_city text,birth_year int)CREATE TABLE cast (id int,msid int,aid int,role text)CREATE TABLE writer (wid int,gender text,name text,nationality text,birth_city text,birth_year int)CREATE TABLE directed_by (id int,msid int,did int)CREATE TABLE movi... | SELECT movie.title FROM actor, cast, movie WHERE actor.name = 'Rowan Atkinson' AND cast.aid = actor.aid AND cast.role = 'Mr. Bean' AND movie.mid = cast.msid |
What is the sum of the home wins of the Boston College Eagles, which has more than 6 wins? | CREATE TABLE table_name_89 (Home INTEGER,institution VARCHAR,wins VARCHAR) | SELECT SUM(Home) AS wins FROM table_name_89 WHERE institution = "boston college eagles" AND wins > 6 |
What was the actors name that vadim ilyenko directed? | CREATE TABLE table_10236830_1 (actors_name VARCHAR,director VARCHAR) | SELECT actors_name FROM table_10236830_1 WHERE director = "Vadim Ilyenko" |
count the number of patients whose admission year is less than 2167 and procedure long title is percutaneous (endoscopic) jejunostomy [pej]? | 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 prescriptions (subject_id text,hadm_id text,icustay_id text,drug_type text,drug text,formulary_drug_cd t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2167" AND procedures.long_title = "Percutaneous (endoscopic) jejunostomy [PEJ]" |
If the episode title is Pressures, what are the names of the cast? | CREATE TABLE table_2570269_2 (cast VARCHAR,episode_title VARCHAR) | SELECT cast FROM table_2570269_2 WHERE episode_title = "Pressures" |
Return a bar chart about the distribution of Time and meter_100 , and show meter_100 from high to low order. | 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 event (ID int,Name text,Stadium_ID int,Year text)CREATE TABLE stadium (ID int,name text,Capacity int,City text,Country text,Opening_year... | SELECT Time, meter_100 FROM swimmer ORDER BY meter_100 DESC |
What is the median family income when the per capita is $24,114? | CREATE TABLE table_name_23 (median_family_income VARCHAR,per_capita_income VARCHAR) | SELECT median_family_income FROM table_name_23 WHERE per_capita_income = "$24,114" |
how many patients whose discharge location is rehab/distinct part hosp and procedure icd9 code is 3491? | 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_fla... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "REHAB/DISTINCT PART HOSP" AND procedures.icd9_code = "3491" |
Name the least matches for runs being 276 | CREATE TABLE table_17900317_5 (matches INTEGER,runs VARCHAR) | SELECT MIN(matches) FROM table_17900317_5 WHERE runs = 276 |
for how many patients born before the year 2121, the drug route is pr? | 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 ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2121" AND prescriptions.route = "PR" |
what season had the least amount of wins ? | CREATE TABLE table_204_242 (id number,"season" text,"record" text,"finish" text,"manager" text,"notes" text) | SELECT "season" FROM table_204_242 ORDER BY "record" LIMIT 1 |
Round 4 for larger than 19 Round 1 and a 27 Round 2? | CREATE TABLE table_name_45 (round_4 VARCHAR,round_1 VARCHAR,round_2 VARCHAR) | SELECT round_4 FROM table_name_45 WHERE round_1 > 19 AND round_2 = "27" |
When were the top 500 tags created?. | CREATE TABLE ReviewTaskResultTypes (Id number,Name text,Description text)CREATE TABLE CloseAsOffTopicReasonTypes (Id number,IsUniversal boolean,InputTitle text,MarkdownInputGuidance text,MarkdownPostOwnerGuidance text,MarkdownPrivilegedUserGuidance text,MarkdownConcensusDescription text,CreationDate time,CreationModera... | SELECT Tags.TagName, wiki.CreationDate AS "wiki_date", excerpt.CreationDate AS "excerpt_date", MIN(Posts.CreationDate) AS "first_post", COUNT(Tags.TagName) AS Uses FROM (((PostTags INNER JOIN Posts ON PostTags.PostId = Posts.Id) INNER JOIN Tags ON PostTags.TagId = Tags.Id) INNER JOIN Posts AS wiki ON Tags.WikiPostId = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.