schema
stringlengths
29
5.42k
question
stringlengths
0
752
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
8.94k
weight
float64
0
8.73
CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME)
until 01/06/2103 was the heartrate of patient 012-35970 ever less than 71.0?
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-35970')) AND vitalperiodic.heartrate < 71.0 AND NOT vitalperiodic.heartrate IS NULL AND STRFTIME('%y-%m-%d', vitalperiodic.observationtime) <= '2103-01-06'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '012-35970' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) > 0 FROM "vitalperiodic" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE "vitalperiodic"."heartrate" < 71.0 AND NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."heartrate" IS NULL AND STRFTIME('%y-%m-%d', "vitalperiodic"."observationtime") <= '2103-01-06'
0.641602
CREATE TABLE table_39682 ("Year" CLOB, "Title" CLOB, "Role" CLOB, "Language" CLOB, "Notes" CLOB)
What was the role in 1996?
SELECT "Role" FROM table_39682 WHERE "Year" = '1996'
SELECT "Role" FROM "table_39682" WHERE "Year" = '1996'
0.052734
CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE course_offering (offering_id NUMBER, course_id NUMBER, semester NUMBER, section_number NUMBER, start_time TIME, end_time TIME, monday VARCHAR2, tuesday VARCHAR2, wednesday VARCHAR2, thursday VARCHAR2, friday VARCHAR2, saturday VARCHAR2, sunday VARCHAR2, has_final_project VARCHAR2, has_final_exam VARCHAR2, textbook VARCHAR2, class_address VARCHAR2, allow_audit VARCHAR2) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE course_tags_count (course_id NUMBER, clear_grading NUMBER, pop_quiz NUMBER, group_projects NUMBER, inspirational NUMBER, long_lectures NUMBER, extra_credit NUMBER, few_tests NUMBER, good_feedback NUMBER, tough_tests NUMBER, heavy_papers NUMBER, cares_for_students NUMBER, heavy_assignments NUMBER, respected NUMBER, participation NUMBER, heavy_reading NUMBER, tough_grader NUMBER, hilarious NUMBER, would_take_again NUMBER, good_lecture NUMBER, no_skip NUMBER) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE course (course_id NUMBER, name VARCHAR2, department VARCHAR2, number VARCHAR2, credits VARCHAR2, advisory_requirement VARCHAR2, enforced_requirement VARCHAR2, description VARCHAR2, num_semesters NUMBER, num_enrolled NUMBER, has_discussion VARCHAR2, has_lab VARCHAR2, has_projects VARCHAR2, has_exams VARCHAR2, num_reviews NUMBER, clarity_score NUMBER, easiness_score NUMBER, helpfulness_score NUMBER) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2) CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER)
What RCARTS classes are counted as ULCS ?
SELECT DISTINCT course.department, course.name, course.number FROM course, program, program_course WHERE course.department LIKE '%RCARTS%' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%ULCS%' JOIN "program" ON "program"."name" LIKE '%CS-LSA%' AND "program"."program_id" = "program_course"."program_id" WHERE "course"."department" LIKE '%RCARTS%'
0.355469
CREATE TABLE Ref_calendar (calendar_date VARCHAR2, day_Number VARCHAR2)
Show all calendar dates and day Numbers.
SELECT calendar_date, day_Number FROM Ref_calendar
SELECT "calendar_date", "day_Number" FROM "Ref_calendar"
0.054688
CREATE TABLE PROFESSOR (EMP_NUM NUMBER, DEPT_CODE VARCHAR2, PROF_OFFICE VARCHAR2, PROF_EXTENSION VARCHAR2, PROF_HIGH_DEGREE VARCHAR2) CREATE TABLE COURSE (CRS_CODE VARCHAR2, DEPT_CODE VARCHAR2, CRS_DESCRIPTION VARCHAR2, CRS_CREDIT FLOAT) CREATE TABLE ENROLL (CLASS_CODE VARCHAR2, STU_NUM NUMBER, ENROLL_GRADE VARCHAR2) CREATE TABLE DEPARTMENT (DEPT_CODE VARCHAR2, DEPT_NAME VARCHAR2, SCHOOL_CODE VARCHAR2, EMP_NUM NUMBER, DEPT_ADDRESS VARCHAR2, DEPT_EXTENSION VARCHAR2) CREATE TABLE CLASS (CLASS_CODE VARCHAR2, CRS_CODE VARCHAR2, CLASS_SECTION VARCHAR2, CLASS_TIME VARCHAR2, CLASS_ROOM VARCHAR2, PROF_NUM NUMBER) CREATE TABLE STUDENT (STU_NUM NUMBER, STU_LNAME VARCHAR2, STU_FNAME VARCHAR2, STU_INIT VARCHAR2, STU_DOB DATETIME, STU_HRS NUMBER, STU_CLASS VARCHAR2, STU_GPA FLOAT, STU_TRANSFER NUMBER, DEPT_CODE VARCHAR2, STU_PHONE VARCHAR2, PROF_NUM NUMBER) CREATE TABLE EMPLOYEE (EMP_NUM NUMBER, EMP_LNAME VARCHAR2, EMP_FNAME VARCHAR2, EMP_INITIAL VARCHAR2, EMP_JOBCODE VARCHAR2, EMP_HIREDATE DATETIME, EMP_DOB DATETIME)
Show birthdates of the professors in charge of ACCT-211 and bin the date by year interval in a line chart, display X-axis in asc order.
SELECT EMP_DOB, COUNT(EMP_DOB) FROM EMPLOYEE AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM = T2.PROF_NUM WHERE CRS_CODE = "ACCT-211" ORDER BY EMP_DOB
SELECT "EMP_DOB", COUNT("EMP_DOB") FROM "EMPLOYEE" "T1" JOIN "CLASS" "T2" ON "T1"."EMP_NUM" = "T2"."PROF_NUM" WHERE "ACCT-211" = "CRS_CODE" ORDER BY "EMP_DOB"
0.154297
CREATE TABLE table_39905 ("Number" FLOAT, "Builder" CLOB, "Type" CLOB, "Date" CLOB, "Works number" CLOB)
Which Works number has a Builder of canadian engine & machinery company, and a Number smaller than 3?
SELECT "Works number" FROM table_39905 WHERE "Builder" = 'canadian engine & machinery company' AND "Number" < '3'
SELECT "Works number" FROM "table_39905" WHERE "Builder" = 'canadian engine & machinery company' AND "Number" < '3'
0.112305
CREATE TABLE table_51847 ("Driver" CLOB, "Constructor" CLOB, "Laps" FLOAT, "Time/Retired" CLOB, "Grid" FLOAT)
How many laps did innes ireland drive with a grid higher than 11?
SELECT SUM("Laps") FROM table_51847 WHERE "Driver" = 'innes ireland' AND "Grid" > '11'
SELECT SUM("Laps") FROM "table_51847" WHERE "Driver" = 'innes ireland' AND "Grid" > '11'
0.085938
CREATE TABLE store (Id VARCHAR2)
How many stores are there?
SELECT COUNT(*) FROM store
SELECT COUNT(*) FROM "store"
0.027344
CREATE TABLE table_204_597 (id NUMBER, "main author" CLOB, "no. of patients" NUMBER, "duration of follow-up years" NUMBER, "linearized rate of infection" CLOB, "actuarial freedom from infective endocarditis" CLOB)
what author had the least number of patients ?
SELECT "main author" FROM table_204_597 ORDER BY "no. of patients" LIMIT 1
SELECT "main author" FROM "table_204_597" ORDER BY "no. of patients" FETCH FIRST 1 ROWS ONLY
0.089844
CREATE TABLE table_64942 ("Player" CLOB, "Int'l Debut" CLOB, "Year" CLOB, "Cross Code Debut" CLOB, "Date" CLOB)
What is the Player in the Int'l Debut of 1974?
SELECT "Player" FROM table_64942 WHERE "Year" = '1974'
SELECT "Player" FROM "table_64942" WHERE "Year" = '1974'
0.054688
CREATE TABLE table_14652 ("City" CLOB, "Province/Region" CLOB, "Country" CLOB, "IATA" CLOB, "ICAO" CLOB, "Airport" CLOB)
Which country is the ICAO vvts?
SELECT "Country" FROM table_14652 WHERE "ICAO" = 'vvts'
SELECT "Country" FROM "table_14652" WHERE "ICAO" = 'vvts'
0.055664
CREATE TABLE table_69773 ("Player" CLOB, "Country" CLOB, "Year ( s ) won" CLOB, "Total" FLOAT, "To par" CLOB, "Finish" CLOB)
For the player finishing at +8, what is his nationality?
SELECT "Country" FROM table_69773 WHERE "To par" = '+8'
SELECT "Country" FROM "table_69773" WHERE "To par" = '+8'
0.055664
CREATE TABLE table_57109 ("Home team" CLOB, "Home team score" CLOB, "Away team" CLOB, "Away team score" CLOB, "Venue" CLOB, "Crowd" FLOAT, "Date" CLOB)
Where was the game played when the home team scored 10.12 (72)?
SELECT "Venue" FROM table_57109 WHERE "Home team score" = '10.12 (72)'
SELECT "Venue" FROM "table_57109" WHERE "Home team score" = '10.12 (72)'
0.070313
CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) 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 intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME)
how many hours since the last viral hepatitis - hepatitis b diagnosis of patient 030-42006 during the current hospital visit?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnosis.diagnosistime)) FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-42006' AND patient.hospitaldischargetime IS NULL)) AND diagnosis.diagnosisname = 'viral hepatitis - hepatitis b' ORDER BY diagnosis.diagnosistime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."hospitaldischargetime" IS NULL AND "patient"."uniquepid" = '030-42006' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "diagnosis"."diagnosistime")) FROM "diagnosis" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "diagnosis"."patientunitstayid" WHERE "diagnosis"."diagnosisname" = 'viral hepatitis - hepatitis b' AND NOT "_u_1"."" IS NULL ORDER BY "diagnosis"."diagnosistime" DESC FETCH FIRST 1 ROWS ONLY
0.72168
CREATE TABLE table_25519 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" CLOB, "Directed by" CLOB, "Written by" CLOB, "Original air date" CLOB)
David James Elliott directed which episode number within the series?
SELECT "No. in series" FROM table_25519 WHERE "Directed by" = 'David James Elliott'
SELECT "No. in series" FROM "table_25519" WHERE "Directed by" = 'David James Elliott'
0.083008
CREATE TABLE club (club_id NUMBER, name CLOB, region CLOB, start_year CLOB) CREATE TABLE competition (competition_id NUMBER, year NUMBER, competition_type CLOB, country CLOB) CREATE TABLE player (player_id NUMBER, name CLOB, position CLOB, club_id NUMBER, apps NUMBER, tries NUMBER, goals CLOB, points NUMBER) CREATE TABLE club_rank (rank NUMBER, club_id NUMBER, gold NUMBER, silver NUMBER, bronze NUMBER, total NUMBER) CREATE TABLE competition_result (competition_id NUMBER, club_id_1 NUMBER, club_id_2 NUMBER, score CLOB)
What are the names of the clubs that have players in the position of 'Right Wing'?
SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.club_id = T2.club_id WHERE T2.position = "Right Wing"
SELECT "T1"."name" FROM "club" "T1" JOIN "player" "T2" ON "Right Wing" = "T2"."position" AND "T1"."club_id" = "T2"."club_id"
0.121094
CREATE TABLE table_name_43 (score VARCHAR2, championship VARCHAR2, surface VARCHAR2, outcome VARCHAR2)
what is the score when the surface is carpet (i) outcome is winner and the championship is rotterdam, netherlands?
SELECT score FROM table_name_43 WHERE surface = "carpet (i)" AND outcome = "winner" AND championship = "rotterdam, netherlands"
SELECT "score" FROM "table_name_43" WHERE "carpet (i)" = "surface" AND "championship" = "rotterdam, netherlands" AND "outcome" = "winner"
0.133789
CREATE TABLE table_5077 ("Game" FLOAT, "October" FLOAT, "Opponent" CLOB, "Score" CLOB, "Record" CLOB)
Record of 3-3-1 had what lowest game?
SELECT MIN("Game") FROM table_5077 WHERE "Record" = '3-3-1'
SELECT MIN("Game") FROM "table_5077" WHERE "Record" = '3-3-1'
0.05957
CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime 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 treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME)
during the last hospital encounter, had patient 006-40255 had any allergies?
SELECT COUNT(*) > 0 FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-40255' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1))
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '006-40255' AND NOT "patient"."hospitaldischargetime" IS NULL GROUP BY "patienthealthsystemstayid" ORDER BY "patient"."hospitaladmittime" DESC FETCH FIRST 1 ROWS ONLY), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) > 0 FROM "allergy" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "allergy"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL
0.589844
CREATE TABLE table_4951 ("Driver" CLOB, "Seasons" CLOB, "Entries" FLOAT, "Poles" FLOAT, "Percentage" CLOB)
Which season has a percentage of 13.56%?
SELECT "Seasons" FROM table_4951 WHERE "Percentage" = '13.56%'
SELECT "Seasons" FROM "table_4951" WHERE "Percentage" = '13.56%'
0.0625
CREATE TABLE table_58187 ("Name" CLOB, "Years" CLOB, "Area" CLOB, "Authority" CLOB, "Decile" CLOB, "Roll" FLOAT)
Which school has a state authority and a roll of 318?
SELECT "Name" FROM table_58187 WHERE "Authority" = 'state' AND "Roll" = '318'
SELECT "Name" FROM "table_58187" WHERE "Authority" = 'state' AND "Roll" = '318'
0.077148
CREATE TABLE table_59114 ("Benalla DFL" CLOB, "Wins" FLOAT, "Losses" FLOAT, "Draws" FLOAT, "Byes" FLOAT, "Against" FLOAT)
What's the most number of byes for Longwood having less than 1944 against?
SELECT MAX("Byes") FROM table_59114 WHERE "Benalla DFL" = 'longwood' AND "Against" < '1944'
SELECT MAX("Byes") FROM "table_59114" WHERE "Against" < '1944' AND "Benalla DFL" = 'longwood'
0.09082
CREATE TABLE table_204_664 (id NUMBER, "rank" NUMBER, "bib" NUMBER, "name" CLOB, "nationality" CLOB, "start" CLOB, "penalties ( p+p+s+s ) " CLOB, "time" CLOB, "deficit" CLOB)
what is the number of russian participants ?
SELECT COUNT(*) FROM table_204_664 WHERE "nationality" = 'russia'
SELECT COUNT(*) FROM "table_204_664" WHERE "nationality" = 'russia'
0.06543
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
among patients who had a hospital stay of more than 17 days, how many of them were from hispanic or latino ethnic origin?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND demographic.days_stay > "17"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "17" < "demographic"."days_stay" AND "HISPANIC OR LATINO" = "demographic"."ethnicity"
0.15625
CREATE TABLE Drama_Workshop_Groups (Workshop_Group_ID NUMBER, Address_ID NUMBER, Currency_Code CHAR, Marketing_Region_Code CHAR, Store_Name VARCHAR2, Store_Phone VARCHAR2, Store_Email_Address VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Invoice_Items (Invoice_Item_ID NUMBER, Invoice_ID NUMBER, Order_ID NUMBER, Order_Item_ID NUMBER, Product_ID NUMBER, Order_Quantity NUMBER, Other_Item_Details VARCHAR2) CREATE TABLE Addresses (Address_ID VARCHAR2, Line_1 VARCHAR2, Line_2 VARCHAR2, City_Town VARCHAR2, State_County VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Performers (Performer_ID NUMBER, Address_ID NUMBER, Customer_Name VARCHAR2, Customer_Phone VARCHAR2, Customer_Email_Address VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Clients (Client_ID NUMBER, Address_ID NUMBER, Customer_Email_Address VARCHAR2, Customer_Name VARCHAR2, Customer_Phone VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Bookings (Booking_ID NUMBER, Customer_ID NUMBER, Workshop_Group_ID VARCHAR2, Status_Code CHAR, Store_ID NUMBER, Order_Date DATETIME, Planned_Delivery_Date DATETIME, Actual_Delivery_Date DATETIME, Other_Order_Details VARCHAR2) CREATE TABLE Services (Service_ID NUMBER, Service_Type_Code CHAR, Workshop_Group_ID NUMBER, Product_Description VARCHAR2, Product_Name VARCHAR2, Product_Price NUMBER, Other_Product_Service_Details VARCHAR2) CREATE TABLE Ref_Payment_Methods (payment_method_code CHAR, payment_method_description VARCHAR2) CREATE TABLE Invoices (Invoice_ID NUMBER, Order_ID NUMBER, payment_method_code CHAR, Product_ID NUMBER, Order_Quantity VARCHAR2, Other_Item_Details VARCHAR2, Order_Item_ID NUMBER) CREATE TABLE Bookings_Services (Order_ID NUMBER, Product_ID NUMBER) CREATE TABLE Customers (Customer_ID VARCHAR2, Address_ID NUMBER, Customer_Name VARCHAR2, Customer_Phone VARCHAR2, Customer_Email_Address VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Order_Items (Order_Item_ID NUMBER, Order_ID NUMBER, Product_ID NUMBER, Order_Quantity VARCHAR2, Other_Item_Details VARCHAR2) CREATE TABLE Performers_in_Bookings (Order_ID NUMBER, Performer_ID NUMBER) CREATE TABLE Marketing_Regions (Marketing_Region_Code CHAR, Marketing_Region_Name VARCHAR2, Marketing_Region_Descriptrion VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Stores (Store_ID VARCHAR2, Address_ID NUMBER, Marketing_Region_Code CHAR, Store_Name VARCHAR2, Store_Phone VARCHAR2, Store_Email_Address VARCHAR2, Other_Details VARCHAR2) CREATE TABLE Customer_Orders (Order_ID NUMBER, Customer_ID NUMBER, Store_ID NUMBER, Order_Date DATETIME, Planned_Delivery_Date DATETIME, Actual_Delivery_Date DATETIME, Other_Order_Details VARCHAR2) CREATE TABLE Products (Product_ID VARCHAR2, Product_Name VARCHAR2, Product_Price NUMBER, Product_Description VARCHAR2, Other_Product_Service_Details VARCHAR2) CREATE TABLE Ref_Service_Types (Service_Type_Code CHAR, Parent_Service_Type_Code CHAR, Service_Type_Description VARCHAR2)
List the distinct payment method codes with the number of orders mad Show bar chart, display by the total number from high to low please.
SELECT payment_method_code, COUNT(*) FROM Invoices GROUP BY payment_method_code ORDER BY COUNT(*) DESC
SELECT "payment_method_code", COUNT(*) FROM "Invoices" GROUP BY "payment_method_code" ORDER BY COUNT(*) DESC
0.105469
CREATE TABLE table_32778 ("Driver" CLOB, "Team" CLOB, "Laps" FLOAT, "Time/Retired" CLOB, "Grid" FLOAT, "Points" FLOAT)
What Grid has Driver Cristiano da Matta?
SELECT "Grid" FROM table_32778 WHERE "Driver" = 'cristiano da matta'
SELECT "Grid" FROM "table_32778" WHERE "Driver" = 'cristiano da matta'
0.068359
CREATE TABLE basketball_match (Team_ID NUMBER, School_ID NUMBER, Team_Name CLOB, ACC_Regular_Season CLOB, ACC_Percent CLOB, ACC_Home CLOB, ACC_Road CLOB, All_Games CLOB, All_Games_Percent NUMBER, All_Home CLOB, All_Road CLOB, All_Neutral CLOB) CREATE TABLE university (School_ID NUMBER, School CLOB, Location CLOB, Founded FLOAT, Affiliation CLOB, Enrollment FLOAT, Nickname CLOB, Primary_conference CLOB)
Draw a bar chart about the distribution of All_Road and School_ID , sort y axis in descending order.
SELECT All_Road, School_ID FROM basketball_match ORDER BY School_ID DESC
SELECT "All_Road", "School_ID" FROM "basketball_match" ORDER BY "School_ID" DESC
0.078125
CREATE TABLE table_name_34 (to_par VARCHAR2, country VARCHAR2, score VARCHAR2)
What's the to par for england when the score is less than 71?
SELECT to_par FROM table_name_34 WHERE country = "england" AND score < 71
SELECT "to_par" FROM "table_name_34" WHERE "country" = "england" AND "score" < 71
0.079102
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
How many male patients use the drug milrbase?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "M" AND prescriptions.formulary_drug_cd = "MILRBASE"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "MILRBASE" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "M" = "demographic"."gender"
0.226563
CREATE TABLE table_63520 ("Year" FLOAT, "Home Team" CLOB, "Away Team" CLOB, "Winner" CLOB, "Score" CLOB)
what is the score when the away team is rivercity rage?
SELECT "Score" FROM table_63520 WHERE "Away Team" = 'rivercity rage'
SELECT "Score" FROM "table_63520" WHERE "Away Team" = 'rivercity rage'
0.068359
CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) 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 CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB)
what was patient 24547's first arterial catheterization procedure time during a year before?
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'arterial catheterization') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24547) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY procedures_icd.charttime LIMIT 1
WITH "_u_1" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 24547 GROUP BY "hadm_id") SELECT "procedures_icd"."charttime" FROM "procedures_icd" JOIN "d_icd_procedures" ON "d_icd_procedures"."icd9_code" = "procedures_icd"."icd9_code" AND "d_icd_procedures"."short_title" = 'arterial catheterization' LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "procedures_icd"."hadm_id" WHERE DATETIME("procedures_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_1"."" IS NULL ORDER BY "procedures_icd"."charttime" FETCH FIRST 1 ROWS ONLY
0.592773
CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER) CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT)
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and price , and group by attribute name, show Y-axis from low to high order.
SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Price
SELECT "T1"."Name", "T1"."Price" FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T1"."Name", "T1"."Name" ORDER BY "T1"."Price"
0.167969
CREATE TABLE table_17675 ("Character" CLOB, "Portrayed by" CLOB, "Main cast seasons" CLOB, "Recurring cast seasons" CLOB, "# of episodes" FLOAT)
Kevin lucas appears in which seasons?
SELECT "Recurring cast seasons" FROM table_17675 WHERE "Character" = 'Kevin Lucas'
SELECT "Recurring cast seasons" FROM "table_17675" WHERE "Character" = 'Kevin Lucas'
0.082031
CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER) CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT)
Find the number of products for each manufacturer, showing the name of each company. Show bar chart.
SELECT T2.Name, COUNT(*) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name
SELECT "T2"."Name", COUNT(*) FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T2"."Name"
0.129883
CREATE TABLE mission (Mission_ID NUMBER, Ship_ID NUMBER, Code CLOB, Launched_Year NUMBER, Location CLOB, Speed_knots NUMBER, Fate CLOB) CREATE TABLE ship (Ship_ID NUMBER, Name CLOB, Type CLOB, Nationality CLOB, Tonnage NUMBER)
For each type, what is the average tonnage.
SELECT Type, AVG(Tonnage) FROM ship GROUP BY Type
SELECT "Type", AVG("Tonnage") FROM "ship" GROUP BY "Type"
0.055664
CREATE TABLE table_68491 ("Date" CLOB, "Venue" CLOB, "Score" CLOB, "Result" CLOB, "Competition" CLOB)
Which date has a competition type of British home championship?
SELECT "Date" FROM table_68491 WHERE "Competition" = 'british home championship'
SELECT "Date" FROM "table_68491" WHERE "Competition" = 'british home championship'
0.080078
CREATE TABLE table_73217 ("Starting price" CLOB, "Number" FLOAT, "Name" CLOB, "Age" FLOAT, "Weight ( st , lb ) " CLOB, "Jockey" CLOB, "Trainer" CLOB, "Owner" CLOB, "Colours" CLOB)
How many age entries had a weight of 10-7 and an owner of Double Octagon Partnership?
SELECT COUNT("Age") FROM table_73217 WHERE "Weight (st, lb)" = '10-7' AND "Owner" = 'Double Octagon Partnership'
SELECT COUNT("Age") FROM "table_73217" WHERE "Owner" = 'Double Octagon Partnership' AND "Weight (st, lb)" = '10-7'
0.111328
CREATE TABLE View_Unit_Status (apt_id NUMBER, apt_booking_id NUMBER, status_date DATETIME, available_yn BIT) CREATE TABLE Apartment_Facilities (apt_id NUMBER, facility_code CHAR) CREATE TABLE Guests (guest_id NUMBER, gender_code CHAR, guest_first_name VARCHAR2, guest_last_name VARCHAR2, date_of_birth DATETIME) CREATE TABLE Apartments (apt_id NUMBER, building_id NUMBER, apt_type_code CHAR, apt_number CHAR, bathroom_count NUMBER, bedroom_count NUMBER, room_count CHAR) CREATE TABLE Apartment_Buildings (building_id NUMBER, building_short_name CHAR, building_full_name VARCHAR2, building_description VARCHAR2, building_address VARCHAR2, building_manager VARCHAR2, building_phone VARCHAR2) CREATE TABLE Apartment_Bookings (apt_booking_id NUMBER, apt_id NUMBER, guest_id NUMBER, booking_status_code CHAR, booking_start_date DATETIME, booking_end_date DATETIME)
Give me a bar chart for room_count of each apt number, and order from low to high by the apt_number.
SELECT apt_number, room_count FROM Apartments ORDER BY apt_number
SELECT "apt_number", "room_count" FROM "Apartments" ORDER BY "apt_number"
0.071289
CREATE TABLE table_name_57 (country VARCHAR2, to_par VARCHAR2)
What country has a +3 to par?
SELECT country FROM table_name_57 WHERE to_par = "+3"
SELECT "country" FROM "table_name_57" WHERE "+3" = "to_par"
0.057617
CREATE TABLE table_2187333_1 (wins NUMBER)
Name the least wins
SELECT MIN(wins) FROM table_2187333_1
SELECT MIN("wins") FROM "table_2187333_1"
0.040039
CREATE TABLE table_1740431_3 (english_translation VARCHAR2, tamil_months VARCHAR2)
What is every English translation when Tamil months is M rkazhi, Tai?
SELECT english_translation FROM table_1740431_3 WHERE tamil_months = "mārkazhi, tai"
SELECT "english_translation" FROM "table_1740431_3" WHERE "mārkazhi, tai" = "tamil_months"
0.087891
CREATE TABLE table_38925 ("Date" CLOB, "Opponent" CLOB, "Score" CLOB, "Loss" CLOB, "Save" CLOB)
Which Save is on June 15?
SELECT "Save" FROM table_38925 WHERE "Date" = 'june 15'
SELECT "Save" FROM "table_38925" WHERE "Date" = 'june 15'
0.055664
CREATE TABLE table_1108394_6 (staten_island VARCHAR2, brooklyn VARCHAR2)
What was Staten Island when Brooklyn was 940?
SELECT staten_island FROM table_1108394_6 WHERE brooklyn = "940"
SELECT "staten_island" FROM "table_1108394_6" WHERE "940" = "brooklyn"
0.068359
CREATE TABLE table_29753 ("Game" FLOAT, "Date" CLOB, "Team" CLOB, "Score" CLOB, "High points" CLOB, "High rebounds" CLOB, "High assists" CLOB, "Location Attendance" CLOB, "Record" CLOB)
What game number was played on april 8?
SELECT MIN("Game") FROM table_29753 WHERE "Date" = 'April 8'
SELECT MIN("Game") FROM "table_29753" WHERE "Date" = 'April 8'
0.060547
CREATE TABLE table_78403 ("Date" CLOB, "Venue" CLOB, "Score" CLOB, "Result" CLOB, "Competition" CLOB)
WHat was the result of the friendly match that was played on october 8, 2012?
SELECT "Result" FROM table_78403 WHERE "Competition" = 'friendly match' AND "Date" = 'october 8, 2012'
SELECT "Result" FROM "table_78403" WHERE "Competition" = 'friendly match' AND "Date" = 'october 8, 2012'
0.101563
CREATE TABLE table_203_778 (id NUMBER, "representative" CLOB, "title" CLOB, "presentation\ of credentials" CLOB, "termination\ of mission" CLOB, "appointed by" CLOB)
who is the only ambassadors to honduras appointed by barack obama ?
SELECT "representative" FROM table_203_778 WHERE "appointed by" = 'barack obama'
SELECT "representative" FROM "table_203_778" WHERE "appointed by" = 'barack obama'
0.080078
CREATE TABLE table_name_48 (date VARCHAR2, time VARCHAR2)
What date has 2:48 as the time?
SELECT date FROM table_name_48 WHERE time = "2:48"
SELECT "date" FROM "table_name_48" WHERE "2:48" = "time"
0.054688
CREATE TABLE code_description (code VARCHAR2, description CLOB) CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER) CREATE TABLE class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB) CREATE TABLE ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER) CREATE TABLE flight_stop (flight_id NUMBER, stop_number NUMBER, stop_days CLOB, stop_airport CLOB, arrival_time NUMBER, arrival_airline CLOB, arrival_flight_number NUMBER, departure_time NUMBER, departure_airline CLOB, departure_flight_number NUMBER, stop_time NUMBER) CREATE TABLE airport (airport_code VARCHAR2, airport_name CLOB, airport_location CLOB, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2, minimum_connect_time NUMBER) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2) CREATE TABLE aircraft (aircraft_code VARCHAR2, aircraft_description VARCHAR2, manufacturer VARCHAR2, basic_type VARCHAR2, engines NUMBER, propulsion VARCHAR2, wide_body VARCHAR2, wing_span NUMBER, length NUMBER, weight NUMBER, capacity NUMBER, pay_load NUMBER, cruising_speed NUMBER, range_miles NUMBER, pressurized VARCHAR2) CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB) CREATE TABLE restriction (restriction_code CLOB, advance_purchase NUMBER, stopovers CLOB, saturday_stay_required CLOB, minimum_stay NUMBER, maximum_stay NUMBER, application CLOB, no_discounts CLOB) CREATE TABLE city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2) CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER) CREATE TABLE flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER) CREATE TABLE days (days_code VARCHAR2, day_name VARCHAR2) CREATE TABLE month (month_number NUMBER, month_name CLOB) CREATE TABLE flight (aircraft_code_sequence CLOB, airline_code VARCHAR2, airline_flight CLOB, arrival_time NUMBER, connections NUMBER, departure_time NUMBER, dual_carrier CLOB, flight_days CLOB, flight_id NUMBER, flight_number NUMBER, from_airport VARCHAR2, meal_code CLOB, stops NUMBER, time_elapsed NUMBER, to_airport VARCHAR2) CREATE TABLE airline (airline_code VARCHAR2, airline_name CLOB, note CLOB) CREATE TABLE fare_basis (fare_basis_code CLOB, booking_class CLOB, class_type CLOB, premium CLOB, economy CLOB, discounted CLOB, night CLOB, season CLOB, basis_days CLOB) CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2) CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2) CREATE TABLE dual_carrier (main_airline VARCHAR2, low_flight_number NUMBER, high_flight_number NUMBER, dual_airline VARCHAR2, service_name CLOB) CREATE TABLE time_interval (period CLOB, begin_time NUMBER, end_time NUMBER) CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2) CREATE TABLE fare (fare_id NUMBER, from_airport VARCHAR2, to_airport VARCHAR2, fare_basis_code CLOB, fare_airline CLOB, restriction_code CLOB, one_direction_cost NUMBER, round_trip_cost NUMBER, round_trip_required VARCHAR2) CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER)
get flights from MILWAUKEE to DTW
SELECT DISTINCT flight.flight_id FROM airport, airport_service, city, flight WHERE airport.airport_code = 'DTW' AND city.city_code = airport_service.city_code AND city.city_name = 'MILWAUKEE' AND flight.from_airport = airport_service.airport_code AND flight.to_airport = airport.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport" JOIN "flight" ON "airport"."airport_code" = "flight"."to_airport" JOIN "airport_service" ON "airport_service"."airport_code" = "flight"."from_airport" JOIN "city" ON "airport_service"."city_code" = "city"."city_code" AND "city"."city_name" = 'MILWAUKEE' WHERE "airport"."airport_code" = 'DTW'
0.335938
CREATE TABLE table_name_47 (dob VARCHAR2, surname VARCHAR2, first VARCHAR2)
When was Lachlan Dale born?
SELECT dob FROM table_name_47 WHERE surname = "dale" AND first = "lachlan"
SELECT "dob" FROM "table_name_47" WHERE "dale" = "surname" AND "first" = "lachlan"
0.080078
CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2) CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE course_tags_count (course_id NUMBER, clear_grading NUMBER, pop_quiz NUMBER, group_projects NUMBER, inspirational NUMBER, long_lectures NUMBER, extra_credit NUMBER, few_tests NUMBER, good_feedback NUMBER, tough_tests NUMBER, heavy_papers NUMBER, cares_for_students NUMBER, heavy_assignments NUMBER, respected NUMBER, participation NUMBER, heavy_reading NUMBER, tough_grader NUMBER, hilarious NUMBER, would_take_again NUMBER, good_lecture NUMBER, no_skip NUMBER) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE course (course_id NUMBER, name VARCHAR2, department VARCHAR2, number VARCHAR2, credits VARCHAR2, advisory_requirement VARCHAR2, enforced_requirement VARCHAR2, description VARCHAR2, num_semesters NUMBER, num_enrolled NUMBER, has_discussion VARCHAR2, has_lab VARCHAR2, has_projects VARCHAR2, has_exams VARCHAR2, num_reviews NUMBER, clarity_score NUMBER, easiness_score NUMBER, helpfulness_score NUMBER) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE course_offering (offering_id NUMBER, course_id NUMBER, semester NUMBER, section_number NUMBER, start_time TIME, end_time TIME, monday VARCHAR2, tuesday VARCHAR2, wednesday VARCHAR2, thursday VARCHAR2, friday VARCHAR2, saturday VARCHAR2, sunday VARCHAR2, has_final_project VARCHAR2, has_final_exam VARCHAR2, textbook VARCHAR2, class_address VARCHAR2, allow_audit VARCHAR2) CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2)
Does 216 usually provide 2 or 3 lectures a week ?
SELECT DISTINCT course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday, semester.semester, semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 216 AND semester.semester_id = course_offering.semester ORDER BY semester.semester_id DESC LIMIT 10
SELECT DISTINCT "course_offering"."friday", "course_offering"."monday", "course_offering"."saturday", "course_offering"."sunday", "course_offering"."thursday", "course_offering"."tuesday", "course_offering"."wednesday", "semester"."semester", "semester"."year" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" WHERE "course"."department" = 'EECS' AND "course"."number" = 216 ORDER BY "semester"."semester_id" DESC FETCH FIRST 10 ROWS ONLY
0.543945
CREATE TABLE table_2215159_2 (outcome VARCHAR2, year VARCHAR2, surface VARCHAR2, partner VARCHAR2)
How many outcomes were there for matches played with Chuck McKinley on grass in 1962?
SELECT COUNT(outcome) FROM table_2215159_2 WHERE surface = "Grass" AND partner = "Chuck McKinley" AND year = 1962
SELECT COUNT("outcome") FROM "table_2215159_2" WHERE "Chuck McKinley" = "partner" AND "Grass" = "surface" AND "year" = 1962
0.120117
CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2) CREATE TABLE course_offering (offering_id NUMBER, course_id NUMBER, semester NUMBER, section_number NUMBER, start_time TIME, end_time TIME, monday VARCHAR2, tuesday VARCHAR2, wednesday VARCHAR2, thursday VARCHAR2, friday VARCHAR2, saturday VARCHAR2, sunday VARCHAR2, has_final_project VARCHAR2, has_final_exam VARCHAR2, textbook VARCHAR2, class_address VARCHAR2, allow_audit VARCHAR2) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE course_tags_count (course_id NUMBER, clear_grading NUMBER, pop_quiz NUMBER, group_projects NUMBER, inspirational NUMBER, long_lectures NUMBER, extra_credit NUMBER, few_tests NUMBER, good_feedback NUMBER, tough_tests NUMBER, heavy_papers NUMBER, cares_for_students NUMBER, heavy_assignments NUMBER, respected NUMBER, participation NUMBER, heavy_reading NUMBER, tough_grader NUMBER, hilarious NUMBER, would_take_again NUMBER, good_lecture NUMBER, no_skip NUMBER) CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) CREATE TABLE course (course_id NUMBER, name VARCHAR2, department VARCHAR2, number VARCHAR2, credits VARCHAR2, advisory_requirement VARCHAR2, enforced_requirement VARCHAR2, description VARCHAR2, num_semesters NUMBER, num_enrolled NUMBER, has_discussion VARCHAR2, has_lab VARCHAR2, has_projects VARCHAR2, has_exams VARCHAR2, num_reviews NUMBER, clarity_score NUMBER, easiness_score NUMBER, helpfulness_score NUMBER) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER)
Who are the people that have taught STDABRD 381 in the past ?
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'STDABRD' AND course.number = 381 AND NOT (semester.semester = 'WN' AND semester.year = 2016)
SELECT DISTINCT "instructor"."name" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "offering_instructor" ON "course_offering"."offering_id" = "offering_instructor"."offering_id" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND ("semester"."semester" <> 'WN' OR "semester"."year" <> 2016) JOIN "instructor" ON "instructor"."instructor_id" = "offering_instructor"."instructor_id" WHERE "course"."department" = 'STDABRD' AND "course"."number" = 381
0.513672
CREATE TABLE table_15618241_1 (purse___us NUMBER, year VARCHAR2)
Name the least purse for 2011
SELECT MIN(purse___us) AS $__ FROM table_15618241_1 WHERE year = 2011
SELECT MIN("purse___us") AS "$__" FROM "table_15618241_1" WHERE "year" = 2011
0.075195
CREATE TABLE table_name_16 (home_team VARCHAR2)
What was Fitzroy's score when they were the home team?
SELECT home_team AS score FROM table_name_16 WHERE home_team = "fitzroy"
SELECT "home_team" AS "score" FROM "table_name_16" WHERE "fitzroy" = "home_team"
0.078125
CREATE TABLE table_10598 ("Name" CLOB, "Latitude" FLOAT, "Longitude" FLOAT, "Diameter ( km ) " FLOAT, "Named after" CLOB)
What is the namesake of Ayashe at a longitude less than 270.7, latitude more than -47.1, and a diameter less than 7.2?
SELECT "Named after" FROM table_10598 WHERE "Longitude" < '270.7' AND "Latitude" > '-47.1' AND "Diameter (km)" < '7.2' AND "Name" = 'ayashe'
SELECT "Named after" FROM "table_10598" WHERE "Diameter (km)" < '7.2' AND "Latitude" > '-47.1' AND "Longitude" < '270.7' AND "Name" = 'ayashe'
0.138672
CREATE TABLE table_11206787_5 (highest NUMBER, team VARCHAR2)
What is the highest of ayr united?
SELECT MIN(highest) FROM table_11206787_5 WHERE team = "Ayr United"
SELECT MIN("highest") FROM "table_11206787_5" WHERE "Ayr United" = "team"
0.071289
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB)
count the number of patients whose admission year is less than 2166 and procedure long title is exteriorization of small intestine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2166" AND procedures.long_title = "Exteriorization of small intestine"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Exteriorization of small intestine" = "procedures"."long_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "2166" > "demographic"."admityear"
0.242188
CREATE TABLE table_20593 ("Western Title" CLOB, "Chinese Title" CLOB, "Pinyin" CLOB, "Released Date" CLOB, "Genre" CLOB, "Game Modes" CLOB)
What is the released date for Super Mario 64 DS?
SELECT "Released Date" FROM table_20593 WHERE "Western Title" = 'Super Mario 64 DS'
SELECT "Released Date" FROM "table_20593" WHERE "Western Title" = 'Super Mario 64 DS'
0.083008
CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) 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 CLOB, Description CLOB) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) 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 CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB)
tag answer count (2014 - today).
SELECT t.TagName, t.Count AS tagCount, SUM(q.AnswerCount) AS answCnt FROM Posts AS q INNER JOIN Posts AS a ON q.AcceptedAnswerId = a.Id INNER JOIN PostTags AS pt ON pt.PostId = q.Id INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE q.Id != a.Id AND q.OwnerUserId != a.OwnerUserId AND q.CreationDate >= '2014-01-01' AND q.PostTypeId = 1 AND a.PostTypeId = 2 GROUP BY t.TagName, t.Count ORDER BY answCnt DESC
SELECT "t"."TagName", "t"."Count" AS "tagCount", SUM("q"."AnswerCount") AS "answCnt" FROM "Posts" "q" JOIN "Posts" "a" ON "a"."Id" <> "q"."Id" AND "a"."Id" = "q"."AcceptedAnswerId" AND "a"."OwnerUserId" <> "q"."OwnerUserId" AND "a"."PostTypeId" = 2 JOIN "PostTags" "pt" ON "pt"."PostId" = "q"."Id" JOIN "Tags" "t" ON "pt"."TagId" = "t"."Id" WHERE "q"."CreationDate" >= '2014-01-01' AND "q"."PostTypeId" = 1 GROUP BY "t"."TagName", "t"."Count" ORDER BY "answCnt" DESC
0.455078
CREATE TABLE table_train_251 ("id" NUMBER, "gender" CLOB, "left_ventricular_ejection_fraction_lvef" NUMBER, "allergy_to_rabbit_proteins" BOOLEAN, "recurring_alcohol_related_legal_problem" BOOLEAN, "hyperlipidemia" BOOLEAN, "fasting_ldl_cholesterol" NUMBER, "baseline_hemoglobin_hgb" FLOAT, "NOUSE" FLOAT)
recurring alcohol _ related legal problem
SELECT * FROM table_train_251 WHERE recurring_alcohol_related_legal_problem = 1
SELECT * FROM "table_train_251" WHERE "recurring_alcohol_related_legal_problem" = 1
0.081055
CREATE TABLE table_name_22 (position VARCHAR2, pts_agst VARCHAR2, pts_for VARCHAR2)
Pts Agst of 572, and a Pts For larger than 346 has what total number of position?
SELECT COUNT(position) FROM table_name_22 WHERE pts_agst = 572 AND pts_for > 346
SELECT COUNT("position") FROM "table_name_22" WHERE "pts_agst" = 572 AND "pts_for" > 346
0.085938
CREATE TABLE table_name_5 (location VARCHAR2, entered_service VARCHAR2, customer VARCHAR2)
What location entered service in 1999 and had a customer of Anadarko?
SELECT location FROM table_name_5 WHERE entered_service = "1999" AND customer = "anadarko"
SELECT "location" FROM "table_name_5" WHERE "1999" = "entered_service" AND "anadarko" = "customer"
0.095703
CREATE TABLE table_28102 ("Selection" FLOAT, "Month" CLOB, "Season" CLOB, "Team record" CLOB, "Points per game" CLOB, "Field goal percentage" CLOB, "Rebounds per game" CLOB, "Blocks per game" CLOB)
What were the points per game in the selection where the rebounds per game were 15.0?
SELECT "Points per game" FROM table_28102 WHERE "Rebounds per game" = '15.0'
SELECT "Points per game" FROM "table_28102" WHERE "Rebounds per game" = '15.0'
0.076172
CREATE TABLE table_name_55 (Id VARCHAR2)
What is the 2009 value in the 2011 Grand Slam Tournaments?
SELECT 2009 FROM table_name_55 WHERE 2011 = "grand slam tournaments"
SELECT 2009 FROM "table_name_55" WHERE "grand slam tournaments" = 2011
0.068359
CREATE TABLE table_name_93 (player VARCHAR2, total VARCHAR2, country VARCHAR2)
What player from South Africa had a total less than 284?
SELECT player FROM table_name_93 WHERE total < 284 AND country = "south africa"
SELECT "player" FROM "table_name_93" WHERE "country" = "south africa" AND "total" < 284
0.084961
CREATE TABLE table_75423 ("Year" FLOAT, "Event" CLOB, "Venue" CLOB, "Driver" CLOB, "Result" CLOB, "Category" CLOB, "Report" CLOB)
When did Hans Hartmann drive?
SELECT COUNT("Year") FROM table_75423 WHERE "Driver" = 'hans hartmann'
SELECT COUNT("Year") FROM "table_75423" WHERE "Driver" = 'hans hartmann'
0.070313
CREATE TABLE table_name_95 (original_title VARCHAR2, year VARCHAR2, country VARCHAR2)
What is the original title of the film from Japan/Taiwan before 2003?
SELECT original_title FROM table_name_95 WHERE year < 2003 AND country = "japan/taiwan"
SELECT "original_title" FROM "table_name_95" WHERE "country" = "japan/taiwan" AND "year" < 2003
0.092773
CREATE TABLE table_60078 ("Team 1" CLOB, "Agg." CLOB, "Team 2" CLOB, "1st leg" CLOB, "2nd leg" CLOB)
What is the team 1 with tikve as team 2?
SELECT "Team 1" FROM table_60078 WHERE "Team 2" = 'tikveš'
SELECT "Team 1" FROM "table_60078" WHERE "Team 2" = 'tikveš'
0.058594
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
how many patients are born before 2109 and diagnosed with mitral/aortic val insuff?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2109" AND diagnoses.short_title = "Mitral/aortic val insuff"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Mitral/aortic val insuff" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "2109" > "demographic"."dob_year"
0.229492
CREATE TABLE table_name_60 (tournament VARCHAR2)
What shows for 2004 when 2005 is A, 2006 is A, tournament is US Open?
SELECT 2004 FROM table_name_60 WHERE 2005 = "a" AND 2006 = "a" AND tournament = "us open"
SELECT 2004 FROM "table_name_60" WHERE "a" = 2005 AND "a" = 2006 AND "tournament" = "us open"
0.09082
CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
what is procedure icd9 code and procedure long title of subject id 813?
SELECT procedures.icd9_code, procedures.long_title FROM procedures WHERE procedures.subject_id = "813"
SELECT "procedures"."icd9_code", "procedures"."long_title" FROM "procedures" WHERE "813" = "procedures"."subject_id"
0.113281
CREATE TABLE Courses (course_id NUMBER, author_id NUMBER, subject_id NUMBER, course_name VARCHAR2, course_description VARCHAR2) CREATE TABLE Student_Tests_Taken (registration_id NUMBER, date_test_taken DATETIME, test_result VARCHAR2) CREATE TABLE Subjects (subject_id NUMBER, subject_name VARCHAR2) CREATE TABLE Student_Course_Enrolment (registration_id NUMBER, student_id NUMBER, course_id NUMBER, date_of_enrolment DATETIME, date_of_completion DATETIME) CREATE TABLE Students (student_id NUMBER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR2, password VARCHAR2, personal_name VARCHAR2, middle_name VARCHAR2, family_name VARCHAR2) CREATE TABLE Course_Authors_and_Tutors (author_id NUMBER, author_tutor_ATB VARCHAR2, login_name VARCHAR2, password VARCHAR2, personal_name VARCHAR2, middle_name VARCHAR2, family_name VARCHAR2, gender_mf VARCHAR2, address_line_1 VARCHAR2)
List the number of enrolment students in each month and bin date of enrolment by month interval with a bar chart, list y axis in desc order.
SELECT date_of_enrolment, COUNT(date_of_enrolment) FROM Student_Course_Enrolment ORDER BY COUNT(date_of_enrolment) DESC
SELECT "date_of_enrolment", COUNT("date_of_enrolment") FROM "Student_Course_Enrolment" ORDER BY COUNT("date_of_enrolment") DESC
0.124023
CREATE TABLE table_name_25 (game NUMBER, location VARCHAR2)
What game number was the first game played at the Summit this season?
SELECT MIN(game) FROM table_name_25 WHERE location = "the summit"
SELECT MIN("game") FROM "table_name_25" WHERE "location" = "the summit"
0.069336
CREATE TABLE table_20036882_2 (winning_pilot VARCHAR2, country VARCHAR2)
Name the winning pilot for hungary
SELECT winning_pilot FROM table_20036882_2 WHERE country = "Hungary"
SELECT "winning_pilot" FROM "table_20036882_2" WHERE "Hungary" = "country"
0.072266
CREATE TABLE table_train_56 ("id" NUMBER, "organ_transplantation" BOOLEAN, "severe_sepsis" BOOLEAN, "immune_suppression" BOOLEAN, "autoimmune_disease" BOOLEAN, "hematopoietic" BOOLEAN, "chronic_infectious" BOOLEAN, "steroid_therapy" BOOLEAN, "sepsis" BOOLEAN, "systemic_inflammatory_response" BOOLEAN, "organ_failure" BOOLEAN, "septic_shock" BOOLEAN, "age" FLOAT, "NOUSE" FLOAT)
patients receiving long term treatment with steroids or other immunosuppressive agents
SELECT * FROM table_train_56 WHERE steroid_therapy = 1 OR immune_suppression = 1
SELECT * FROM "table_train_56" WHERE "immune_suppression" = 1 OR "steroid_therapy" = 1
0.083984
CREATE TABLE table_name_57 (tied VARCHAR2, span VARCHAR2, win__percentage VARCHAR2)
How many games were Tied during the Span of 2011 2013 with a less than 80% Win %?
SELECT COUNT(tied) FROM table_name_57 WHERE span = "2011–2013" AND win__percentage < 80
SELECT COUNT("tied") FROM "table_name_57" WHERE "2011–2013" = "span" AND "win__percentage" < 80
0.092773
CREATE TABLE DEPARTMENT (DEPT_CODE VARCHAR2, DEPT_NAME VARCHAR2, SCHOOL_CODE VARCHAR2, EMP_NUM NUMBER, DEPT_ADDRESS VARCHAR2, DEPT_EXTENSION VARCHAR2) CREATE TABLE STUDENT (STU_NUM NUMBER, STU_LNAME VARCHAR2, STU_FNAME VARCHAR2, STU_INIT VARCHAR2, STU_DOB DATETIME, STU_HRS NUMBER, STU_CLASS VARCHAR2, STU_GPA FLOAT, STU_TRANSFER NUMBER, DEPT_CODE VARCHAR2, STU_PHONE VARCHAR2, PROF_NUM NUMBER) CREATE TABLE ENROLL (CLASS_CODE VARCHAR2, STU_NUM NUMBER, ENROLL_GRADE VARCHAR2) CREATE TABLE COURSE (CRS_CODE VARCHAR2, DEPT_CODE VARCHAR2, CRS_DESCRIPTION VARCHAR2, CRS_CREDIT FLOAT) CREATE TABLE CLASS (CLASS_CODE VARCHAR2, CRS_CODE VARCHAR2, CLASS_SECTION VARCHAR2, CLASS_TIME VARCHAR2, CLASS_ROOM VARCHAR2, PROF_NUM NUMBER) CREATE TABLE PROFESSOR (EMP_NUM NUMBER, DEPT_CODE VARCHAR2, PROF_OFFICE VARCHAR2, PROF_EXTENSION VARCHAR2, PROF_HIGH_DEGREE VARCHAR2) CREATE TABLE EMPLOYEE (EMP_NUM NUMBER, EMP_LNAME VARCHAR2, EMP_FNAME VARCHAR2, EMP_INITIAL VARCHAR2, EMP_JOBCODE VARCHAR2, EMP_HIREDATE DATETIME, EMP_DOB DATETIME)
Which departments have the top 3 highest number of students? Show the department name and number of students with a bar chart.
SELECT DEPT_NAME, COUNT(*) FROM STUDENT AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.DEPT_CODE ORDER BY COUNT(*) DESC LIMIT 3
SELECT "DEPT_NAME", COUNT(*) FROM "STUDENT" "T1" JOIN "DEPARTMENT" "T2" ON "T1"."DEPT_CODE" = "T2"."DEPT_CODE" GROUP BY "T1"."DEPT_CODE" ORDER BY COUNT(*) DESC FETCH FIRST 3 ROWS ONLY
0.178711
CREATE TABLE table_name_70 (earnings___ NUMBER, wins NUMBER)
How many earnings have Wins larger than 3?
SELECT SUM(earnings___) AS $__ FROM table_name_70 WHERE wins > 3
SELECT SUM("earnings___") AS "$__" FROM "table_name_70" WHERE "wins" > 3
0.070313
CREATE TABLE table_67290 ("Date" CLOB, "Opponent" CLOB, "Score" CLOB, "Loss" CLOB, "Record" CLOB)
What was the game of the game against the White Sox with a record of 81-48?
SELECT "Date" FROM table_67290 WHERE "Opponent" = 'white sox' AND "Record" = '81-48'
SELECT "Date" FROM "table_67290" WHERE "Opponent" = 'white sox' AND "Record" = '81-48'
0.083984
CREATE TABLE table_3155 ("Tie no" FLOAT, "Home team" CLOB, "Score 1" CLOB, "Away team" CLOB, "Attendance" FLOAT, "Date" CLOB)
When the away team is Millwall, what is the total possible amount of tie numbers?
SELECT COUNT("Tie no") FROM table_3155 WHERE "Away team" = 'Millwall'
SELECT COUNT("Tie no") FROM "table_3155" WHERE "Away team" = 'Millwall'
0.069336
CREATE TABLE workshop (workshop_id NUMBER, date CLOB, venue CLOB, name CLOB) CREATE TABLE submission (submission_id NUMBER, scores NUMBER, author CLOB, college CLOB) CREATE TABLE acceptance (submission_id NUMBER, workshop_id NUMBER, result CLOB)
Show the authors who have submissions to more than one workshop.
SELECT T2.author FROM acceptance AS T1 JOIN submission AS T2 ON T1.submission_id = T2.submission_id GROUP BY T2.author HAVING COUNT(DISTINCT T1.workshop_id) > 1
SELECT "T2"."author" FROM "acceptance" "T1" JOIN "submission" "T2" ON "T1"."submission_id" = "T2"."submission_id" GROUP BY "T2"."author" HAVING COUNT(DISTINCT "T1"."workshop_id") > 1
0.177734
CREATE TABLE train (Train_ID NUMBER, Name CLOB, Time CLOB, Service CLOB) CREATE TABLE train_station (Train_ID NUMBER, Station_ID NUMBER) CREATE TABLE station (Station_ID NUMBER, Name CLOB, Annual_entry_exit FLOAT, Annual_interchanges FLOAT, Total_Passengers FLOAT, Location CLOB, Main_Services CLOB, Number_of_Platforms NUMBER)
Bar chart of total number of number of platforms from each location, sort bars from high to low order.
SELECT Location, SUM(Number_of_Platforms) FROM station GROUP BY Location ORDER BY Location DESC
SELECT "Location", SUM("Number_of_Platforms") FROM "station" GROUP BY "Location" ORDER BY "Location" DESC
0.102539
CREATE TABLE table_34234 ("Season" CLOB, "Order" CLOB, "Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Penalties" FLOAT, "Points For" FLOAT, "Points Against" FLOAT, "Points Diff" FLOAT, "Coach" CLOB)
What is the highest drawn for points over 545?
SELECT MAX("Drawn") FROM table_34234 WHERE "Points For" > '545'
SELECT MAX("Drawn") FROM "table_34234" WHERE "Points For" > '545'
0.063477
CREATE TABLE table_8529 ("Position" FLOAT, "Name" CLOB, "Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Points" FLOAT)
What is the name of the player that lost more than 4?
SELECT "Name" FROM table_8529 WHERE "Lost" > '4'
SELECT "Name" FROM "table_8529" WHERE "Lost" > '4'
0.048828
CREATE TABLE table_name_26 (first_elected NUMBER, incumbent VARCHAR2)
What is the earliest first elected date of incumbent howard mckeon?
SELECT MIN(first_elected) FROM table_name_26 WHERE incumbent = "howard mckeon"
SELECT MIN("first_elected") FROM "table_name_26" WHERE "howard mckeon" = "incumbent"
0.082031
CREATE TABLE table_24481478_1 (week NUMBER, team_record VARCHAR2)
In which week was the team record 7 2?
SELECT MIN(week) FROM table_24481478_1 WHERE team_record = "7–2"
SELECT MIN("week") FROM "table_24481478_1" WHERE "7–2" = "team_record"
0.068359
CREATE TABLE table_name_93 (country VARCHAR2, notes VARCHAR2, release_title VARCHAR2)
Which country had a release of 1 VCD titled Martial Law: Substitutes?
SELECT country FROM table_name_93 WHERE notes = "1 vcd" AND release_title = "martial law: substitutes"
SELECT "country" FROM "table_name_93" WHERE "1 vcd" = "notes" AND "martial law: substitutes" = "release_title"
0.107422
CREATE TABLE table_10663 ("Year" FLOAT, "Main colour ( s ) " CLOB, "Additional colour ( s ) " CLOB, "Livery" CLOB, "Additional major sponsor ( s ) " CLOB)
What are the additional major sponsors which correspond to the additional color black and a year 1984?
SELECT "Additional major sponsor(s)" FROM table_10663 WHERE "Additional colour(s)" = 'black' AND "Year" = '1984'
SELECT "Additional major sponsor(s)" FROM "table_10663" WHERE "Additional colour(s)" = 'black' AND "Year" = '1984'
0.111328
CREATE TABLE table_47918 ("Team" CLOB, "Outgoing manager" CLOB, "Manner of departure" CLOB, "Date of vacancy" CLOB, "Replaced by" CLOB, "Date of appointment" CLOB, "Position in table" CLOB)
Who is the outgoing manager who was replaced by j rgen klopp?
SELECT "Outgoing manager" FROM table_47918 WHERE "Replaced by" = 'jürgen klopp'
SELECT "Outgoing manager" FROM "table_47918" WHERE "Replaced by" = 'jürgen klopp'
0.079102
CREATE TABLE table_11803648_21 (club_team VARCHAR2, player VARCHAR2)
What club team did JArrod Maidens play for?
SELECT club_team FROM table_11803648_21 WHERE player = "Jarrod Maidens"
SELECT "club_team" FROM "table_11803648_21" WHERE "Jarrod Maidens" = "player"
0.075195
CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, 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 CLOB) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) 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 CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB)
calculate the number of times patient 21074 received the vitamin b12 test test until 6 months ago.
SELECT COUNT(*) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'vitamin b12') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 21074) AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-6 month')
WITH "_u_0" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'vitamin b12' GROUP BY "itemid"), "_u_1" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 21074 GROUP BY "hadm_id") SELECT COUNT(*) FROM "labevents" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "labevents"."itemid" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "labevents"."hadm_id" WHERE DATETIME("labevents"."charttime") <= DATETIME(CURRENT_TIME(), '-6 month') AND NOT "_u_0"."" IS NULL AND NOT "_u_1"."" IS NULL
0.517578
CREATE TABLE table_name_12 (engine VARCHAR2, transmission VARCHAR2, acceleration_0_100km_h__0_62mph_ VARCHAR2)
What is the engine when the transmission was 4-speed automatic, and acceleration 0 100km/h (0 62mph) was 10.4 s?
SELECT engine FROM table_name_12 WHERE transmission = "4-speed automatic" AND acceleration_0_100km_h__0_62mph_ = "10.4 s"
SELECT "engine" FROM "table_name_12" WHERE "10.4 s" = "acceleration_0_100km_h__0_62mph_" AND "4-speed automatic" = "transmission"
0.125977
CREATE TABLE table_203_590 (id NUMBER, "date" CLOB, "venue" CLOB, "opponents" CLOB, "score" CLOB, "competition" CLOB, "scotland scorer ( s ) " CLOB)
scotland played their first match of the 1951 british home championship against which team ?
SELECT "opponents" FROM table_203_590 WHERE "date" = 1951 ORDER BY "date" LIMIT 1
SELECT "opponents" FROM "table_203_590" WHERE "date" = 1951 ORDER BY "date" FETCH FIRST 1 ROWS ONLY
0.09668
CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime 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 treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB)
is patient 005-76770's respiration ever greater since 463 days ago than 4.0?
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-76770')) AND vitalperiodic.respiration > 4.0 AND NOT vitalperiodic.respiration IS NULL AND DATETIME(vitalperiodic.observationtime) >= DATETIME(CURRENT_TIME(), '-463 day')
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '005-76770' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) > 0 FROM "vitalperiodic" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE "vitalperiodic"."respiration" > 4.0 AND DATETIME("vitalperiodic"."observationtime") >= DATETIME(CURRENT_TIME(), '-463 day') AND NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."respiration" IS NULL
0.65625
CREATE TABLE table_1334 ("Week #" CLOB, "Theme" CLOB, "Song choice" CLOB, "Original artist" CLOB, "Order #" CLOB, "Result" CLOB)
Who is the original artist for the theme 'Year they were born?
SELECT "Original artist" FROM table_1334 WHERE "Theme" = 'Year They Were Born'
SELECT "Original artist" FROM "table_1334" WHERE "Theme" = 'Year They Were Born'
0.078125
CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2) CREATE TABLE course (course_id NUMBER, name VARCHAR2, department VARCHAR2, number VARCHAR2, credits VARCHAR2, advisory_requirement VARCHAR2, enforced_requirement VARCHAR2, description VARCHAR2, num_semesters NUMBER, num_enrolled NUMBER, has_discussion VARCHAR2, has_lab VARCHAR2, has_projects VARCHAR2, has_exams VARCHAR2, num_reviews NUMBER, clarity_score NUMBER, easiness_score NUMBER, helpfulness_score NUMBER) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE course_tags_count (course_id NUMBER, clear_grading NUMBER, pop_quiz NUMBER, group_projects NUMBER, inspirational NUMBER, long_lectures NUMBER, extra_credit NUMBER, few_tests NUMBER, good_feedback NUMBER, tough_tests NUMBER, heavy_papers NUMBER, cares_for_students NUMBER, heavy_assignments NUMBER, respected NUMBER, participation NUMBER, heavy_reading NUMBER, tough_grader NUMBER, hilarious NUMBER, would_take_again NUMBER, good_lecture NUMBER, no_skip NUMBER) CREATE TABLE course_offering (offering_id NUMBER, course_id NUMBER, semester NUMBER, section_number NUMBER, start_time TIME, end_time TIME, monday VARCHAR2, tuesday VARCHAR2, wednesday VARCHAR2, thursday VARCHAR2, friday VARCHAR2, saturday VARCHAR2, sunday VARCHAR2, has_final_project VARCHAR2, has_final_exam VARCHAR2, textbook VARCHAR2, class_address VARCHAR2, allow_audit VARCHAR2) CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2)
Is CONDUCT 407 offered right now ?
SELECT COUNT(*) > 0 FROM course, course_offering, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'CONDUCT' AND course.number = 407 AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016
SELECT COUNT(*) > 0 FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "offering_instructor" ON "course_offering"."offering_id" = "offering_instructor"."offering_id" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" = 'WN' AND "semester"."year" = 2016 WHERE "course"."department" = 'CONDUCT' AND "course"."number" = 407
0.407227
CREATE TABLE table_name_47 (crowd NUMBER, venue VARCHAR2)
How big is the Venue of Brunswick Street Oval?
SELECT SUM(crowd) FROM table_name_47 WHERE venue = "brunswick street oval"
SELECT SUM("crowd") FROM "table_name_47" WHERE "brunswick street oval" = "venue"
0.078125
CREATE TABLE CLASS (CLASS_CODE VARCHAR2, CRS_CODE VARCHAR2, CLASS_SECTION VARCHAR2, CLASS_TIME VARCHAR2, CLASS_ROOM VARCHAR2, PROF_NUM NUMBER) CREATE TABLE PROFESSOR (EMP_NUM NUMBER, DEPT_CODE VARCHAR2, PROF_OFFICE VARCHAR2, PROF_EXTENSION VARCHAR2, PROF_HIGH_DEGREE VARCHAR2) CREATE TABLE STUDENT (STU_NUM NUMBER, STU_LNAME VARCHAR2, STU_FNAME VARCHAR2, STU_INIT VARCHAR2, STU_DOB DATETIME, STU_HRS NUMBER, STU_CLASS VARCHAR2, STU_GPA FLOAT, STU_TRANSFER NUMBER, DEPT_CODE VARCHAR2, STU_PHONE VARCHAR2, PROF_NUM NUMBER) CREATE TABLE ENROLL (CLASS_CODE VARCHAR2, STU_NUM NUMBER, ENROLL_GRADE VARCHAR2) CREATE TABLE DEPARTMENT (DEPT_CODE VARCHAR2, DEPT_NAME VARCHAR2, SCHOOL_CODE VARCHAR2, EMP_NUM NUMBER, DEPT_ADDRESS VARCHAR2, DEPT_EXTENSION VARCHAR2) CREATE TABLE COURSE (CRS_CODE VARCHAR2, DEPT_CODE VARCHAR2, CRS_DESCRIPTION VARCHAR2, CRS_CREDIT FLOAT) CREATE TABLE EMPLOYEE (EMP_NUM NUMBER, EMP_LNAME VARCHAR2, EMP_FNAME VARCHAR2, EMP_INITIAL VARCHAR2, EMP_JOBCODE VARCHAR2, EMP_HIREDATE DATETIME, EMP_DOB DATETIME)
Compute the total minimal stu gpa across dept code as a pie chart.
SELECT DEPT_CODE, MIN(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE
SELECT "DEPT_CODE", MIN("STU_GPA") FROM "STUDENT" GROUP BY "DEPT_CODE"
0.068359
CREATE TABLE course_offering (offering_id NUMBER, course_id NUMBER, semester NUMBER, section_number NUMBER, start_time TIME, end_time TIME, monday VARCHAR2, tuesday VARCHAR2, wednesday VARCHAR2, thursday VARCHAR2, friday VARCHAR2, saturday VARCHAR2, sunday VARCHAR2, has_final_project VARCHAR2, has_final_exam VARCHAR2, textbook VARCHAR2, class_address VARCHAR2, allow_audit VARCHAR2) CREATE TABLE course (course_id NUMBER, name VARCHAR2, department VARCHAR2, number VARCHAR2, credits VARCHAR2, advisory_requirement VARCHAR2, enforced_requirement VARCHAR2, description VARCHAR2, num_semesters NUMBER, num_enrolled NUMBER, has_discussion VARCHAR2, has_lab VARCHAR2, has_projects VARCHAR2, has_exams VARCHAR2, num_reviews NUMBER, clarity_score NUMBER, easiness_score NUMBER, helpfulness_score NUMBER) CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE course_tags_count (course_id NUMBER, clear_grading NUMBER, pop_quiz NUMBER, group_projects NUMBER, inspirational NUMBER, long_lectures NUMBER, extra_credit NUMBER, few_tests NUMBER, good_feedback NUMBER, tough_tests NUMBER, heavy_papers NUMBER, cares_for_students NUMBER, heavy_assignments NUMBER, respected NUMBER, participation NUMBER, heavy_reading NUMBER, tough_grader NUMBER, hilarious NUMBER, would_take_again NUMBER, good_lecture NUMBER, no_skip NUMBER) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2) CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2)
What number of credits do I get for 425 ?
SELECT DISTINCT credits FROM course WHERE department = 'EECS' AND number = 425
SELECT DISTINCT "credits" FROM "course" WHERE "department" = 'EECS' AND "number" = 425
0.083984
CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) 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 CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME)
Posts with the most images. Posts containing images, sorted by the number of images.
SELECT Id AS "post_link", LENGTH(Body) - LENGTH(REPLACE(Body, '<img ', '<img')) AS "images", Score, CASE PostTypeId WHEN 1 THEN 'Q' WHEN 2 THEN 'A' ELSE '?' END AS "type", Body FROM Posts WHERE Body LIKE '%<img %' ORDER BY Images DESC
SELECT "Id" AS "post_link", LENGTH("Body") - LENGTH(REPLACE("Body", '<img ', '<img')) AS "images", "Score", CASE WHEN "PostTypeId" = 1 THEN 'Q' WHEN "PostTypeId" = 2 THEN 'A' ELSE '?' END AS "type", "Body" FROM "Posts" WHERE "Body" LIKE '%<img %' ORDER BY "Images" DESC
0.262695