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 record (ID NUMBER, Result CLOB, Swimmer_ID NUMBER, Event_ID NUMBER)
CREATE TABLE stadium (ID NUMBER, name CLOB, Capacity NUMBER, City CLOB, Country CLOB, Opening_year NUMBER)
CREATE TABLE swimmer (ID NUMBER, name CLOB, Nationality CLOB, meter_100 FLOAT, meter_200 CLOB, meter_300 CLOB, meter_400 CLOB, meter_500 CLOB, meter_600 CLOB, meter_700 CLOB, Time CLOB)
CREATE TABLE event (ID NUMBER, Name CLOB, Stadium_ID NUMBER, Year CLOB)
| Visualize a bar chart about the distribution of Time and meter_100 . | SELECT Time, meter_100 FROM swimmer | SELECT "Time", "meter_100" FROM "swimmer" | 0.040039 |
CREATE TABLE table_name_57 (Id VARCHAR2)
| What 1976 has a 1978 of grand slam tournaments? | SELECT 1976 FROM table_name_57 WHERE 1978 = "grand slam tournaments" | SELECT 1976 FROM "table_name_57" WHERE "grand slam tournaments" = 1978 | 0.068359 |
CREATE TABLE actor (Actor_ID NUMBER, Name CLOB, Musical_ID NUMBER, Character CLOB, Duration CLOB, age NUMBER)
CREATE TABLE musical (Musical_ID NUMBER, Name CLOB, Year NUMBER, Award CLOB, Category CLOB, Nominee CLOB, Result CLOB)
| Calculate the number of actors in each duration of actors using a bar chart, could you list X-axis in desc order please? | SELECT Duration, COUNT(Duration) FROM actor GROUP BY Duration ORDER BY Duration DESC | SELECT "Duration", COUNT("Duration") FROM "actor" GROUP BY "Duration" ORDER BY "Duration" DESC | 0.091797 |
CREATE TABLE table_46350 ("Year" FLOAT, "Round" CLOB, "Opponent" CLOB, "Result" CLOB, "BSU Head Coach" CLOB)
| What is the result after 1993 of the first four rounds? | SELECT "Result" FROM table_46350 WHERE "Year" > '1993' AND "Round" = 'first four' | SELECT "Result" FROM "table_46350" WHERE "Round" = 'first four' AND "Year" > '1993' | 0.081055 |
CREATE TABLE files (f_id NUMBER, artist_name VARCHAR2, file_size VARCHAR2, duration VARCHAR2, formats VARCHAR2)
CREATE TABLE artist (artist_name VARCHAR2, country VARCHAR2, gender VARCHAR2, preferred_genre VARCHAR2)
CREATE TABLE song (song_name VARCHAR2, artist_name VARCHAR2, country VARCHAR2, f_id NUMBER, genre_is VARCHAR2, rating NUMBER, languages VARCHAR2, releasedate DATE, resolution NUMBER)
CREATE TABLE genre (g_name VARCHAR2, rating VARCHAR2, most_popular_in VARCHAR2)
| How many the artists who produced the top three highly rated songs of each country? Show the result using a bar chart. | SELECT T1.country, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T1.country ORDER BY T2.rating DESC LIMIT 3 | SELECT "T1"."country", "T1"."country" FROM "artist" "T1" JOIN "song" "T2" ON "T1"."artist_name" = "T2"."artist_name" GROUP BY "T1"."country" ORDER BY "T2"."rating" DESC FETCH FIRST 3 ROWS ONLY | 0.1875 |
CREATE TABLE Documents_with_Expenses (Document_ID NUMBER, Budget_Type_Code CHAR, Document_Details VARCHAR2)
CREATE TABLE Projects (Project_ID NUMBER, Project_Details VARCHAR2)
CREATE TABLE Documents (Document_ID NUMBER, Document_Type_Code CHAR, Project_ID NUMBER, Document_Date DATETIME, Document_Name VARCHAR2, Document_Description VARCHAR2, Other_Details VARCHAR2)
CREATE TABLE Accounts (Account_ID NUMBER, Statement_ID NUMBER, Account_Details VARCHAR2)
CREATE TABLE Statements (Statement_ID NUMBER, Statement_Details VARCHAR2)
CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR2, Document_Type_Description VARCHAR2)
CREATE TABLE Ref_Budget_Codes (Budget_Type_Code CHAR, Budget_Type_Description VARCHAR2)
| How many documents are created in each day? Bin the document date by weekday and group by document type with a stacked bar chart. | SELECT Document_Date, COUNT(Document_Date) FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code GROUP BY Document_Type_Name | SELECT "Document_Date", COUNT("Document_Date") FROM "Ref_Document_Types" "T1" JOIN "Documents" "T2" ON "T1"."Document_Type_Code" = "T2"."Document_Type_Code" GROUP BY "Document_Type_Name" | 0.181641 |
CREATE TABLE table_name_68 (pairing VARCHAR2, binomial VARCHAR2)
| Binomial of (1) has what pairing? | SELECT pairing FROM table_name_68 WHERE binomial = "θ(1)" | SELECT "pairing" FROM "table_name_68" WHERE "binomial" = "θ(1)" | 0.061523 |
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
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 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)
| provide the number of patients whose admission year is less than 2200 and procedure long title is endoscopic removal of stone(s) from biliary tract? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2200" AND procedures.long_title = "Endoscopic removal of stone(s) from biliary tract" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Endoscopic removal of stone(s) from biliary tract" = "procedures"."long_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "2200" > "demographic"."admityear" | 0.256836 |
CREATE TABLE table_47245 ("Name" CLOB, "Club" CLOB, "Date of departure" CLOB, "Replacement" CLOB, "Date of appointment" CLOB)
| On what date was Paulo Sousa appointed? | SELECT "Date of appointment" FROM table_47245 WHERE "Replacement" = 'paulo sousa' | SELECT "Date of appointment" FROM "table_47245" WHERE "Replacement" = 'paulo sousa' | 0.081055 |
CREATE TABLE table_41362 ("Region" CLOB, "Date" CLOB, "Label" CLOB, "Format" CLOB, "Catalog" CLOB)
| What region has a 2002 date, and a Catalog dos 195? | SELECT "Region" FROM table_41362 WHERE "Date" = '2002' AND "Catalog" = 'dos 195' | SELECT "Region" FROM "table_41362" WHERE "Catalog" = 'dos 195' AND "Date" = '2002' | 0.080078 |
CREATE TABLE table_60470 ("English name" CLOB, "Thai name" CLOB, "Abbr." CLOB, "Transcription" CLOB, "Sanskrit word" CLOB, "Zodiac sign" CLOB)
| What is the Thai name for the word abbreviated . .? | SELECT "Thai name" FROM table_60470 WHERE "Abbr." = 'มี.ค.' | SELECT "Thai name" FROM "table_60470" WHERE "Abbr." = 'มี.ค.' | 0.05957 |
CREATE TABLE table_name_97 (against NUMBER, played NUMBER)
| How many games were played against when the team played more than 22 total? | SELECT SUM(against) FROM table_name_97 WHERE played > 22 | SELECT SUM("against") FROM "table_name_97" WHERE "played" > 22 | 0.060547 |
CREATE TABLE table_name_92 (report VARCHAR2, status VARCHAR2, against VARCHAR2)
| What report has tour match as the status, with an against less than 22? | SELECT report FROM table_name_92 WHERE status = "tour match" AND against < 22 | SELECT "report" FROM "table_name_92" WHERE "against" < 22 AND "status" = "tour match" | 0.083008 |
CREATE TABLE table_6127 ("Name" CLOB, "Born \\u2013 Died" CLOB, "Notable for" CLOB, "Connection with Australia" CLOB, "Connection with America" CLOB)
| The person that was born in Sydney died in what year? | SELECT "Born \u2013 Died" FROM table_6127 WHERE "Connection with Australia" = 'born in sydney' | SELECT "Born \u2013 Died" FROM "table_6127" WHERE "Connection with Australia" = 'born in sydney' | 0.09375 |
CREATE TABLE table_3095 ("Season" CLOB, "Series" CLOB, "Team" CLOB, "Races" FLOAT, "Wins" FLOAT, "Poles" FLOAT, "F/Laps" FLOAT, "Podiums" FLOAT, "Points" CLOB, "Position" CLOB)
| Name the least wins | SELECT MIN("Wins") FROM table_3095 | SELECT MIN("Wins") FROM "table_3095" | 0.035156 |
CREATE TABLE table_9109 ("Position" FLOAT, "Played" FLOAT, "Points" FLOAT, "Wins" FLOAT, "Draws" FLOAT, "Losses" FLOAT, "Goals for" FLOAT, "Goals against" FLOAT, "Goal Difference" FLOAT)
| What is the lowest position with a -22 goal difference and more than 5 points? | SELECT MIN("Position") FROM table_9109 WHERE "Goal Difference" = '-22' AND "Points" > '5' | SELECT MIN("Position") FROM "table_9109" WHERE "Goal Difference" = '-22' AND "Points" > '5' | 0.088867 |
CREATE TABLE table_24347 ("Team #1" CLOB, "Agg. score" CLOB, "Team #2" CLOB, "1st leg" CLOB, "2nd leg" CLOB)
| which team#2 played against poseidon neoi porroi | SELECT "Team #2" FROM table_24347 WHERE "Team #1" = 'Poseidon Neoi Porroi' | SELECT "Team #2" FROM "table_24347" WHERE "Team #1" = 'Poseidon Neoi Porroi' | 0.074219 |
CREATE TABLE table_name_76 (draw NUMBER, english_translation VARCHAR2)
| For the English translation Someone Like You, what is the lowest draw? | SELECT MIN(draw) FROM table_name_76 WHERE english_translation = "someone like you" | SELECT MIN("draw") FROM "table_name_76" WHERE "english_translation" = "someone like you" | 0.085938 |
CREATE TABLE table_53120 ("Pick" FLOAT, "Player" CLOB, "Country of origin*" CLOB, "PBA team" CLOB, "College" CLOB)
| What college did pick 33 attend? | SELECT "College" FROM table_53120 WHERE "Pick" = '33' | SELECT "College" FROM "table_53120" WHERE "Pick" = '33' | 0.053711 |
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 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)
| how many patients whose primary disease is pituitary bleed and year of birth is less than 2056? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "PITUITARY BLEED" AND demographic.dob_year < "2056" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2056" > "demographic"."dob_year" AND "PITUITARY BLEED" = "demographic"."diagnosis" | 0.154297 |
CREATE TABLE table_29902 ("Game" FLOAT, "Date" CLOB, "Team" CLOB, "Score" CLOB, "High points" CLOB, "High rebounds" CLOB, "High assists" CLOB, "Location Attendance" CLOB, "Record" CLOB)
| How many times was the high rebounds by marcus camby (18)? | SELECT COUNT("Date") FROM table_29902 WHERE "High rebounds" = 'Marcus Camby (18)' | SELECT COUNT("Date") FROM "table_29902" WHERE "High rebounds" = 'Marcus Camby (18)' | 0.081055 |
CREATE TABLE table_3153 ("Tie no" FLOAT, "Home team" CLOB, "Score 1" CLOB, "Away team" CLOB, "Attendance" FLOAT, "Date" CLOB)
| Who was the home team when the away team was fulham? | SELECT "Home team" FROM table_3153 WHERE "Away team" = 'Fulham' | SELECT "Home team" FROM "table_3153" WHERE "Away team" = 'Fulham' | 0.063477 |
CREATE TABLE table_name_67 (high_points VARCHAR2, record VARCHAR2)
| Which High points have a Record of 27 29? | SELECT high_points FROM table_name_67 WHERE record = "27–29" | SELECT "high_points" FROM "table_name_67" WHERE "27–29" = "record" | 0.064453 |
CREATE TABLE table_name_73 (score VARCHAR2, player VARCHAR2)
| What is the score for Darren Clarke? | SELECT score FROM table_name_73 WHERE player = "darren clarke" | SELECT "score" FROM "table_name_73" WHERE "darren clarke" = "player" | 0.066406 |
CREATE TABLE table_6530 ("Week" FLOAT, "Date" CLOB, "Opponent" CLOB, "Result" CLOB, "Record" CLOB, "Game Site" CLOB, "Attendance" FLOAT)
| Result of w 24 21, and a Week smaller than 6 had what sum of attendance? | SELECT SUM("Attendance") FROM table_6530 WHERE "Result" = 'w 24–21' AND "Week" < '6' | SELECT SUM("Attendance") FROM "table_6530" WHERE "Result" = 'w 24–21' AND "Week" < '6' | 0.083984 |
CREATE TABLE table_48153 ("!Simple Present/Future" CLOB, "Probable Future" CLOB, "Simple Past" CLOB, "Past Habitual" CLOB, "Injunctive" CLOB, "Imperative" CLOB)
| What is the injunctive for the Simple Past of gar l 'I will (probably) do'? | SELECT "Injunctive" FROM table_48153 WHERE "Simple Past" = 'गरुँला garũlā ''i will (probably) do' | SELECT "Injunctive" FROM "table_48153" WHERE "Simple Past" = 'गरुँला garũlā ''i will (probably) do' | 0.09668 |
CREATE TABLE table_name_37 (record VARCHAR2, location VARCHAR2)
| What was the record after the game at the Astrodome? | SELECT record FROM table_name_37 WHERE location = "astrodome" | SELECT "record" FROM "table_name_37" WHERE "astrodome" = "location" | 0.06543 |
CREATE TABLE table_name_95 (final_position___tour VARCHAR2, year VARCHAR2, final_position___giro VARCHAR2, rider VARCHAR2)
| What is the number of final position-tours Mariano Piccoli, who has more than 20 final position-giros, before 1999 has? | SELECT COUNT(final_position___tour) FROM table_name_95 WHERE final_position___giro > 20 AND rider = "mariano piccoli" AND year < 1999 | SELECT COUNT("final_position___tour") FROM "table_name_95" WHERE "final_position___giro" > 20 AND "mariano piccoli" = "rider" AND "year" < 1999 | 0.139648 |
CREATE TABLE table_203_203 (id NUMBER, "year" NUMBER, "majors" NUMBER, "atp wins" NUMBER, "total wins" NUMBER, "earnings ( us$ ) " NUMBER, "money list rank" NUMBER)
| what is the most us $ mario an č i ć has earned in the atp tour in one year ? | SELECT MAX("earnings (us$)") FROM table_203_203 | SELECT MAX("earnings (us$)") FROM "table_203_203" | 0.047852 |
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 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)
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title 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)
| provide me the number of patients admitted before the year 2114 who were hospitalized for more than 26 days. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.days_stay > "26" AND demographic.admityear < "2114" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2114" > "demographic"."admityear" AND "26" < "demographic"."days_stay" | 0.142578 |
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 flight_leg (flight_id NUMBER, leg_number NUMBER, leg_flight NUMBER)
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 city (city_code VARCHAR2, city_name VARCHAR2, state_code VARCHAR2, country_name VARCHAR2, time_zone_code VARCHAR2)
CREATE TABLE date_day (month_number NUMBER, day_number NUMBER, year NUMBER, day_name VARCHAR2)
CREATE TABLE compartment_class (compartment VARCHAR2, class_type VARCHAR2)
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 class_of_service (booking_class VARCHAR2, rank NUMBER, class_description CLOB)
CREATE TABLE state (state_code CLOB, state_name CLOB, country_name CLOB)
CREATE TABLE airport_service (city_code VARCHAR2, airport_code VARCHAR2, miles_distant NUMBER, direction VARCHAR2, minutes_distant NUMBER)
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 ground_service (city_code CLOB, airport_code CLOB, transport_type CLOB, ground_fare NUMBER)
CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR2, aircraft_code VARCHAR2)
CREATE TABLE month (month_number NUMBER, month_name CLOB)
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 code_description (code VARCHAR2, description CLOB)
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 airline (airline_code VARCHAR2, airline_name CLOB, note CLOB)
CREATE TABLE food_service (meal_code CLOB, meal_number NUMBER, compartment CLOB, meal_description VARCHAR2)
CREATE TABLE time_zone (time_zone_code CLOB, time_zone_name CLOB, hours_from_gmt NUMBER)
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 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 days (days_code VARCHAR2, day_name VARCHAR2)
CREATE TABLE flight_fare (flight_id NUMBER, fare_id NUMBER)
| what ground transportation is available from the PITTSBURGH airport to downtown and how much does it cost | SELECT DISTINCT ground_service.ground_fare, ground_service.transport_type FROM airport, airport_service, city AS CITY_0, city AS CITY_1, ground_service WHERE airport.airport_code = airport_service.airport_code AND CITY_0.city_code = airport_service.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_name = 'PITTSBURGH' AND ground_service.airport_code = airport.airport_code AND ground_service.city_code = CITY_1.city_code | SELECT DISTINCT "ground_service"."ground_fare", "ground_service"."transport_type" FROM "airport" JOIN "airport_service" ON "airport"."airport_code" = "airport_service"."airport_code" JOIN "ground_service" ON "airport"."airport_code" = "ground_service"."airport_code" JOIN "city" "CITY_0" ON "CITY_0"."city_code" = "airport_service"."city_code" AND "CITY_0"."city_name" = 'PITTSBURGH' JOIN "city" "CITY_1" ON "CITY_1"."city_code" = "ground_service"."city_code" AND "CITY_1"."city_name" = 'PITTSBURGH' | 0.487305 |
CREATE TABLE table_204_536 (id NUMBER, "event" CLOB, "bowling center" CLOB, "city" CLOB, "dates" CLOB, "winner" CLOB)
| what is the total number of events held during november ? | SELECT COUNT("event") FROM table_204_536 WHERE "dates" = 11 | SELECT COUNT("event") FROM "table_204_536" WHERE "dates" = 11 | 0.05957 |
CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER)
CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME)
CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime 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 lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime 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 treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME)
CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME)
CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME)
| what is the drug that patient 010-8740 was allergic to when they came to the hospital last time? | SELECT allergy.drugname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-8740' 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" = '010-8740' 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 "allergy"."drugname" FROM "allergy" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "allergy"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL | 0.59668 |
CREATE TABLE table_19537 ("Pick #" FLOAT, "Player" CLOB, "Position" CLOB, "Nationality" CLOB, "NHL team" CLOB, "College/junior/club team" CLOB)
| What nhl team does stan weir play for? | SELECT "NHL team" FROM table_19537 WHERE "Player" = 'Stan Weir' | SELECT "NHL team" FROM "table_19537" WHERE "Player" = 'Stan Weir' | 0.063477 |
CREATE TABLE table_50620 ("Outcome" CLOB, "Date" CLOB, "Tournament" CLOB, "Surface" CLOB, "Partnering" CLOB, "Opponent in the final" CLOB, "Score" CLOB)
| What tournament is on 18 May 1992? | SELECT "Tournament" FROM table_50620 WHERE "Date" = '18 may 1992' | SELECT "Tournament" FROM "table_50620" WHERE "Date" = '18 may 1992' | 0.06543 |
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 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)
| what is the number of patients on iv bolus route of drug administration who are diagnosed with pressure ulcer of hip? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Pressure ulcer, hip" AND prescriptions.route = "IV BOLUS" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Pressure ulcer, hip" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "prescriptions" ON "IV BOLUS" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" | 0.298828 |
CREATE TABLE table_10038 ("Team" CLOB, "Match" FLOAT, "Points" FLOAT, "Draw" FLOAT, "Lost" FLOAT)
| What is the number of points when the match is smaller than 14? | SELECT COUNT("Points") FROM table_10038 WHERE "Match" < '14' | SELECT COUNT("Points") FROM "table_10038" WHERE "Match" < '14' | 0.060547 |
CREATE TABLE table_15719 ("Year" FLOAT, "Entrant" CLOB, "Chassis" CLOB, "Engine" CLOB, "Points" FLOAT)
| What is the number of points when there was a BMW 269 F2 chassis earlier than 1969? | SELECT COUNT("Points") FROM table_15719 WHERE "Chassis" = 'bmw 269 f2' AND "Year" < '1969' | SELECT COUNT("Points") FROM "table_15719" WHERE "Chassis" = 'bmw 269 f2' AND "Year" < '1969' | 0.089844 |
CREATE TABLE table_15796 ("Tournament" CLOB, "2006" CLOB, "2007" CLOB, "2008" CLOB, "2009" CLOB, "2010" CLOB, "2011" CLOB, "2012" CLOB)
| Name the 2006 when the 2010 is 27 | SELECT "2006" FROM table_15796 WHERE "2010" = '27' | SELECT "2006" FROM "table_15796" WHERE "2010" = '27' | 0.050781 |
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid 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 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)
| How many patients insured by the government had a lab test done for the O2 flow? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Government" AND lab.label = "O2 Flow" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "O2 Flow" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "Government" = "demographic"."insurance" | 0.196289 |
CREATE TABLE locations (LOCATION_ID NUMBER, STREET_ADDRESS VARCHAR2, POSTAL_CODE VARCHAR2, CITY VARCHAR2, STATE_PROVINCE VARCHAR2, COUNTRY_ID VARCHAR2)
CREATE TABLE countries (COUNTRY_ID VARCHAR2, COUNTRY_NAME VARCHAR2, REGION_ID NUMBER)
CREATE TABLE employees (EMPLOYEE_ID NUMBER, FIRST_NAME VARCHAR2, LAST_NAME VARCHAR2, EMAIL VARCHAR2, PHONE_NUMBER VARCHAR2, HIRE_DATE DATE, JOB_ID VARCHAR2, SALARY NUMBER, COMMISSION_PCT NUMBER, MANAGER_ID NUMBER, DEPARTMENT_ID NUMBER)
CREATE TABLE job_history (EMPLOYEE_ID NUMBER, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR2, DEPARTMENT_ID NUMBER)
CREATE TABLE regions (REGION_ID NUMBER, REGION_NAME VARCHAR2)
CREATE TABLE departments (DEPARTMENT_ID NUMBER, DEPARTMENT_NAME VARCHAR2, MANAGER_ID NUMBER, LOCATION_ID NUMBER)
CREATE TABLE jobs (JOB_ID VARCHAR2, JOB_TITLE VARCHAR2, MIN_SALARY NUMBER, MAX_SALARY NUMBER)
| For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about commission_pct over the phone_number . | SELECT PHONE_NUMBER, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) | SELECT "PHONE_NUMBER", "COMMISSION_PCT" FROM "employees" WHERE NOT "DEPARTMENT_ID" IN (SELECT "DEPARTMENT_ID" FROM "departments" WHERE "MANAGER_ID" <= 200 AND "MANAGER_ID" >= 100) | 0.174805 |
CREATE TABLE table_30107 ("Player" CLOB, "Matches" FLOAT, "Innings" FLOAT, "Runs" FLOAT, "Average" CLOB, "Highest score" CLOB, "100s" FLOAT, "50s" FLOAT)
| How few runs does the 97.00 average have? | SELECT MIN("Runs") FROM table_30107 WHERE "Average" = '97.00' | SELECT MIN("Runs") FROM "table_30107" WHERE "Average" = '97.00' | 0.061523 |
CREATE TABLE table_17058116_5 (location_attendance VARCHAR2, date VARCHAR2)
| Where was the game that took place in November 21 located and how many attended? | SELECT location_attendance FROM table_17058116_5 WHERE date = "November 21" | SELECT "location_attendance" FROM "table_17058116_5" WHERE "November 21" = "date" | 0.079102 |
CREATE TABLE table_3134 ("Rank" FLOAT, "Team" CLOB, "Round1" FLOAT, "Round2" FLOAT, "Round3" FLOAT, "Round4" FLOAT, "Total points" FLOAT)
| Which team had 342 total points? | SELECT "Team" FROM table_3134 WHERE "Total points" = '342' | SELECT "Team" FROM "table_3134" WHERE "Total points" = '342' | 0.058594 |
CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2)
CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER)
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 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 gsi (course_offering_id NUMBER, student_id NUMBER)
CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year 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 program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2)
CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER)
CREATE TABLE area (course_id NUMBER, area 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 ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2)
CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname 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)
| Was CMBIOL 685 offered by more than one teacher during the Summer of 2011 , if so how many ? | SELECT COUNT(DISTINCT instructor.instructor_id) FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'CMBIOL' AND course.number = 685 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'Summer' AND semester.semester_id = course_offering.semester AND semester.year = 2011 | SELECT COUNT(DISTINCT "instructor"."instructor_id") 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" = 'Summer' AND "semester"."year" = 2011 JOIN "instructor" ON "instructor"."instructor_id" = "offering_instructor"."instructor_id" WHERE "course"."department" = 'CMBIOL' AND "course"."number" = 685 | 0.529297 |
CREATE TABLE table_48347 ("Player" CLOB, "Country" CLOB, "Year ( s ) won" CLOB, "Total" FLOAT, "To par" FLOAT, "Finish" CLOB)
| What is the total number of Total, when To Par is '7'? | SELECT COUNT("Total") FROM table_48347 WHERE "To par" = '7' | SELECT COUNT("Total") FROM "table_48347" WHERE "To par" = '7' | 0.05957 |
CREATE TABLE table_203_459 (id NUMBER, "township" CLOB, "fips" NUMBER, "population\ center" CLOB, "population" NUMBER, "population\ density\ /km2 ( /sq mi ) " CLOB, "land area\ km2 ( sq mi ) " CLOB, "water area\ km2 ( sq mi ) " CLOB, "water %" CLOB, "geographic coordinates" CLOB)
| which township has the most land area ? | SELECT "township" FROM table_203_459 ORDER BY "land area\nkm2 (sq mi)" DESC LIMIT 1 | SELECT "township" FROM "table_203_459" ORDER BY "land area\nkm2 (sq mi)" DESC FETCH FIRST 1 ROWS ONLY | 0.098633 |
CREATE TABLE table_37448 ("School" CLOB, "Mascot" CLOB, "Location" CLOB, "Enrollment" FLOAT, "IHSAA Class" CLOB, "IHSAA Football Class" CLOB, "County" CLOB)
| What is the IHSAA class for Chesterton? | SELECT "IHSAA Class" FROM table_37448 WHERE "School" = 'chesterton' | SELECT "IHSAA Class" FROM "table_37448" WHERE "School" = 'chesterton' | 0.067383 |
CREATE TABLE table_name_3 (package_option VARCHAR2, content VARCHAR2)
| What is Package/Option, when Content is Tennis? | SELECT package_option FROM table_name_3 WHERE content = "tennis" | SELECT "package_option" FROM "table_name_3" WHERE "content" = "tennis" | 0.068359 |
CREATE TABLE table_66817 ("Place" CLOB, "Player" CLOB, "Country" CLOB, "Score" FLOAT, "To par" CLOB)
| Which country has 69 score? | SELECT "Country" FROM table_66817 WHERE "Score" = '69' | SELECT "Country" FROM "table_66817" WHERE "Score" = '69' | 0.054688 |
CREATE TABLE table_74187 ("Game" FLOAT, "Date" CLOB, "Team" CLOB, "Score" CLOB, "High points" CLOB, "High rebounds" CLOB, "High assists" CLOB, "Location Attendance" CLOB, "Record" CLOB)
| Name the team for score l 102 122 (ot) | SELECT "Team" FROM table_74187 WHERE "Score" = 'L 102–122 (OT)' | SELECT "Team" FROM "table_74187" WHERE "Score" = 'L 102–122 (OT)' | 0.063477 |
CREATE TABLE table_name_79 (birthplace VARCHAR2, jersey_number VARCHAR2, position VARCHAR2, height__cm_ VARCHAR2)
| What is the birthplace of the player who is 190 CM tall, plays the D position, and wears number 11? | SELECT birthplace FROM table_name_79 WHERE position = "d" AND height__cm_ = 190 AND jersey_number = 11 | SELECT "birthplace" FROM "table_name_79" WHERE "d" = "position" AND "height__cm_" = 190 AND "jersey_number" = 11 | 0.109375 |
CREATE TABLE table_43954 ("Constellation" CLOB, "Largest component , fractional share" FLOAT, "Other components , fractional shares" CLOB, "N , Laakso-Taagepera" FLOAT, "N , Golosov" FLOAT)
| What is the sum of the values for Largest Component, Fractional Share, when Constellation is E, and when N, Golosov is greater than 2.9? | SELECT SUM("Largest component, fractional share") FROM table_43954 WHERE "Constellation" = 'e' AND "N, Golosov" > '2.9' | SELECT SUM("Largest component, fractional share") FROM "table_43954" WHERE "Constellation" = 'e' AND "N, Golosov" > '2.9' | 0.118164 |
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 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 cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER)
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_labitems (row_id NUMBER, itemid NUMBER, label 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 diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME)
CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB)
CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB)
CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME)
CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB)
CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB)
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 chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB)
CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER)
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)
| among patients who were diagnosed with liver transplant status since 2105, what are the top five most frequent medications that followed afterwards in the same hospital visit? | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'liver transplant status') AND STRFTIME('%y', diagnoses_icd.charttime) >= '2105') AS t1 JOIN (SELECT admissions.subject_id, prescriptions.drug, prescriptions.startdate, admissions.hadm_id FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE STRFTIME('%y', prescriptions.startdate) >= '2105') AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.startdate AND t1.hadm_id = t2.hadm_id GROUP BY t2.drug) AS t3 WHERE t3.c1 <= 5 | WITH "t2" AS (SELECT "admissions"."subject_id", "prescriptions"."drug", "prescriptions"."startdate", "admissions"."hadm_id" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" WHERE STRFTIME('%y', "prescriptions"."startdate") >= '2105'), "t3" AS (SELECT "t2"."drug", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "diagnoses_icd" JOIN "d_icd_diagnoses" ON "d_icd_diagnoses"."icd9_code" = "diagnoses_icd"."icd9_code" AND "d_icd_diagnoses"."short_title" = 'liver transplant status' JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" JOIN "t2" "t2" ON "admissions"."hadm_id" = "t2"."hadm_id" AND "admissions"."subject_id" = "t2"."subject_id" AND "diagnoses_icd"."charttime" < "t2"."startdate" WHERE STRFTIME('%y', "diagnoses_icd"."charttime") >= '2105' GROUP BY "t2"."drug") SELECT "t3"."drug" FROM "t3" "t3" WHERE "t3"."c1" <= 5 | 0.875977 |
CREATE TABLE table_168274_1 (index_weighting___percentage__at_17_january_2013 VARCHAR2, ticker_symbol VARCHAR2)
| Name the index weighting % for 17 januaary 2013 for rno | SELECT index_weighting___percentage__at_17_january_2013 FROM table_168274_1 WHERE ticker_symbol = "RNO" | SELECT "index_weighting___percentage__at_17_january_2013" FROM "table_168274_1" WHERE "RNO" = "ticker_symbol" | 0.106445 |
CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER)
CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT)
| How many different products are produced in each headquarter city Visualize by bar chart, and display by the x-axis in asc. | SELECT Headquarter, COUNT(DISTINCT T1.Name) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code ORDER BY Headquarter | SELECT "Headquarter", COUNT(DISTINCT "T1"."Name") FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" ORDER BY "Headquarter" | 0.152344 |
CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER)
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 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)
CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime 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 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 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 d_labitems (row_id NUMBER, itemid NUMBER, label CLOB)
CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME)
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 d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB)
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_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB)
CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER)
CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_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)
| what are the five most frequently used procedures for patients who were diagnosed with hyp ht dis nos w ht fail previously in the same hospital encounter during this year? | SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hyp ht dis nos w ht fail') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t1 JOIN (SELECT admissions.subject_id, procedures_icd.icd9_code, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND t1.hadm_id = t2.hadm_id GROUP BY t2.icd9_code) AS t3 WHERE t3.c1 <= 5) | WITH "t2" AS (SELECT "admissions"."subject_id", "procedures_icd"."icd9_code", "procedures_icd"."charttime", "admissions"."hadm_id" FROM "procedures_icd" JOIN "admissions" ON "admissions"."hadm_id" = "procedures_icd"."hadm_id" WHERE DATETIME("procedures_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')), "t3" AS (SELECT "t2"."icd9_code", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "diagnoses_icd" JOIN "d_icd_diagnoses" ON "d_icd_diagnoses"."icd9_code" = "diagnoses_icd"."icd9_code" AND "d_icd_diagnoses"."short_title" = 'hyp ht dis nos w ht fail' JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" JOIN "t2" "t2" ON "admissions"."hadm_id" = "t2"."hadm_id" AND "admissions"."subject_id" = "t2"."subject_id" AND "diagnoses_icd"."charttime" < "t2"."charttime" WHERE DATETIME("diagnoses_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY "t2"."icd9_code"), "_u_1" AS (SELECT "t3"."icd9_code" FROM "t3" "t3" WHERE "t3"."c1" <= 5 GROUP BY "icd9_code") SELECT "d_icd_procedures"."short_title" FROM "d_icd_procedures" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "d_icd_procedures"."icd9_code" WHERE NOT "_u_1"."" IS NULL | 1.202148 |
CREATE TABLE table_name_78 (laps VARCHAR2, rank VARCHAR2)
| What is the lap number for the rank of 13? | SELECT laps FROM table_name_78 WHERE rank = "13" | SELECT "laps" FROM "table_name_78" WHERE "13" = "rank" | 0.052734 |
CREATE TABLE products (code NUMBER, name CLOB, price NUMBER, manufacturer NUMBER)
CREATE TABLE manufacturers (code NUMBER, name CLOB, headquarter CLOB, founder CLOB, revenue NUMBER)
| Select the names and the prices of all the products in the store. | SELECT name, price FROM products | SELECT "name", "price" FROM "products" | 0.037109 |
CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT)
CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER)
| For those records from the products and each product's manufacturer, find name and the average of manufacturer , and group by attribute name, and visualize them by a bar chart, sort mean manufacturer in ascending order. | SELECT T2.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Manufacturer | SELECT "T2"."Name", "T1"."Manufacturer" FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T2"."Name" ORDER BY "T1"."Manufacturer" | 0.168945 |
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)
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)
| how many patients admitted before the year 2197 have had cerebrospinal fluid (csf) lab test? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2197" AND lab.fluid = "Cerebrospinal Fluid (CSF)" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Cerebrospinal Fluid (CSF)" = "lab"."fluid" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "2197" > "demographic"."admityear" | 0.208008 |
CREATE TABLE Faculty (Rank VARCHAR2, building VARCHAR2)
| How many Professors are in building NEB? | SELECT COUNT(*) FROM Faculty WHERE Rank = "Professor" AND building = "NEB" | SELECT COUNT(*) FROM "Faculty" WHERE "NEB" = "building" AND "Professor" = "Rank" | 0.078125 |
CREATE TABLE table_31440 ("model" CLOB, "Sonnet" CLOB, "Apple" CLOB, "NUpowr 117" CLOB, "NUpowr 167" CLOB, "NUpowr 183" CLOB, "NUpowr G3" CLOB)
| When 0,4, or 8 mb is the nupowr 117 what is the nupowr 183? | SELECT "NUpowr 183" FROM table_31440 WHERE "NUpowr 117" = '0,4, or 8 MB' | SELECT "NUpowr 183" FROM "table_31440" WHERE "NUpowr 117" = '0,4, or 8 MB' | 0.072266 |
CREATE TABLE table_name_47 (result VARCHAR2, date VARCHAR2, competition VARCHAR2, score VARCHAR2)
| What is the Result of the Friendly Competition on October 27, 2005 with a Score of 5-0? | SELECT result FROM table_name_47 WHERE competition = "friendly" AND score = "5-0" AND date = "october 27, 2005" | SELECT "result" FROM "table_name_47" WHERE "5-0" = "score" AND "competition" = "friendly" AND "date" = "october 27, 2005" | 0.118164 |
CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT)
CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER)
| 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 headquarter, could you display by the y axis in desc? | SELECT T1.Name, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name ORDER BY T1.Price DESC | SELECT "T1"."Name", "T1"."Price" FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Headquarter", "T1"."Name" ORDER BY "T1"."Price" DESC | 0.174805 |
CREATE TABLE table_34267 ("Week" FLOAT, "Date" CLOB, "Opponent" CLOB, "Result" CLOB, "Venue" CLOB, "Attendance" CLOB)
| Which Opponent has Attendances of 60,594? | SELECT "Opponent" FROM table_34267 WHERE "Attendance" = '60,594' | SELECT "Opponent" FROM "table_34267" WHERE "Attendance" = '60,594' | 0.064453 |
CREATE TABLE table_61491 ("Place" CLOB, "Player" CLOB, "Country" CLOB, "Score" CLOB, "To par" CLOB, "Money ( \\u00a3 ) " FLOAT)
| What country has player Nick Faldo? | SELECT "Country" FROM table_61491 WHERE "Player" = 'nick faldo' | SELECT "Country" FROM "table_61491" WHERE "Player" = 'nick faldo' | 0.063477 |
CREATE TABLE table_16664 ("Round" FLOAT, "Grand Prix" CLOB, "Date" CLOB, "Location" CLOB, "Pole Position" CLOB, "Fastest Lap" CLOB, "Winning Driver" CLOB, "Winning Constructor" CLOB, "Report" CLOB)
| whatthe minimum round where grand prix is german grand prix | SELECT MIN("Round") FROM table_16664 WHERE "Grand Prix" = 'German Grand Prix' | SELECT MIN("Round") FROM "table_16664" WHERE "Grand Prix" = 'German Grand Prix' | 0.077148 |
CREATE TABLE table_2102945_1 (viewers__in_millions_ VARCHAR2, run_time VARCHAR2)
| When 24:31 is the run time how many measurements of viewers (in millions) are there? | SELECT COUNT(viewers__in_millions_) FROM table_2102945_1 WHERE run_time = "24:31" | SELECT COUNT("viewers__in_millions_") FROM "table_2102945_1" WHERE "24:31" = "run_time" | 0.084961 |
CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT)
CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER)
| For those products with a price between 60 and 120, a scatter chart shows the correlation between code and manufacturer . | SELECT Code, Manufacturer FROM Products WHERE Price BETWEEN 60 AND 120 | SELECT "Code", "Manufacturer" FROM "Products" WHERE "Price" <= 120 AND "Price" >= 60 | 0.082031 |
CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB)
CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto 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 labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB)
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 outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER)
CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME)
CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME)
CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB)
CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB)
CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime 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 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 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 cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER)
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)
| tell me the medication that patient 60014 has been prescribed for the last time until 40 months ago. | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 60014) AND DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-40 month') ORDER BY prescriptions.startdate DESC LIMIT 1 | WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 60014 GROUP BY "hadm_id") SELECT "prescriptions"."drug" FROM "prescriptions" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE DATETIME("prescriptions"."startdate") <= DATETIME(CURRENT_TIME(), '-40 month') AND NOT "_u_0"."" IS NULL ORDER BY "prescriptions"."startdate" DESC FETCH FIRST 1 ROWS ONLY | 0.40625 |
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)
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 procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
| what is the number of patients taking drug via tp route who have other and unspecified noninfectious gastroenteritis and colitis? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Noninf gastroenterit NEC" AND prescriptions.route = "TP" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Noninf gastroenterit NEC" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "prescriptions" ON "TP" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" | 0.298828 |
CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime 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 allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME)
CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME)
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 diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB)
CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME)
CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME)
| calculate the number of patients who had received the base excess laboratory test in 2101. | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 'base excess' AND STRFTIME('%y', lab.labresulttime) = '2101') | WITH "_u_0" AS (SELECT "lab"."patientunitstayid" FROM "lab" WHERE "lab"."labname" = 'base excess' AND STRFTIME('%y', "lab"."labresulttime") = '2101' GROUP BY "patientunitstayid") SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL | 0.327148 |
CREATE TABLE papers (title VARCHAR2)
| Which paper's title contains the word 'Database'? | SELECT title FROM papers WHERE title LIKE "%Database%" | SELECT "title" FROM "papers" WHERE "title" LIKE "%Database%" | 0.058594 |
CREATE TABLE table_name_36 (draw NUMBER, points VARCHAR2)
| What is the highest draw number when 23 points are scored? | SELECT MAX(draw) FROM table_name_36 WHERE points = 23 | SELECT MAX("draw") FROM "table_name_36" WHERE "points" = 23 | 0.057617 |
CREATE TABLE people (People_ID NUMBER, Sex CLOB, Name CLOB, Date_of_Birth CLOB, Height FLOAT, Weight FLOAT)
CREATE TABLE candidate (Candidate_ID NUMBER, People_ID NUMBER, Poll_Source CLOB, Date CLOB, Support_rate FLOAT, Consider_rate FLOAT, Oppose_rate FLOAT, Unsure_rate FLOAT)
| A bar chart showing the average weight for each gender. | SELECT Sex, AVG(Weight) FROM people GROUP BY Sex | SELECT "Sex", AVG("Weight") FROM "people" GROUP BY "Sex" | 0.054688 |
CREATE TABLE table_57603 ("Cyclist" CLOB, "Country" CLOB, "Team" CLOB, "Time" CLOB, "UCI Points" CLOB)
| How many UCI points did Rabobank score? | SELECT "UCI Points" FROM table_57603 WHERE "Team" = 'rabobank' | SELECT "UCI Points" FROM "table_57603" WHERE "Team" = 'rabobank' | 0.0625 |
CREATE TABLE table_77296 ("Year" FLOAT, "Team" CLOB, "Co-Drivers" CLOB, "Class" CLOB, "Laps" FLOAT, "Pos." CLOB, "Class Pos." CLOB)
| What is Class Pos., when Year is before 2013, and when Laps is greater than 175? | SELECT "Class Pos." FROM table_77296 WHERE "Year" < '2013' AND "Laps" > '175' | SELECT "Class Pos." FROM "table_77296" WHERE "Laps" > '175' AND "Year" < '2013' | 0.077148 |
CREATE TABLE table_204_238 (id NUMBER, "#" NUMBER, "title" CLOB, "producer ( s ) " CLOB, "performer ( s ) " CLOB, "time" CLOB)
| what were the number of performers on the joint right here -lrb- remix -rrb- | SELECT "performer (s)" FROM table_204_238 WHERE "title" = '"the joint right here (remix)"' | SELECT "performer (s)" FROM "table_204_238" WHERE "title" = '"the joint right here (remix)"' | 0.089844 |
CREATE TABLE table_12262182_2 (titles VARCHAR2, date VARCHAR2)
| What titles were fought for on 1997-04-12? | SELECT titles FROM table_12262182_2 WHERE date = "1997-04-12" | SELECT "titles" FROM "table_12262182_2" WHERE "1997-04-12" = "date" | 0.06543 |
CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER)
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 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 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 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 medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME)
CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME)
| what were the outputs of patient 033-42758 for the first time on 11/08/last year? | SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-42758')) AND intakeoutput.cellpath LIKE '%output%' AND DATETIME(intakeoutput.intakeoutputtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m-%d', intakeoutput.intakeoutputtime) = '11-08' ORDER BY intakeoutput.intakeoutputtime LIMIT 1 | WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '033-42758' 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 "intakeoutput"."celllabel" FROM "intakeoutput" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."cellpath" LIKE '%output%' AND DATETIME("intakeoutput"."intakeoutputtime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_1"."" IS NULL AND STRFTIME('%m-%d', "intakeoutput"."intakeoutputtime") = '11-08' ORDER BY "intakeoutput"."intakeoutputtime" FETCH FIRST 1 ROWS ONLY | 0.791016 |
CREATE TABLE table_50368 ("Date" CLOB, "Visitor" CLOB, "Score" CLOB, "Home" CLOB, "Record" CLOB)
| What was the record on April 10? | SELECT "Record" FROM table_50368 WHERE "Date" = 'april 10' | SELECT "Record" FROM "table_50368" WHERE "Date" = 'april 10' | 0.058594 |
CREATE TABLE table_203_161 (id NUMBER, "pos." CLOB, "div." NUMBER, "no." NUMBER, "team" CLOB, "drivers" CLOB, "car" CLOB, "laps" NUMBER, "qual.\ pos." NUMBER)
| who was phil ward racing 's other driver ? | SELECT "drivers" FROM table_203_161 WHERE "team" = 'phil ward racing' AND "drivers" <> 'phil ward' | SELECT "drivers" FROM "table_203_161" WHERE "drivers" <> 'phil ward' AND "team" = 'phil ward racing' | 0.097656 |
CREATE TABLE table_46368 ("Year" FLOAT, "Show" CLOB, "Season" FLOAT, "Episode" CLOB, "Episode number" FLOAT, "Original airdate" CLOB)
| What is Show, when Episode Number is 1, when Year is less than 2010, and when Original Airdate is January 20, 2008? | SELECT "Show" FROM table_46368 WHERE "Episode number" = '1' AND "Year" < '2010' AND "Original airdate" = 'january 20, 2008' | SELECT "Show" FROM "table_46368" WHERE "Episode number" = '1' AND "Original airdate" = 'january 20, 2008' AND "Year" < '2010' | 0.12207 |
CREATE TABLE company (company_id NUMBER, name CLOB, headquarters CLOB, industry CLOB, sales_in_billion NUMBER, profits_in_billion NUMBER, assets_in_billion NUMBER, market_value_in_billion NUMBER)
CREATE TABLE employment (company_id NUMBER, people_id NUMBER, year_working NUMBER)
CREATE TABLE people (people_id NUMBER, age NUMBER, name CLOB, nationality CLOB, graduation_college CLOB)
| Show names of companies and that of employees in descending order of number of years working for that employee. | SELECT T3.name, T2.name FROM employment AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id JOIN company AS T3 ON T1.company_id = T3.company_id ORDER BY T1.year_working | SELECT "T3"."name", "T2"."name" FROM "employment" "T1" JOIN "people" "T2" ON "T1"."people_id" = "T2"."people_id" JOIN "company" "T3" ON "T1"."company_id" = "T3"."company_id" ORDER BY "T1"."year_working" | 0.197266 |
CREATE TABLE table_18428 ("District" CLOB, "Incumbent" CLOB, "Party" CLOB, "First elected" FLOAT, "Result" CLOB, "Candidates" CLOB)
| what is the political affiliation of ray roberts | SELECT "Party" FROM table_18428 WHERE "Incumbent" = 'Ray Roberts' | SELECT "Party" FROM "table_18428" WHERE "Incumbent" = 'Ray Roberts' | 0.06543 |
CREATE TABLE table_1749567_2 (length__in_m_ NUMBER, name VARCHAR2)
| The Keutenberg race had what race length? | SELECT MAX(length__in_m_) FROM table_1749567_2 WHERE name = "Keutenberg" | SELECT MAX("length__in_m_") FROM "table_1749567_2" WHERE "Keutenberg" = "name" | 0.076172 |
CREATE TABLE table_204_763 (id NUMBER, "county" CLOB, "km" NUMBER, "intersecting road" CLOB, "notes" CLOB, "coordinates" CLOB)
| which intersecting road comes before range road 273 ? | SELECT "intersecting road" FROM table_204_763 WHERE id = (SELECT id FROM table_204_763 WHERE "intersecting road" = 'range road 273') - 1 | SELECT "intersecting road" FROM "table_204_763" WHERE "id" = (SELECT "id" FROM "table_204_763" WHERE "intersecting road" = 'range road 273') - 1 | 0.140625 |
CREATE TABLE table_40329 ("Office" CLOB, "Republican ticket" CLOB, "Democratic ticket" CLOB, "American Labor ticket" CLOB, "Liberal ticket" CLOB, "Communist ticket" CLOB)
| What name is on the Republican ticket when the American Labor ticket was spencer c. young? | SELECT "Republican ticket" FROM table_40329 WHERE "American Labor ticket" = 'spencer c. young' | SELECT "Republican ticket" FROM "table_40329" WHERE "American Labor ticket" = 'spencer c. young' | 0.09375 |
CREATE TABLE dorm (dormid NUMBER, dorm_name CLOB, student_capacity NUMBER, gender CLOB)
CREATE TABLE has_amenity (dormid NUMBER, amenid NUMBER)
CREATE TABLE student (stuid NUMBER, lname CLOB, fname CLOB, age NUMBER, sex CLOB, major NUMBER, advisor NUMBER, city_code CLOB)
CREATE TABLE dorm_amenity (amenid NUMBER, amenity_name CLOB)
CREATE TABLE lives_in (stuid NUMBER, dormid NUMBER, room_number NUMBER)
| Find the name of dorms that can accommodate more than 300 students. | SELECT dorm_name FROM dorm WHERE student_capacity > 300 | SELECT "dorm_name" FROM "dorm" WHERE "student_capacity" > 300 | 0.05957 |
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 lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime 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 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 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 treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME)
CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME)
| what are the five most frequent drugs that were prescribed in the same hospital visit to cardiomyopathy male patient, age 40s after they have been diagnosed with cardiomyopathy? | SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'cardiomyopathy') AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.gender = 'male' AND patient.age BETWEEN 40 AND 49) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.drugname) AS t3 WHERE t3.c1 <= 5 | WITH "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime", "patient"."patienthealthsystemstayid" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" AND "patient"."age" <= 49 AND "patient"."age" >= 40 AND "patient"."gender" = 'male'), "t3" AS (SELECT "t2"."drugname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" "t2" ON "diagnosis"."diagnosistime" < "t2"."drugstarttime" AND "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "patient"."uniquepid" = "t2"."uniquepid" WHERE "diagnosis"."diagnosisname" = 'cardiomyopathy' GROUP BY "t2"."drugname") SELECT "t3"."drugname" FROM "t3" "t3" WHERE "t3"."c1" <= 5 | 0.81543 |
CREATE TABLE person (name VARCHAR2, age NUMBER, job VARCHAR2)
CREATE TABLE Person (name VARCHAR2, age NUMBER, job VARCHAR2)
| Find the name of people whose age is greater than any engineer sorted by their age. | SELECT name FROM Person WHERE age > (SELECT MIN(age) FROM Person WHERE job = 'engineer') ORDER BY age | SELECT "name" FROM "Person" WHERE "age" > (SELECT MIN("age") FROM "Person" WHERE "job" = 'engineer') ORDER BY "age" | 0.112305 |
CREATE TABLE table_17692 ("Club" CLOB, "Overall Record" CLOB, "Goals For" FLOAT, "Goals For Avg." CLOB, "Goals Against" FLOAT, "Goals Against Avg." CLOB)
| what is the goals for when the club is new england revolution? | SELECT "Goals For" FROM table_17692 WHERE "Club" = 'New England Revolution' | SELECT "Goals For" FROM "table_17692" WHERE "Club" = 'New England Revolution' | 0.075195 |
CREATE TABLE table_2818164_5 (production_code NUMBER, no_in_series VARCHAR2)
| What is the production code for episode 96 in the series? | SELECT MIN(production_code) FROM table_2818164_5 WHERE no_in_series = "96" | SELECT MIN("production_code") FROM "table_2818164_5" WHERE "96" = "no_in_series" | 0.078125 |
CREATE TABLE table_name_43 (report VARCHAR2, venue VARCHAR2)
| What was the report at State Sports Centre? | SELECT report FROM table_name_43 WHERE venue = "state sports centre" | SELECT "report" FROM "table_name_43" WHERE "state sports centre" = "venue" | 0.072266 |
CREATE TABLE table_name_94 (date VARCHAR2, leading_scorer VARCHAR2, visitor VARCHAR2)
| While the Hornets were visiting, what date was Deron Williams (29) the leading scorer? | SELECT date FROM table_name_94 WHERE leading_scorer = "deron williams (29)" AND visitor = "hornets" | SELECT "date" FROM "table_name_94" WHERE "deron williams (29)" = "leading_scorer" AND "hornets" = "visitor" | 0.104492 |
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)
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)
| provide the number of patients whose days of hospital stay is greater than 10 and procedure long title is coronary arteriography using two catheters? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "10" AND procedures.long_title = "Coronary arteriography using two catheters" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Coronary arteriography using two catheters" = "procedures"."long_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "10" < "demographic"."days_stay" | 0.248047 |
CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER)
CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB)
CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB)
CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER)
CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit 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 d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB)
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 diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME)
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 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 procedures_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 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)
| calculate the number of patients who had had a cd3 cells, percent lab test in this year. | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'cd3 cells, percent') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) | WITH "_u_0" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'cd3 cells, percent' GROUP BY "itemid"), "_u_1" AS (SELECT "labevents"."hadm_id" FROM "labevents" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "labevents"."itemid" WHERE DATETIME("labevents"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_0"."" IS NULL GROUP BY "hadm_id") SELECT COUNT(DISTINCT "admissions"."subject_id") FROM "admissions" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "admissions"."hadm_id" WHERE NOT "_u_1"."" IS NULL | 0.550781 |
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 d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title 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 diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime 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_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB)
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 microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB)
CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB)
CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME)
CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER)
CREATE TABLE 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 d_labitems (row_id NUMBER, itemid NUMBER, label CLOB)
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 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 d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB)
| what's the first value of the creatinine lab test of patient 12938 until 06/2105? | SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12938) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'creatinine') AND STRFTIME('%y-%m', labevents.charttime) <= '2105-06' ORDER BY labevents.charttime LIMIT 1 | WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 12938 GROUP BY "hadm_id"), "_u_1" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'creatinine' GROUP BY "itemid") SELECT "labevents"."valuenum" FROM "labevents" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "labevents"."hadm_id" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "labevents"."itemid" WHERE NOT "_u_0"."" IS NULL AND NOT "_u_1"."" IS NULL AND STRFTIME('%y-%m', "labevents"."charttime") <= '2105-06' ORDER BY "labevents"."charttime" FETCH FIRST 1 ROWS ONLY | 0.568359 |
CREATE TABLE useracct (u_id NUMBER, name VARCHAR2)
CREATE TABLE trust (source_u_id NUMBER, target_u_id NUMBER, trust NUMBER)
CREATE TABLE review (a_id NUMBER, u_id NUMBER, i_id NUMBER, rating NUMBER, rank NUMBER)
CREATE TABLE item (i_id NUMBER, title VARCHAR2)
| Find each target user's name and average trust score. Visualize by bar chart. | SELECT name, AVG(trust) FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.target_u_id GROUP BY T2.target_u_id | SELECT "name", AVG("trust") FROM "useracct" "T1" JOIN "trust" "T2" ON "T1"."u_id" = "T2"."target_u_id" GROUP BY "T2"."target_u_id" | 0.126953 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.