diff --git a/dbgpt_hub/train/README.md b/README_zh_0925.md similarity index 100% rename from dbgpt_hub/train/README.md rename to README_zh_0925.md diff --git a/dbgpt_hub/train/data/dataset_info.json b/dbgpt_hub/train/data/dataset_info.json deleted file mode 100644 index 393b651..0000000 --- a/dbgpt_hub/train/data/dataset_info.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "example_text2sql": { - "file_name": "example_text2sql.json", - "columns": { - "prompt": "instruction", - "query": "input", - "response": "output", - "history": "history" - }, - "stage": "sft" - } -} diff --git a/dbgpt_hub/train/data/example_text2sql.json b/dbgpt_hub/train/data/example_text2sql.json deleted file mode 100644 index 2d6dc80..0000000 --- a/dbgpt_hub/train/data/example_text2sql.json +++ /dev/null @@ -1,1521 +0,0 @@ -[ - { - "db_id": "database", - "instruction": "CREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- which states border arizona\nSELECT", - "input": "", - "output": "SELECT border FROM border_info WHERE state_name = 'arizona'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what are the flights from ONTARIO to MEMPHIS\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ONTARIO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MEMPHIS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Name the course worth 9 credits .\nSELECT", - "input": "", - "output": "SELECT DISTINCT name, number FROM course WHERE credits = 9 AND department = 'EECS'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- can you show me what fares are available from OAKLAND to DALLAS on 12 16 one way only\nSELECT", - "input": "", - "output": "SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND DATE_DAY_1.day_number = 16 AND DATE_DAY_1.month_number = 12 AND DATE_DAY_1.year = 1991 AND DAYS_1.day_name = DATE_DAY_1.day_name AND flight.flight_days = DAYS_1.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'OAKLAND' AND DATE_DAY_0.day_number = 16 AND DATE_DAY_0.month_number = 12 AND DATE_DAY_0.year = 1991 AND DAYS_0.day_name = DATE_DAY_0.day_name AND fare_basis.basis_days = DAYS_0.days_code AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND fare.round_trip_required = 'NO'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- do any of the CO flights from BOSTON to SAN FRANCISCO stop in DENVER\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'DENVER' AND flight_stop.stop_airport = AIRPORT_SERVICE_2.airport_code AND flight.flight_id = flight_stop.flight_id AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.airline_code = 'CO'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- list all the airlines that fly into MKE\nSELECT", - "input": "", - "output": "SELECT DISTINCT airline.airline_code FROM airline, airport, flight WHERE airport.airport_code = 'MKE' AND flight.airline_code = airline.airline_code AND flight.to_airport = airport.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- 483 is how large ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT num_enrolled FROM course WHERE department = 'EECS' AND number = 483", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- This Spring-Summer , how many upper-level 14 -credit SPACE classes are being offered ?\nSELECT", - "input": "", - "output": "SELECT COUNT(DISTINCT course.course_id) FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.credits = 14 AND course.department = 'SPACE' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Spring-Summer' AND semester.semester_id = course_offering.semester AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE location (\nrestaurant_id,\nhouse_number,\nstreet_name,\ncity_name\n)\n\nCREATE TABLE restaurant (\nid,\nname,\nfood_type,\ncity_name,\nrating\n)\n\nCREATE TABLE geographic (\ncity_name,\ncounty,\nregion\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- give me a good arabic restaurant in mountain view ?\nSELECT", - "input": "", - "output": "SELECT location.house_number, restaurant.name FROM location, restaurant WHERE location.city_name = 'mountain view' AND restaurant.food_type = 'arabic' AND restaurant.id = location.restaurant_id AND restaurant.rating > 2.5", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- FRENCH 656 is going to be taught by what professor this Spring-Summer ?\nSELECT", - "input": "", - "output": "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 = 'FRENCH' AND course.number = 656 AND semester.semester = 'Spring-Summer' AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE writes (\npaperid,\nauthorid\n)\n\nCREATE TABLE dataset (\ndatasetid,\ndatasetname\n)\n\nCREATE TABLE paperkeyphrase (\npaperid,\nkeyphraseid\n)\n\nCREATE TABLE paperfield (\nfieldid,\npaperid\n)\n\nCREATE TABLE paper (\npaperid,\ntitle,\nvenueid,\nyear,\nnumciting,\nnumcitedby,\njournalid\n)\n\nCREATE TABLE cite (\ncitingpaperid,\ncitedpaperid\n)\n\nCREATE TABLE venue (\nvenueid,\nvenuename\n)\n\nCREATE TABLE keyphrase (\nkeyphraseid,\nkeyphrasename\n)\n\nCREATE TABLE field (\nfieldid\n)\n\nCREATE TABLE journal (\njournalid,\njournalname\n)\n\nCREATE TABLE author (\nauthorid,\nauthorname\n)\n\nCREATE TABLE paperdataset (\npaperid,\ndatasetid\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- papers from ACL 2014\nSELECT", - "input": "", - "output": "SELECT DISTINCT paper.paperid FROM paper, venue WHERE paper.year = 2014 AND venue.venueid = paper.venueid AND venue.venuename = 'ACL'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what river is the longest one in the united states\nSELECT", - "input": "", - "output": "SELECT river_name FROM river WHERE length = (SELECT MAX(RIVERalias1.length) FROM river AS RIVERalias1)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What past classes has Dr. Nicole Appleberry taught ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course_offering.semester < (SELECT SEMESTERalias0.semester_id FROM semester AS SEMESTERalias0 WHERE SEMESTERalias0.semester = 'WN' AND SEMESTERalias0.year = 2016) AND course.course_id = course_offering.course_id AND instructor.name LIKE '%Nicole Appleberry%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- give me flights from ATLANTA to BALTIMORE\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- all flights PHOENIX to SFO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport, airport_service, city, flight WHERE airport.airport_code = 'SFO' AND city.city_code = airport_service.city_code AND city.city_name = 'PHOENIX' AND flight.from_airport = airport_service.airport_code AND flight.to_airport = airport.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- how many flights does EA have from BOSTON to ATLANTA\nSELECT", - "input": "", - "output": "SELECT COUNT(DISTINCT flight.flight_id) FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'EA'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what is the population of boulder\nSELECT", - "input": "", - "output": "SELECT population FROM city WHERE city_name = 'boulder'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i'm looking for a flight that goes from ONTARIO to WESTCHESTER COUNTY and stops in CHICAGO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WESTCHESTER COUNTY' AND CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'CHICAGO' AND flight_stop.stop_airport = AIRPORT_SERVICE_2.airport_code AND flight.flight_id = flight_stop.flight_id AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ONTARIO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what are the classes of service on TW\nSELECT", - "input": "", - "output": "SELECT DISTINCT class_of_service.booking_class FROM class_of_service, fare, fare_basis, flight, flight_fare WHERE fare_basis.booking_class = class_of_service.booking_class AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.airline_code = 'TW' AND flight.flight_id = flight_fare.flight_id", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what is the price of a one way fare from ATLANTA to BOSTON\nSELECT", - "input": "", - "output": "SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND fare.round_trip_required = 'NO' AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- In Winter or Fall of 2011 , what theory courses are offered ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE area.area LIKE '%theory%' AND semester.semester IN ('WN', 'FA') AND semester.year = 2011", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- does YX have any flights from MONTREAL to NASHVILLE\nSELECT", - "input": "", - "output": "SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((flight.airline_code = 'YX') AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NASHVILLE' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'MONTREAL' AND flight.airline_code = airline.airline_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- name the longest river in us\nSELECT", - "input": "", - "output": "SELECT river_name FROM river WHERE length = (SELECT MAX(RIVERalias1.length) FROM river AS RIVERalias1)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what is the population density of the smallest state\nSELECT", - "input": "", - "output": "SELECT density FROM state WHERE area = (SELECT MIN(STATEalias1.area) FROM state AS STATEalias1)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me the DL flights from SAN FRANCISCO to BOSTON\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'DL'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- saturday flights from LAS VEGAS to MONTREAL\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MONTREAL' AND date_day.day_number = 26 AND date_day.month_number = 7 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'LAS VEGAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- could you show me all the flights from OAKLAND to SALT LAKE CITY\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'OAKLAND' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SALT LAKE CITY' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- On Friday , is there class for SAC 305 ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course_offering.friday FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'SAC' AND course.number = 305 AND semester.semester = 'WN' AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- In the Fall or Winter what courses are they offering to meet the MDE requirement ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id WHERE program_course.category LIKE '%MDE%' AND semester.semester IN ('FA', 'WN') AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Do you know if SPANISH 299 is being offered next semester ?\nSELECT", - "input": "", - "output": "SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'SPANISH' AND course.number = 299 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- give me the cities in virginia\nSELECT", - "input": "", - "output": "SELECT city_name FROM city WHERE state_name = 'virginia'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i would like a COACH class seat on a flight leaving DENVER arriving ATLANTA\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND fare_basis.class_type = 'COACH' AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- flights from COLUMBUS to MILWAUKEE\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'COLUMBUS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MILWAUKEE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What courses will be available during the upcoming 6 semesters ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.name, course.number, semester.semester, semester.year FROM course, course_offering, semester WHERE ((semester.semester = 'FA' AND semester.year = 2016) OR (semester.semester = 'FA' AND semester.year = 2017) OR (semester.semester = 'FA' AND semester.year = 2018) OR (semester.semester = 'WN' AND semester.year = 2017) OR (semester.semester = 'WN' AND semester.year = 2018) OR (semester.semester = 'WN' AND semester.year = 2019)) AND course.course_id = course_offering.course_id AND course.department = 'EECS' AND semester.semester_id = course_offering.semester ORDER BY semester.year, semester.semester", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what is the biggest city in the usa\nSELECT", - "input": "", - "output": "SELECT city_name FROM city WHERE population = (SELECT MAX(CITYalias1.population) FROM city AS CITYalias1)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me the flights from PHILADELPHIA to ATLANTA\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Which class most easily fulfills the MDE requirement ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%MDE%')", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- all flights from BOSTON to WASHINGTON on 11 11\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND date_day.day_number = 11 AND date_day.month_number = 11 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- list all flights from BALTIMORE to PHILADELPHIA\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what flights leave PITTSBURGH after 1700 on thursday and arrive in LOS ANGELES\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((date_day.day_number = 24 AND date_day.month_number = 5 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time > 1700 AND flight.flight_days = days.days_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LOS ANGELES' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- how many people live in the capital of texas\nSELECT", - "input": "", - "output": "SELECT population FROM city WHERE city_name = (SELECT STATEalias0.capital FROM state AS STATEalias0 WHERE STATEalias0.state_name = 'texas')", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- tell me the flights from BALTIMORE to DALLAS\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Are there upper-level classes for which 574 is not required ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%topic0%' OR name LIKE '%topic0%') AND department = 'EECS'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what flights leave BALTIMORE for BOSTON after 600 o'clock on friday\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((date_day.day_number = 25 AND date_day.month_number = 6 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time > 600 AND flight.flight_days = days.days_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- find the earliest flight from BOSTON to OAKLAND that serves BREAKFAST\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight, food_service WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code AND food_service.meal_code = flight.meal_code AND food_service.meal_description = 'BREAKFAST') AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time = (SELECT MIN(FLIGHTalias1.departure_time) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, flight AS FLIGHTalias1, food_service AS FOOD_SERVICEalias1 WHERE (CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'OAKLAND' AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code AND FOOD_SERVICEalias1.meal_code = FLIGHTalias1.meal_code AND FOOD_SERVICEalias1.meal_description = 'BREAKFAST') AND CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'BOSTON' AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show flights from DALLAS to SAN FRANCISCO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- list the flights and departure times for flights leaving DALLAS FORT WORTH for BOSTON after 1800\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.departure_time, flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS FORT WORTH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND (CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'BOSTON' AND flight.departure_time > 1800 AND flight.to_airport = AIRPORT_SERVICE_2.airport_code)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- how many major cities are in texas\nSELECT", - "input": "", - "output": "SELECT COUNT(city_name) FROM city WHERE population > 150000 AND state_name = 'texas'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- is ground transportation available in ST. LOUIS\nSELECT", - "input": "", - "output": "SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'ST. LOUIS' AND ground_service.city_code = city.city_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what is the combined area of all 50 states\nSELECT", - "input": "", - "output": "SELECT SUM(area) FROM state", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- list airports\nSELECT", - "input": "", - "output": "SELECT DISTINCT airport_code FROM airport", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Is computing infrastructure the basis of any of my previous courses ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN student_record ON student_record.course_id = course.course_id INNER JOIN area ON student_record.course_id = area.course_id WHERE area.area LIKE '%computing infrastructure%' AND student_record.student_id = 1", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what are the cities in states through which the mississippi runs\nSELECT", - "input": "", - "output": "SELECT city_name FROM city WHERE state_name IN (SELECT RIVERalias0.traverse FROM river AS RIVERalias0 WHERE RIVERalias0.river_name = 'mississippi')", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE location (\nrestaurant_id,\nhouse_number,\nstreet_name,\ncity_name\n)\n\nCREATE TABLE geographic (\ncity_name,\ncounty,\nregion\n)\n\nCREATE TABLE restaurant (\nid,\nname,\nfood_type,\ncity_name,\nrating\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what is the best restaurant in the bay area for american food ?\nSELECT", - "input": "", - "output": "SELECT location.house_number, restaurant.name FROM geographic, location, restaurant WHERE geographic.region = 'bay area' AND restaurant.city_name = geographic.city_name AND restaurant.food_type = 'american' AND restaurant.id = location.restaurant_id AND restaurant.rating = (SELECT MAX(RESTAURANTalias1.rating) FROM geographic AS GEOGRAPHICalias1, restaurant AS RESTAURANTalias1 WHERE GEOGRAPHICalias1.region = 'bay area' AND RESTAURANTalias1.city_name = GEOGRAPHICalias1.city_name AND RESTAURANTalias1.food_type = 'american')", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show flights from PHILADELPHIA to BOSTON\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- In 2010 are there computational science courses offered in Winter or Fall ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE area.area LIKE '%computational science%' AND semester.semester IN ('WN', 'FA') AND semester.year = 2010", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE author (\nauthorid,\nauthorname\n)\n\nCREATE TABLE paperkeyphrase (\npaperid,\nkeyphraseid\n)\n\nCREATE TABLE writes (\npaperid,\nauthorid\n)\n\nCREATE TABLE field (\nfieldid\n)\n\nCREATE TABLE dataset (\ndatasetid,\ndatasetname\n)\n\nCREATE TABLE paper (\npaperid,\ntitle,\nvenueid,\nyear,\nnumciting,\nnumcitedby,\njournalid\n)\n\nCREATE TABLE venue (\nvenueid,\nvenuename\n)\n\nCREATE TABLE paperfield (\nfieldid,\npaperid\n)\n\nCREATE TABLE paperdataset (\npaperid,\ndatasetid\n)\n\nCREATE TABLE cite (\ncitingpaperid,\ncitedpaperid\n)\n\nCREATE TABLE keyphrase (\nkeyphraseid,\nkeyphrasename\n)\n\nCREATE TABLE journal (\njournalid,\njournalname\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What papers were published at CVPR in 2016 about Class consistent multi-modal fusion with binary features applied to RGB-D Object Dataset ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT paper.paperid FROM dataset, paper, paperdataset, venue WHERE dataset.datasetname = 'RGB-D Object Dataset' AND paperdataset.datasetid = dataset.datasetid AND paper.paperid = paperdataset.paperid AND paper.title = 'Class consistent multi-modal fusion with binary features' AND paper.year = 2016 AND venue.venueid = paper.venueid AND venue.venuename = 'CVPR'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me nonstop flights from ST. PETERSBURG to TORONTO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ST. PETERSBURG' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'TORONTO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.stops = 0", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what 's the cheapest flight from DENVER to PITTSBURGH\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND fare.one_direction_cost = (SELECT MIN(FAREalias1.one_direction_cost) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, fare AS FAREalias1, flight AS FLIGHTalias1, flight_fare AS FLIGHT_FAREalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'DENVER' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'PITTSBURGH' AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me all flights from PHILADELPHIA to DENVER on sunday which leave PHILADELPHIA after 1200\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((date_day.day_number = 27 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time > 1200 AND flight.flight_days = days.days_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE keyword (\nkeyword,\nkid\n)\n\nCREATE TABLE journal (\nhomepage,\njid,\nname\n)\n\nCREATE TABLE domain_publication (\ndid,\npid\n)\n\nCREATE TABLE conference (\ncid,\nhomepage,\nname\n)\n\nCREATE TABLE author (\naid,\nhomepage,\nname,\noid\n)\n\nCREATE TABLE writes (\naid,\npid\n)\n\nCREATE TABLE domain_keyword (\ndid,\nkid\n)\n\nCREATE TABLE publication (\nabstract,\ncid,\ncitation_num,\njid,\npid,\nreference_num,\ntitle,\nyear\n)\n\nCREATE TABLE domain_author (\naid,\ndid\n)\n\nCREATE TABLE domain (\ndid,\nname\n)\n\nCREATE TABLE organization (\ncontinent,\nhomepage,\nname,\noid\n)\n\nCREATE TABLE domain_conference (\ncid,\ndid\n)\n\nCREATE TABLE domain_journal (\ndid,\njid\n)\n\nCREATE TABLE publication_keyword (\nkid,\npid\n)\n\nCREATE TABLE cite (\ncited,\nciting\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- return me the number of papers in VLDB after 2000 in ' University of Michigan ' .\nSELECT", - "input": "", - "output": "SELECT COUNT(DISTINCT (publication.title)) FROM author, journal, organization, publication, writes WHERE journal.name = 'VLDB' AND organization.name = 'University of Michigan' AND organization.oid = author.oid AND publication.jid = journal.jid AND publication.year > 2000 AND writes.aid = author.aid AND writes.pid = publication.pid", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what are the flights from TACOMA to SAN JOSE also on tuesday the eighteenth of may\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN JOSE' AND date_day.day_number = 22 AND date_day.month_number = 3 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'TACOMA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what is SA\nSELECT", - "input": "", - "output": "SELECT DISTINCT day_name FROM days WHERE days_code = 'SA'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what flights are available wednesday afternoon from DENVER to SAN FRANCISCO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time BETWEEN 1200 AND 1800", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE organization (\ncontinent,\nhomepage,\nname,\noid\n)\n\nCREATE TABLE conference (\ncid,\nhomepage,\nname\n)\n\nCREATE TABLE domain_publication (\ndid,\npid\n)\n\nCREATE TABLE author (\naid,\nhomepage,\nname,\noid\n)\n\nCREATE TABLE domain_conference (\ncid,\ndid\n)\n\nCREATE TABLE keyword (\nkeyword,\nkid\n)\n\nCREATE TABLE journal (\nhomepage,\njid,\nname\n)\n\nCREATE TABLE publication (\nabstract,\ncid,\ncitation_num,\njid,\npid,\nreference_num,\ntitle,\nyear\n)\n\nCREATE TABLE domain (\ndid,\nname\n)\n\nCREATE TABLE writes (\naid,\npid\n)\n\nCREATE TABLE cite (\ncited,\nciting\n)\n\nCREATE TABLE domain_author (\naid,\ndid\n)\n\nCREATE TABLE publication_keyword (\nkid,\npid\n)\n\nCREATE TABLE domain_keyword (\ndid,\nkid\n)\n\nCREATE TABLE domain_journal (\ndid,\njid\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- return me the number of papers by ' H. V. Jagadish ' .\nSELECT", - "input": "", - "output": "SELECT COUNT(DISTINCT (publication.title)) FROM author, publication, writes WHERE author.name = 'H. V. Jagadish' AND writes.aid = author.aid AND writes.pid = publication.pid", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- During the Spring and Summer term , how many 100 -level classes are being offered ?\nSELECT", - "input": "", - "output": "SELECT COUNT(DISTINCT course.course_id, semester.semester) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'department0' AND course.number BETWEEN 100 AND 100 + 100 AND semester.semester IN ('SP', 'SS', 'SU') AND semester.semester_id = course_offering.semester AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what about a RENTAL CAR in DENVER\nSELECT", - "input": "", - "output": "SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'DENVER' AND ground_service.city_code = city.city_code AND ground_service.transport_type = 'RENTAL CAR'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Can you list the courses that are worth 12 credits ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT name, number FROM course WHERE credits = 12 AND department = 'EECS'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me all flights from SAN FRANCISCO to NEW YORK nonstop\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NEW YORK' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.stops = 0", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- which airline is KW\nSELECT", - "input": "", - "output": "SELECT DISTINCT airline_code FROM airline WHERE airline_code = 'KW'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Are there any professors who have given a B to a student minoring in RCSSCI ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN student_record ON student_record.offering_id = offering_instructor.offering_id INNER JOIN student ON student.student_id = student_record.student_id WHERE (student_record.grade LIKE '%B%' OR student_record.grade LIKE '%B%') AND student.minor = 'RCSSCI'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- give me flights from PITTSBURGH to BALTIMORE\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE writes (\npaperid,\nauthorid\n)\n\nCREATE TABLE dataset (\ndatasetid,\ndatasetname\n)\n\nCREATE TABLE cite (\ncitingpaperid,\ncitedpaperid\n)\n\nCREATE TABLE field (\nfieldid\n)\n\nCREATE TABLE paperdataset (\npaperid,\ndatasetid\n)\n\nCREATE TABLE author (\nauthorid,\nauthorname\n)\n\nCREATE TABLE journal (\njournalid,\njournalname\n)\n\nCREATE TABLE keyphrase (\nkeyphraseid,\nkeyphrasename\n)\n\nCREATE TABLE paperkeyphrase (\npaperid,\nkeyphraseid\n)\n\nCREATE TABLE paper (\npaperid,\ntitle,\nvenueid,\nyear,\nnumciting,\nnumcitedby,\njournalid\n)\n\nCREATE TABLE paperfield (\nfieldid,\npaperid\n)\n\nCREATE TABLE venue (\nvenueid,\nvenuename\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- List the journals published in March , 2011\nSELECT", - "input": "", - "output": "SELECT DISTINCT journalid FROM paper WHERE year = 2011 GROUP BY journalid", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Name the classes that are available this Fall that would count toward a CS major .\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program, program_course, semester WHERE program_course.course_id = course.course_id AND program_course.course_id = course.course_id AND program.name LIKE '%CS%' AND program.program_id = program_course.program_id AND semester.semester = 'Fall' AND semester.semester_id = course_offering.semester AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me the most expensive one way flight from DETROIT to WESTCHESTER COUNTY\nSELECT", - "input": "", - "output": "SELECT DISTINCT FLIGHT_0.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, airport_service AS AIRPORT_SERVICE_3, city AS CITY_0, city AS CITY_1, city AS CITY_2, city AS CITY_3, fare, flight AS FLIGHT_0, flight AS FLIGHT_1, flight_fare AS FLIGHT_FARE, flight_fare AS FLIGHT_FARE_1 WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WESTCHESTER COUNTY' AND CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'DETROIT' AND CITY_3.city_code = AIRPORT_SERVICE_3.city_code AND CITY_3.city_name = 'WESTCHESTER COUNTY' AND fare.one_direction_cost = (SELECT MAX(FAREalias1.one_direction_cost) FROM airport_service AS AIRPORT_SERVICEalias4, airport_service AS AIRPORT_SERVICEalias5, city AS CITYalias4, city AS CITYalias5, fare AS FAREalias1, flight AS FLIGHTalias2, flight_fare AS FLIGHT_FAREalias2 WHERE CITYalias4.city_code = AIRPORT_SERVICEalias4.city_code AND CITYalias4.city_name = 'DETROIT' AND CITYalias5.city_code = AIRPORT_SERVICEalias5.city_code AND CITYalias5.city_name = 'WESTCHESTER COUNTY' AND FAREalias1.round_trip_required = 'NO' AND FLIGHT_FAREalias2.fare_id = FAREalias1.fare_id AND FLIGHTalias2.flight_id = FLIGHT_FAREalias2.flight_id AND FLIGHTalias2.from_airport = AIRPORT_SERVICEalias4.airport_code AND FLIGHTalias2.to_airport = AIRPORT_SERVICEalias5.airport_code) AND fare.round_trip_required = 'NO' AND flight_fare.fare_id = fare.fare_id AND FLIGHT_FARE_1.fare_id = fare.fare_id AND FLIGHT_0.flight_id = flight_fare.flight_id AND FLIGHT_0.to_airport = AIRPORT_SERVICE_1.airport_code AND FLIGHT_1.flight_id = FLIGHT_FARE_1.flight_id AND FLIGHT_1.from_airport = AIRPORT_SERVICE_2.airport_code AND FLIGHT_1.to_airport = AIRPORT_SERVICE_3.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DETROIT' AND FLIGHT_0.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- How many credits do I get for 417 ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT credits FROM course WHERE department = 'EECS' AND number = 417", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE author (\naid,\nhomepage,\nname,\noid\n)\n\nCREATE TABLE domain (\ndid,\nname\n)\n\nCREATE TABLE publication_keyword (\nkid,\npid\n)\n\nCREATE TABLE keyword (\nkeyword,\nkid\n)\n\nCREATE TABLE writes (\naid,\npid\n)\n\nCREATE TABLE domain_author (\naid,\ndid\n)\n\nCREATE TABLE domain_conference (\ncid,\ndid\n)\n\nCREATE TABLE domain_keyword (\ndid,\nkid\n)\n\nCREATE TABLE organization (\ncontinent,\nhomepage,\nname,\noid\n)\n\nCREATE TABLE domain_publication (\ndid,\npid\n)\n\nCREATE TABLE conference (\ncid,\nhomepage,\nname\n)\n\nCREATE TABLE journal (\nhomepage,\njid,\nname\n)\n\nCREATE TABLE publication (\nabstract,\ncid,\ncitation_num,\njid,\npid,\nreference_num,\ntitle,\nyear\n)\n\nCREATE TABLE domain_journal (\ndid,\njid\n)\n\nCREATE TABLE cite (\ncited,\nciting\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- return me the area of the VLDB conference .\nSELECT", - "input": "", - "output": "SELECT domain.name FROM conference, domain, domain_conference WHERE conference.name = 'VLDB' AND domain_conference.cid = conference.cid AND domain.did = domain_conference.did", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Is LHC 688 offered in Fall 2000 ?\nSELECT", - "input": "", - "output": "SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'LHC' AND course.number = 688 AND semester.semester = 'Fall' AND semester.semester_id = course_offering.semester AND semester.year = 2000", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE paperfield (\nfieldid,\npaperid\n)\n\nCREATE TABLE cite (\ncitingpaperid,\ncitedpaperid\n)\n\nCREATE TABLE paperdataset (\npaperid,\ndatasetid\n)\n\nCREATE TABLE journal (\njournalid,\njournalname\n)\n\nCREATE TABLE venue (\nvenueid,\nvenuename\n)\n\nCREATE TABLE field (\nfieldid\n)\n\nCREATE TABLE keyphrase (\nkeyphraseid,\nkeyphrasename\n)\n\nCREATE TABLE paperkeyphrase (\npaperid,\nkeyphraseid\n)\n\nCREATE TABLE paper (\npaperid,\ntitle,\nvenueid,\nyear,\nnumciting,\nnumcitedby,\njournalid\n)\n\nCREATE TABLE writes (\npaperid,\nauthorid\n)\n\nCREATE TABLE author (\nauthorid,\nauthorname\n)\n\nCREATE TABLE dataset (\ndatasetid,\ndatasetname\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- li dong 's paper about semantic parsing\nSELECT", - "input": "", - "output": "SELECT DISTINCT author.authorid, paper.paperid FROM author, keyphrase, paper, paperkeyphrase, writes WHERE author.authorname = 'li dong' AND keyphrase.keyphrasename = 'semantic parsing' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Are there PEDDENT courses that are 8 credit ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT name, number FROM course WHERE department = 'PEDDENT' AND credits = 8", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE field (\nfieldid\n)\n\nCREATE TABLE paperfield (\nfieldid,\npaperid\n)\n\nCREATE TABLE dataset (\ndatasetid,\ndatasetname\n)\n\nCREATE TABLE journal (\njournalid,\njournalname\n)\n\nCREATE TABLE paper (\npaperid,\ntitle,\nvenueid,\nyear,\nnumciting,\nnumcitedby,\njournalid\n)\n\nCREATE TABLE cite (\ncitingpaperid,\ncitedpaperid\n)\n\nCREATE TABLE writes (\npaperid,\nauthorid\n)\n\nCREATE TABLE author (\nauthorid,\nauthorname\n)\n\nCREATE TABLE keyphrase (\nkeyphraseid,\nkeyphrasename\n)\n\nCREATE TABLE paperkeyphrase (\npaperid,\nkeyphraseid\n)\n\nCREATE TABLE venue (\nvenueid,\nvenuename\n)\n\nCREATE TABLE paperdataset (\npaperid,\ndatasetid\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What authors wrote papers about Semantic Spaces in 2016 ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT writes.authorid FROM author, keyphrase, paper, paperkeyphrase, writes WHERE keyphrase.keyphrasename = 'Semantic Spaces' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND paper.year = 2016 AND writes.authorid = author.authorid AND writes.paperid = paper.paperid", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What time is Geoffrey Bankowski next teaching 463 ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT semester.semester, semester.year FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.number = 463 AND course_offering.semester = semester.semester_id AND instructor.name LIKE '%Geoffrey Bankowski%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester_id > (SELECT SEMESTERalias1.semester_id FROM semester AS SEMESTERalias1 WHERE SEMESTERalias1.semester = 'WN' AND SEMESTERalias1.year = 2016) ORDER BY semester.semester_id LIMIT 1", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what 's the lowest round trip fare from BWI to any city\nSELECT", - "input": "", - "output": "SELECT DISTINCT fare.fare_id FROM airport, fare, flight, flight_fare WHERE airport.airport_code = 'BWI' AND fare.round_trip_cost = (SELECT MIN(FAREalias1.round_trip_cost) FROM airport AS AIRPORTalias1, fare AS FAREalias1, flight AS FLIGHTalias1, flight_fare AS FLIGHT_FAREalias1 WHERE AIRPORTalias1.airport_code = 'BWI' AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORTalias1.airport_code) AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = airport.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- yes i would like to find what flights are available from ATLANTA to BOSTON on the morning of 7 7\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((flight.departure_time BETWEEN 0 AND 1200) AND date_day.day_number = 7 AND date_day.month_number = 7 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE domain_keyword (\ndid,\nkid\n)\n\nCREATE TABLE domain_journal (\ndid,\njid\n)\n\nCREATE TABLE author (\naid,\nhomepage,\nname,\noid\n)\n\nCREATE TABLE domain_conference (\ncid,\ndid\n)\n\nCREATE TABLE publication_keyword (\nkid,\npid\n)\n\nCREATE TABLE domain (\ndid,\nname\n)\n\nCREATE TABLE writes (\naid,\npid\n)\n\nCREATE TABLE keyword (\nkeyword,\nkid\n)\n\nCREATE TABLE domain_publication (\ndid,\npid\n)\n\nCREATE TABLE conference (\ncid,\nhomepage,\nname\n)\n\nCREATE TABLE journal (\nhomepage,\njid,\nname\n)\n\nCREATE TABLE publication (\nabstract,\ncid,\ncitation_num,\njid,\npid,\nreference_num,\ntitle,\nyear\n)\n\nCREATE TABLE cite (\ncited,\nciting\n)\n\nCREATE TABLE organization (\ncontinent,\nhomepage,\nname,\noid\n)\n\nCREATE TABLE domain_author (\naid,\ndid\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- return me the keywords, which have been contained by more than 10 papers of ' H. V. Jagadish ' .\nSELECT", - "input": "", - "output": "SELECT keyword.keyword FROM author, keyword, publication, publication_keyword, writes WHERE author.name = 'H. V. Jagadish' AND publication_keyword.kid = keyword.kid AND publication.pid = publication_keyword.pid AND writes.aid = author.aid AND writes.pid = publication.pid GROUP BY keyword.keyword HAVING COUNT(DISTINCT (publication.title)) > 10", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE domain_journal (\ndid,\njid\n)\n\nCREATE TABLE publication (\nabstract,\ncid,\ncitation_num,\njid,\npid,\nreference_num,\ntitle,\nyear\n)\n\nCREATE TABLE domain_conference (\ncid,\ndid\n)\n\nCREATE TABLE writes (\naid,\npid\n)\n\nCREATE TABLE organization (\ncontinent,\nhomepage,\nname,\noid\n)\n\nCREATE TABLE cite (\ncited,\nciting\n)\n\nCREATE TABLE domain_publication (\ndid,\npid\n)\n\nCREATE TABLE keyword (\nkeyword,\nkid\n)\n\nCREATE TABLE domain_author (\naid,\ndid\n)\n\nCREATE TABLE conference (\ncid,\nhomepage,\nname\n)\n\nCREATE TABLE domain (\ndid,\nname\n)\n\nCREATE TABLE journal (\nhomepage,\njid,\nname\n)\n\nCREATE TABLE domain_keyword (\ndid,\nkid\n)\n\nCREATE TABLE publication_keyword (\nkid,\npid\n)\n\nCREATE TABLE author (\naid,\nhomepage,\nname,\noid\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- return me the keywords, which have been contained by more than 100 papers in VLDB conference .\nSELECT", - "input": "", - "output": "SELECT keyword.keyword FROM conference, keyword, publication, publication_keyword WHERE conference.name = 'VLDB' AND publication_keyword.kid = keyword.kid AND publication.cid = conference.cid AND publication.pid = publication_keyword.pid GROUP BY keyword.keyword HAVING COUNT(DISTINCT (publication.title)) > 100", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE producer (\npid,\ngender,\nname,\nnationality,\nbirth_city,\nbirth_year\n)\n\nCREATE TABLE keyword (\nid,\nkeyword\n)\n\nCREATE TABLE tv_series (\nsid,\ntitle,\nrelease_year,\nnum_of_seasons,\nnum_of_episodes,\ntitle_aka,\nbudget\n)\n\nCREATE TABLE cast (\nid,\nmsid,\naid,\nrole\n)\n\nCREATE TABLE writer (\nwid,\ngender,\nname,\nnationality,\nbirth_city,\nbirth_year\n)\n\nCREATE TABLE tags (\nid,\nmsid,\nkid\n)\n\nCREATE TABLE directed_by (\nid,\nmsid,\ndid\n)\n\nCREATE TABLE director (\ndid,\ngender,\nname,\nnationality,\nbirth_city,\nbirth_year\n)\n\nCREATE TABLE company (\nid,\nname,\ncountry_code\n)\n\nCREATE TABLE genre (\ngid,\ngenre\n)\n\nCREATE TABLE made_by (\nid,\nmsid,\npid\n)\n\nCREATE TABLE actor (\naid,\ngender,\nname,\nnationality,\nbirth_city,\nbirth_year\n)\n\nCREATE TABLE written_by (\nid,\nmsid,\nwid\n)\n\nCREATE TABLE copyright (\nid,\nmsid,\ncid\n)\n\nCREATE TABLE classification (\nid,\nmsid,\ngid\n)\n\nCREATE TABLE movie (\nmid,\ntitle,\nrelease_year,\ntitle_aka,\nbudget\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What is the number of movies that ' Brad Pitt ' acts in per year ?\nSELECT", - "input": "", - "output": "SELECT COUNT(DISTINCT (movie.title)), movie.release_year FROM actor, cast, movie WHERE actor.name = 'Brad Pitt' AND cast.aid = actor.aid AND movie.mid = cast.msid GROUP BY movie.release_year", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me the flights from SAN FRANCISCO to DALLAS on CO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'CO'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- are there any flights available from BALTIMORE to DALLAS monday afternoon\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND date_day.day_number = 21 AND date_day.month_number = 2 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time BETWEEN 1200 AND 1800", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what states border the state with the most cities\nSELECT", - "input": "", - "output": "SELECT border FROM border_info WHERE state_name IN (SELECT DERIVED_TABLEalias0.state_name FROM (SELECT CITYalias0.state_name, COUNT(1) AS DERIVED_FIELDalias0 FROM city AS CITYalias0 GROUP BY CITYalias0.state_name) AS DERIVED_TABLEalias0 WHERE DERIVED_TABLEalias0.DERIVED_FIELDalias0 = (SELECT MAX(DERIVED_TABLEalias1.DERIVED_FIELDalias1) FROM (SELECT COUNT(1) AS DERIVED_FIELDalias1 FROM city AS CITYalias1 GROUP BY CITYalias1.state_name) AS DERIVED_TABLEalias1))", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- in ATLANTA i would like information on ground transportation\nSELECT", - "input": "", - "output": "SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'ATLANTA' AND ground_service.city_code = city.city_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me flights from PHILADELPHIA to OAKLAND on friday\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND' AND date_day.day_number = 25 AND date_day.month_number = 6 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- which airlines have flights between CHARLOTTE and NEWARK\nSELECT", - "input": "", - "output": "SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CHARLOTTE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NEWARK' AND flight.airline_code = airline.airline_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what are the flights between PITTSBURGH and SAN FRANCISCO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what flights are there from BALTIMORE to SAN FRANCISCO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what flights do you have leaving BOSTON going to SAN FRANCISCO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- MEDADM 571 in Winter 2013 , how many professors teach these ?\nSELECT", - "input": "", - "output": "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 = 'MEDADM' AND course.number = 571 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'Winter' AND semester.semester_id = course_offering.semester AND semester.year = 2013", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Is DHYGRACK 685 required to take the course DHYGRACK 689 ?\nSELECT", - "input": "", - "output": "SELECT COUNT(*) > 0 FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_0.department = 'DHYGRACK' AND COURSE_0.number = 685 AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'DHYGRACK' AND COURSE_1.number = 689", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what flights are there from BOSTON to DENVER on monday morning\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND date_day.day_number = 21 AND date_day.month_number = 2 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time BETWEEN 0 AND 1200", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what is the ground transportation available in BOSTON\nSELECT", - "input": "", - "output": "SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'BOSTON' AND ground_service.city_code = city.city_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Which class could be the easiest to fulfill the Other requirement ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%Other%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%Other%')", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show flights between DENVER and SAN FRANCISCO for 9 17\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND date_day.day_number = 17 AND date_day.month_number = 9 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what airlines fly between SAN FRANCISCO and DENVER\nSELECT", - "input": "", - "output": "SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.airline_code = airline.airline_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- how many states border colorado and border new mexico\nSELECT", - "input": "", - "output": "SELECT COUNT(border) FROM border_info WHERE border IN (SELECT BORDER_INFOalias1.border FROM border_info AS BORDER_INFOalias1 WHERE BORDER_INFOalias1.state_name = 'new mexico') AND state_name = 'colorado'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what is the last flight of the day to leave BALTIMORE for BOSTON\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.departure_time = (SELECT MAX(FLIGHTalias1.departure_time) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, flight AS FLIGHTalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'BALTIMORE' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'BOSTON' AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- DALLAS to SAN FRANCISCO leaving after 1600 in the afternoon please\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.departure_time > 1600 AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what 's the ground transportation from OAKLAND to SAN FRANCISCO\nSELECT", - "input": "", - "output": "SELECT DISTINCT ground_service.transport_type FROM city AS CITY_0, city AS CITY_1, ground_service WHERE CITY_0.city_name = 'OAKLAND' AND CITY_1.city_name = 'SAN FRANCISCO' AND ground_service.city_code = CITY_0.city_code AND ground_service.city_code = CITY_1.city_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me the CO flights leaving CHICAGO early saturday morning\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service, city, date_day, days, flight WHERE (((flight.airline_code = 'CO') AND date_day.day_number = 26 AND date_day.month_number = 7 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code) AND (flight.departure_time BETWEEN 0 AND 800)) AND city.city_code = airport_service.city_code AND city.city_name = 'CHICAGO' AND flight.from_airport = airport_service.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i would like the 1 flight from DALLAS into HOUSTON on 3 1 and the last flight from HOUSTON back to DALLAS on 3 1\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((date_day.day_number = 1 AND date_day.month_number = 3 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time = (SELECT MAX(FLIGHTalias2.departure_time) FROM airport_service AS AIRPORT_SERVICEalias4, airport_service AS AIRPORT_SERVICEalias5, city AS CITYalias4, city AS CITYalias5, date_day AS DATE_DAYalias2, days AS DAYSalias2, flight AS FLIGHTalias2 WHERE (CITYalias5.city_code = AIRPORT_SERVICEalias5.city_code AND CITYalias5.city_name = 'DALLAS' AND DATE_DAYalias2.day_number = 1 AND DATE_DAYalias2.month_number = 3 AND DATE_DAYalias2.year = 1991 AND DAYSalias2.day_name = DATE_DAYalias2.day_name AND FLIGHTalias2.flight_days = DAYSalias2.days_code AND FLIGHTalias2.to_airport = AIRPORT_SERVICEalias5.airport_code) AND CITYalias4.city_code = AIRPORT_SERVICEalias4.city_code AND CITYalias4.city_name = 'HOUSTON' AND FLIGHTalias2.from_airport = AIRPORT_SERVICEalias4.airport_code) AND flight.flight_days = days.days_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'HOUSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) OR (((date_day.day_number = 1 AND date_day.month_number = 3 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time = (SELECT MIN(FLIGHTalias1.departure_time) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, date_day AS DATE_DAYalias1, days AS DAYSalias1, flight AS FLIGHTalias1 WHERE (CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'HOUSTON' AND DATE_DAYalias1.day_number = 1 AND DATE_DAYalias1.month_number = 3 AND DATE_DAYalias1.year = 1991 AND DAYSalias1.day_name = DATE_DAYalias1.day_name AND FLIGHTalias1.flight_days = DAYSalias1.days_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'DALLAS' AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code) AND flight.flight_days = days.days_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'HOUSTON' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what flights go from BOSTON to ATLANTA next tuesday\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND date_day.day_number = 22 AND date_day.month_number = 3 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me all direct flights from DALLAS FORT WORTH to either SAN FRANCISCO or OAKLAND\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, airport_service AS AIRPORT_SERVICE_3, city AS CITY_0, city AS CITY_1, city AS CITY_2, city AS CITY_3, flight WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS FORT WORTH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND ((flight.to_airport = AIRPORT_SERVICE_2.airport_code AND CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'SAN FRANCISCO') OR (flight.to_airport = AIRPORT_SERVICE_3.airport_code AND CITY_3.city_code = AIRPORT_SERVICE_3.city_code AND CITY_3.city_name = 'OAKLAND'))) AND flight.connections = 0", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Is EDUC 831 a required course for my major ?\nSELECT", - "input": "", - "output": "SELECT COUNT(*) > 0 FROM course, program_course WHERE course.department = 'EDUC' AND course.number = 831 AND program_course.category LIKE '%Core%' AND program_course.course_id = course.course_id", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- get me a FIRST class flight on AA to SAN FRANCISCO on tuesday next week\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service, city, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis AS FARE_BASIS_0, fare_basis AS FARE_BASIS_1, flight, flight_fare WHERE ((DATE_DAY_0.day_number = 22 AND DATE_DAY_0.month_number = 3 AND DATE_DAY_0.year = 1991 AND DATE_DAY_1.day_number = 22 AND DATE_DAY_1.month_number = 3 AND DATE_DAY_1.year = 1991 AND DAYS_0.day_name = DATE_DAY_0.day_name AND DAYS_1.day_name = DATE_DAY_1.day_name AND FARE_BASIS_0.class_type = 'FIRST' AND FARE_BASIS_1.basis_days = DAYS_1.days_code AND fare.fare_basis_code = FARE_BASIS_0.fare_basis_code AND fare.fare_basis_code = FARE_BASIS_1.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.flight_days = DAYS_0.days_code AND flight.flight_id = flight_fare.flight_id) AND city.city_code = airport_service.city_code AND city.city_name = 'SAN FRANCISCO' AND flight.to_airport = airport_service.airport_code) AND flight.airline_code = 'AA'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What are the 6 -credit courses offered ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT name, number FROM course WHERE credits = 6 AND department = 'EECS'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me all flights from ATLANTA to SAN FRANCISCO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- flights from ATLANTA please\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'ATLANTA' AND flight.from_airport = airport_service.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Do any upper-level classes not have 575 as a prerequisite ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT department, name, number FROM course WHERE (description LIKE '%topic0%' OR name LIKE '%topic0%') AND department = 'EECS'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what DL leaves BOSTON for ATLANTA\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'DL'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Is it mandatory for graduation for me to take KINESLGY 995 ?\nSELECT", - "input": "", - "output": "SELECT COUNT(*) > 0 FROM course, program_course WHERE course.department = 'KINESLGY' AND course.number = 995 AND program_course.category LIKE '%Core%' AND program_course.course_id = course.course_id", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i'd like to know if you have any flights from DENVER to PHILADELPHIA\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what flights do you have from ONTARIO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'ONTARIO' AND flight.from_airport = airport_service.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me CO flights from CHICAGO to SEATTLE on saturday morning\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SEATTLE' AND date_day.day_number = 26 AND date_day.month_number = 7 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CHICAGO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.airline_code = 'CO') AND flight.departure_time BETWEEN 0 AND 1200", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- In the morning , what times are there for the FRENCH 490 course ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course_offering.end_time, course_offering.start_time, semester.semester, semester.year FROM course, course_offering, semester WHERE course_offering.start_time < '12:00:00' AND course_offering.start_time >= '08:00:00' AND course.course_id = course_offering.course_id AND course.department = 'FRENCH' AND course.number = 490 AND semester.semester = 'semester0' AND semester.semester_id = course_offering.semester AND semester.year = year0", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE dataset (\ndatasetid,\ndatasetname\n)\n\nCREATE TABLE cite (\ncitingpaperid,\ncitedpaperid\n)\n\nCREATE TABLE paperfield (\nfieldid,\npaperid\n)\n\nCREATE TABLE paperkeyphrase (\npaperid,\nkeyphraseid\n)\n\nCREATE TABLE writes (\npaperid,\nauthorid\n)\n\nCREATE TABLE journal (\njournalid,\njournalname\n)\n\nCREATE TABLE venue (\nvenueid,\nvenuename\n)\n\nCREATE TABLE paperdataset (\npaperid,\ndatasetid\n)\n\nCREATE TABLE paper (\npaperid,\ntitle,\nvenueid,\nyear,\nnumciting,\nnumcitedby,\njournalid\n)\n\nCREATE TABLE field (\nfieldid\n)\n\nCREATE TABLE author (\nauthorid,\nauthorname\n)\n\nCREATE TABLE keyphrase (\nkeyphraseid,\nkeyphrasename\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- How many papers did Luke Campbell write last year ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT COUNT(paper.paperid) FROM author, paper, writes WHERE author.authorname = 'Luke Campbell' AND paper.year = YEAR(CURDATE()) - 1 AND writes.authorid = author.authorid AND writes.paperid = paper.paperid", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- list all flights departing from SEATTLE\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE city.city_code = airport_service.city_code AND city.city_name = 'SEATTLE' AND flight.from_airport = airport_service.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE business (\nbid,\nbusiness_id,\nname,\nfull_address,\ncity,\nlatitude,\nlongitude,\nreview_count,\nis_open,\nrating,\nstate\n)\n\nCREATE TABLE category (\nid,\nbusiness_id,\ncategory_name\n)\n\nCREATE TABLE neighborhood (\nid,\nbusiness_id,\nneighborhood_name\n)\n\nCREATE TABLE user (\nuid,\nuser_id,\nname\n)\n\nCREATE TABLE checkin (\ncid,\nbusiness_id,\ncount,\nday\n)\n\nCREATE TABLE tip (\ntip_id,\nbusiness_id,\ntext,\nuser_id,\nlikes,\nyear,\nmonth\n)\n\nCREATE TABLE review (\nrid,\nbusiness_id,\nuser_id,\nrating,\ntext,\nyear,\nmonth\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Find users whose average review rating is below 3\nSELECT", - "input": "", - "output": "SELECT user.name FROM review, user WHERE user.user_id = review.user_id GROUP BY user.name HAVING AVG(review.rating) < 3", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- which state has the highest point\nSELECT", - "input": "", - "output": "SELECT state_name FROM highlow WHERE highest_elevation = (SELECT MAX(HIGHLOWalias1.highest_elevation) FROM highlow AS HIGHLOWalias1)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What do you think is the easiest class I can take to fulfill the Other requirement ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%Other%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%Other%')", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i would like an evening flight from PITTSBURGH to LOS ANGELES on 6 3\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LOS ANGELES' AND date_day.day_number = 3 AND date_day.month_number = 6 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time BETWEEN 1800 AND 2200", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what airlines are there\nSELECT", - "input": "", - "output": "SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'DENVER' AND flight_stop.stop_airport = AIRPORT_SERVICE_2.airport_code AND flight.flight_id = flight_stop.flight_id AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND flight.airline_code = airline.airline_code AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- please list the flights from TORONTO to WASHINGTON\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'TORONTO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- how many states are in the united states\nSELECT", - "input": "", - "output": "SELECT COUNT(state_name) FROM state", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE paperkeyphrase (\npaperid,\nkeyphraseid\n)\n\nCREATE TABLE venue (\nvenueid,\nvenuename\n)\n\nCREATE TABLE dataset (\ndatasetid,\ndatasetname\n)\n\nCREATE TABLE keyphrase (\nkeyphraseid,\nkeyphrasename\n)\n\nCREATE TABLE paperdataset (\npaperid,\ndatasetid\n)\n\nCREATE TABLE paperfield (\nfieldid,\npaperid\n)\n\nCREATE TABLE writes (\npaperid,\nauthorid\n)\n\nCREATE TABLE journal (\njournalid,\njournalname\n)\n\nCREATE TABLE paper (\npaperid,\ntitle,\nvenueid,\nyear,\nnumciting,\nnumcitedby,\njournalid\n)\n\nCREATE TABLE cite (\ncitingpaperid,\ncitedpaperid\n)\n\nCREATE TABLE author (\nauthorid,\nauthorname\n)\n\nCREATE TABLE field (\nfieldid\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- number of papers in sigir conference\nSELECT", - "input": "", - "output": "SELECT DISTINCT COUNT(paper.paperid) FROM paper, venue WHERE venue.venueid = paper.venueid AND venue.venuename = 'sigir'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me the flights from CLEVELAND to MEMPHIS\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CLEVELAND' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MEMPHIS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i want the flights from DENVER to PITTSBURGH\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE author (\nauthorid,\nauthorname\n)\n\nCREATE TABLE paperdataset (\npaperid,\ndatasetid\n)\n\nCREATE TABLE keyphrase (\nkeyphraseid,\nkeyphrasename\n)\n\nCREATE TABLE paperfield (\nfieldid,\npaperid\n)\n\nCREATE TABLE field (\nfieldid\n)\n\nCREATE TABLE cite (\ncitingpaperid,\ncitedpaperid\n)\n\nCREATE TABLE paper (\npaperid,\ntitle,\nvenueid,\nyear,\nnumciting,\nnumcitedby,\njournalid\n)\n\nCREATE TABLE paperkeyphrase (\npaperid,\nkeyphraseid\n)\n\nCREATE TABLE venue (\nvenueid,\nvenuename\n)\n\nCREATE TABLE writes (\npaperid,\nauthorid\n)\n\nCREATE TABLE journal (\njournalid,\njournalname\n)\n\nCREATE TABLE dataset (\ndatasetid,\ndatasetname\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- papers from 2014\nSELECT", - "input": "", - "output": "SELECT DISTINCT paperid FROM paper WHERE year = 2014", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me flights from OAKLAND to DALLAS on sunday\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND date_day.day_number = 27 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'OAKLAND' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Which Fall or Winter classes can I take in order to meet my Other requirement ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT COURSEalias0.department, COURSEalias0.name, COURSEalias0.number, SEMESTERalias0.semester FROM (SELECT course_id FROM student_record WHERE earn_credit = 'Y' AND student_id = 1) AS DERIVED_TABLEalias0, course AS COURSEalias0, course_offering AS COURSE_OFFERINGalias0, program_course AS PROGRAM_COURSEalias0, semester AS SEMESTERalias0 WHERE COURSEalias0.course_id = COURSE_OFFERINGalias0.course_id AND NOT COURSEalias0.course_id IN (DERIVED_TABLEalias0.course_id) AND NOT COURSEalias0.course_id IN (SELECT DISTINCT COURSE_PREREQUISITEalias0.course_id FROM course_prerequisite AS COURSE_PREREQUISITEalias0 WHERE NOT COURSE_PREREQUISITEalias0.pre_course_id IN (DERIVED_TABLEalias0.course_id)) AND COURSEalias0.department = 'department0' AND PROGRAM_COURSEalias0.category LIKE '%Other%' AND PROGRAM_COURSEalias0.course_id = COURSE_OFFERINGalias0.course_id AND SEMESTERalias0.semester IN ('FA', 'WN') AND SEMESTERalias0.semester_id = COURSE_OFFERINGalias0.semester AND SEMESTERalias0.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE user (\nuid,\nuser_id,\nname\n)\n\nCREATE TABLE tip (\ntip_id,\nbusiness_id,\ntext,\nuser_id,\nlikes,\nyear,\nmonth\n)\n\nCREATE TABLE neighborhood (\nid,\nbusiness_id,\nneighborhood_name\n)\n\nCREATE TABLE checkin (\ncid,\nbusiness_id,\ncount,\nday\n)\n\nCREATE TABLE business (\nbid,\nbusiness_id,\nname,\nfull_address,\ncity,\nlatitude,\nlongitude,\nreview_count,\nis_open,\nrating,\nstate\n)\n\nCREATE TABLE category (\nid,\nbusiness_id,\ncategory_name\n)\n\nCREATE TABLE review (\nrid,\nbusiness_id,\nuser_id,\nrating,\ntext,\nyear,\nmonth\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Find the average number of checkins in restaurant ' Barrio Cafe ' per day\nSELECT", - "input": "", - "output": "SELECT AVG(checkin.count), checkin.day FROM business, category, checkin WHERE business.name = 'Barrio Cafe' AND category.business_id = business.business_id AND category.category_name = 'restaurant' AND checkin.business_id = business.business_id GROUP BY checkin.day", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what is the latest flight from SALT LAKE CITY to PHOENIX\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SALT LAKE CITY' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHOENIX' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.departure_time = (SELECT MAX(FLIGHTalias1.departure_time) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, flight AS FLIGHTalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'SALT LAKE CITY' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'PHOENIX' AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- return from MIAMI to NEW YORK on FF on SATURDAY\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days, flight WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'MIAMI' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'NEW YORK' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND days.day_name = 'SATURDAY' AND flight.flight_days = days.days_code) AND flight.airline_code = 'FF'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What are the requirements to get a CS-LSA degree ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT program_requirement.additional_req, program_requirement.category, program_requirement.min_credit, program.name FROM program, program_requirement WHERE program.name LIKE '%CS-LSA%' AND program.program_id = program_requirement.program_id", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- please list all flights between BOSTON and ATLANTA\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i'd like to know the earliest flight from BOSTON to SAN FRANCISCO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.departure_time = (SELECT MIN(FLIGHTalias1.departure_time) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, flight AS FLIGHTalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'BOSTON' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'SAN FRANCISCO' AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me the flights from OAKLAND to DENVER\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'OAKLAND' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what flights leave CHARLOTTE NORTH CAROLINA and arrive in PHOENIX ARIZONA on monday before 1600\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight, state AS STATE_0, state AS STATE_1 WHERE ((date_day.day_number = 21 AND date_day.month_number = 2 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.arrival_time < 1600 AND flight.flight_days = days.days_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHOENIX' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code AND STATE_1.state_code = CITY_1.state_code AND STATE_1.state_name = 'ARIZONA') AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CHARLOTTE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND STATE_0.state_code = CITY_0.state_code AND STATE_0.state_name = 'NORTH CAROLINA'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- ground transportation please in the city of BOS between airport and downtown\nSELECT", - "input": "", - "output": "SELECT DISTINCT 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_name = 'BOSTON' AND CITY_1.city_code = airport_service.city_code AND CITY_1.city_name = 'BOSTON' AND ground_service.airport_code = airport.airport_code AND ground_service.city_code = CITY_0.city_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- How often does the class YIDDISH 531 meet ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'YIDDISH' AND course.number = 531 AND semester.semester = 'WN' AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- In Spring and Summer how many 300 -level classes are being offered ?\nSELECT", - "input": "", - "output": "SELECT COUNT(DISTINCT course.course_id, semester.semester) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'department0' AND course.number BETWEEN 300 AND 300 + 100 AND semester.semester IN ('SP', 'SS', 'SU') AND semester.semester_id = course_offering.semester AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what flights from MEMPHIS to MIAMI on wednesday\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MIAMI' AND date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'MEMPHIS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- list all nonstop flights from LOS ANGELES to PITTSBURGH before 1700 on tuesday\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((date_day.day_number = 22 AND date_day.month_number = 3 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time < 1700 AND flight.flight_days = days.days_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'LOS ANGELES' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.stops = 0", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Out of EECS 388 and EECS 301 , which one is more effortless ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (course.number = 388 OR course.number = 301) AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN course AS COURSEalias1 ON PROGRAM_COURSEalias1.course_id = COURSEalias1.course_id WHERE (COURSEalias1.number = 388 OR COURSEalias1.number = 301) AND COURSEalias1.department = 'EECS')", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Does Dennis Capozza teach the class ENVIRON 377 ?\nSELECT", - "input": "", - "output": "SELECT COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'ENVIRON' AND course.number = 377 AND instructor.name LIKE '%Dennis Capozza%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i need a ticket from NASHVILLE to SEATTLE\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'NASHVILLE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SEATTLE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- the most expensive flight between BOSTON and PHILADELPHIA\nSELECT", - "input": "", - "output": "SELECT DISTINCT FLIGHT_0.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, airport_service AS AIRPORT_SERVICE_3, city AS CITY_0, city AS CITY_1, city AS CITY_2, city AS CITY_3, fare, flight AS FLIGHT_0, flight AS FLIGHT_1, flight_fare AS FLIGHT_FARE, flight_fare AS FLIGHT_FARE_1 WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'BOSTON' AND CITY_3.city_code = AIRPORT_SERVICE_3.city_code AND CITY_3.city_name = 'PHILADELPHIA' AND fare.one_direction_cost = (SELECT MAX(FAREalias1.one_direction_cost) FROM airport_service AS AIRPORT_SERVICEalias4, airport_service AS AIRPORT_SERVICEalias5, city AS CITYalias4, city AS CITYalias5, fare AS FAREalias1, flight AS FLIGHTalias2, flight_fare AS FLIGHT_FAREalias2 WHERE CITYalias4.city_code = AIRPORT_SERVICEalias4.city_code AND CITYalias4.city_name = 'BOSTON' AND CITYalias5.city_code = AIRPORT_SERVICEalias5.city_code AND CITYalias5.city_name = 'PHILADELPHIA' AND FLIGHT_FAREalias2.fare_id = FAREalias1.fare_id AND FLIGHTalias2.flight_id = FLIGHT_FAREalias2.flight_id AND FLIGHTalias2.from_airport = AIRPORT_SERVICEalias4.airport_code AND FLIGHTalias2.to_airport = AIRPORT_SERVICEalias5.airport_code) AND flight_fare.fare_id = fare.fare_id AND FLIGHT_FARE_1.fare_id = fare.fare_id AND FLIGHT_0.flight_id = flight_fare.flight_id AND FLIGHT_0.to_airport = AIRPORT_SERVICE_1.airport_code AND FLIGHT_1.flight_id = FLIGHT_FARE_1.flight_id AND FLIGHT_1.from_airport = AIRPORT_SERVICE_2.airport_code AND FLIGHT_1.to_airport = AIRPORT_SERVICE_3.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND FLIGHT_0.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i'd like to make a round trip from LOS ANGELES to NEWARK by way of CHARLOTTE\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, airport_service AS AIRPORT_SERVICE_3, city AS CITY_0, city AS CITY_1, city AS CITY_2, city AS CITY_3, flight, flight_stop AS FLIGHT_STOP_0, flight_stop AS FLIGHT_STOP_1 WHERE ((CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'LOS ANGELES' AND FLIGHT_STOP_0.stop_airport = AIRPORT_SERVICE_2.airport_code AND flight.flight_id = FLIGHT_STOP_0.flight_id) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CHARLOTTE' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'NEWARK' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what nonstop flights between ATLANTA and WASHINGTON leave ATLANTA after 1800 o'clock pm\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND flight.departure_time > 1800 AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.stops = 0", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i'd like to find the least expensive one way fare from BOSTON to PHILADELPHIA\nSELECT", - "input": "", - "output": "SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND fare.one_direction_cost = (SELECT MIN(FAREalias1.one_direction_cost) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, fare AS FAREalias1, flight AS FLIGHTalias1, flight_fare AS FLIGHT_FAREalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'BOSTON' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'PHILADELPHIA' AND FAREalias1.round_trip_required = 'NO' AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND fare.round_trip_required = 'NO' AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What 's the name of the department with Honors Anthropology ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT department FROM course WHERE name LIKE '%Honors Anthropology%'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- please show me flights from PITTSBURGH to ATLANTA on wednesday morning serving BREAKFAST\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight, food_service WHERE (((date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND food_service.meal_code = flight.meal_code AND food_service.meal_description = 'BREAKFAST') AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time BETWEEN 0 AND 1200", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show flights between TORONTO and SAN FRANCISCO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'TORONTO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE paperkeyphrase (\npaperid,\nkeyphraseid\n)\n\nCREATE TABLE paper (\npaperid,\ntitle,\nvenueid,\nyear,\nnumciting,\nnumcitedby,\njournalid\n)\n\nCREATE TABLE journal (\njournalid,\njournalname\n)\n\nCREATE TABLE venue (\nvenueid,\nvenuename\n)\n\nCREATE TABLE keyphrase (\nkeyphraseid,\nkeyphrasename\n)\n\nCREATE TABLE field (\nfieldid\n)\n\nCREATE TABLE dataset (\ndatasetid,\ndatasetname\n)\n\nCREATE TABLE writes (\npaperid,\nauthorid\n)\n\nCREATE TABLE paperdataset (\npaperid,\ndatasetid\n)\n\nCREATE TABLE author (\nauthorid,\nauthorname\n)\n\nCREATE TABLE paperfield (\nfieldid,\npaperid\n)\n\nCREATE TABLE cite (\ncitingpaperid,\ncitedpaperid\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Donald Elmazi citation count\nSELECT", - "input": "", - "output": "SELECT DISTINCT COUNT(cite.citedpaperid) FROM author, cite, paper, writes WHERE author.authorname = 'Donald Elmazi' AND paper.paperid = cite.citedpaperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- please list the flights from PHILADELPHIA to TORONTO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'TORONTO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Dr. Galina Grom , what classes has he taught in the past ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course_offering.semester < (SELECT SEMESTERalias0.semester_id FROM semester AS SEMESTERalias0 WHERE SEMESTERalias0.semester = 'WN' AND SEMESTERalias0.year = 2016) AND course.course_id = course_offering.course_id AND instructor.name LIKE '%Galina Grom%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- please list the flights for me that leave DALLAS on tuesday morning and arrive in ATLANTA\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND date_day.day_number = 22 AND date_day.month_number = 3 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DALLAS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time BETWEEN 0 AND 1200", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE paperdataset (\npaperid,\ndatasetid\n)\n\nCREATE TABLE dataset (\ndatasetid,\ndatasetname\n)\n\nCREATE TABLE venue (\nvenueid,\nvenuename\n)\n\nCREATE TABLE paperfield (\nfieldid,\npaperid\n)\n\nCREATE TABLE paper (\npaperid,\ntitle,\nvenueid,\nyear,\nnumciting,\nnumcitedby,\njournalid\n)\n\nCREATE TABLE keyphrase (\nkeyphraseid,\nkeyphrasename\n)\n\nCREATE TABLE field (\nfieldid\n)\n\nCREATE TABLE author (\nauthorid,\nauthorname\n)\n\nCREATE TABLE writes (\npaperid,\nauthorid\n)\n\nCREATE TABLE paperkeyphrase (\npaperid,\nkeyphraseid\n)\n\nCREATE TABLE journal (\njournalid,\njournalname\n)\n\nCREATE TABLE cite (\ncitingpaperid,\ncitedpaperid\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What venues are for Neuroscience ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT venueid FROM venue WHERE venuename = 'Neuroscience'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What courses offered in Fall or Winter meet the MDE requirement ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id WHERE program_course.category LIKE '%MDE%' AND semester.semester IN ('FA', 'WN') AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i would like to see the flights from DENVER to PHILADELPHIA\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i'd like to arrange a flight from PITTSBURGH to ATLANTA\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what 's the capacity of an F28\nSELECT", - "input": "", - "output": "SELECT DISTINCT aircraft_code FROM aircraft WHERE basic_type = 'F28'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Next semester , will STDABRD 368 be available ?\nSELECT", - "input": "", - "output": "SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'STDABRD' AND course.number = 368 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Who is the instructor for course MATSCIE 360 ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'MATSCIE' AND course.number = 360 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Which courses in LATIN can be taken for 3 credits ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT name, number FROM course WHERE department = 'LATIN' AND credits = 3", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what is the cheapest fare from WASHINGTON to SAN FRANCISCO leaving on 9 30\nSELECT", - "input": "", - "output": "SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND DATE_DAY_1.day_number = 30 AND DATE_DAY_1.month_number = 9 AND DATE_DAY_1.year = 1991 AND DAYS_1.day_name = DATE_DAY_1.day_name AND flight.flight_days = DAYS_1.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND DATE_DAY_0.day_number = 30 AND DATE_DAY_0.month_number = 9 AND DATE_DAY_0.year = 1991 AND DAYS_0.day_name = DATE_DAY_0.day_name AND fare_basis.basis_days = DAYS_0.days_code AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND fare.one_direction_cost = (SELECT MIN(FAREalias1.one_direction_cost) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, date_day AS DATE_DAYalias2, date_day AS DATE_DAYalias3, days AS DAYSalias2, days AS DAYSalias3, fare AS FAREalias1, fare_basis AS FARE_BASISalias1, flight AS FLIGHTalias1, flight_fare AS FLIGHT_FAREalias1 WHERE (CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'SAN FRANCISCO' AND DATE_DAYalias3.day_number = 30 AND DATE_DAYalias3.month_number = 9 AND DATE_DAYalias3.year = 1991 AND DAYSalias3.day_name = DATE_DAYalias3.day_name AND FLIGHTalias1.flight_days = DAYSalias3.days_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'WASHINGTON' AND DATE_DAYalias2.day_number = 30 AND DATE_DAYalias2.month_number = 9 AND DATE_DAYalias2.year = 1991 AND DAYSalias2.day_name = DATE_DAYalias2.day_name AND FARE_BASISalias1.basis_days = DAYSalias2.days_code AND FAREalias1.fare_basis_code = FARE_BASISalias1.fare_basis_code AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Which class would be the easiest class for me to take to meet the ULCS requirement ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%ULCS%')", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what are all flights from BOSTON to DENVER\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i would like to see the DAILY flights from BALTIMORE to PHILADELPHIA\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.flight_days = 'DAILY'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- how long does it take to fly from BOSTON to ATLANTA\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.time_elapsed FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i need a return flight from CHICAGO to KANSAS CITY leaving CHICAGO around 7 in the evening next thursday\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (((flight.departure_time BETWEEN 1930 AND 1830) AND date_day.day_number = 24 AND date_day.month_number = 5 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'KANSAS CITY' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CHICAGO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE field (\nfieldid\n)\n\nCREATE TABLE cite (\ncitingpaperid,\ncitedpaperid\n)\n\nCREATE TABLE keyphrase (\nkeyphraseid,\nkeyphrasename\n)\n\nCREATE TABLE paperfield (\nfieldid,\npaperid\n)\n\nCREATE TABLE venue (\nvenueid,\nvenuename\n)\n\nCREATE TABLE paperdataset (\npaperid,\ndatasetid\n)\n\nCREATE TABLE author (\nauthorid,\nauthorname\n)\n\nCREATE TABLE journal (\njournalid,\njournalname\n)\n\nCREATE TABLE paper (\npaperid,\ntitle,\nvenueid,\nyear,\nnumciting,\nnumcitedby,\njournalid\n)\n\nCREATE TABLE writes (\npaperid,\nauthorid\n)\n\nCREATE TABLE paperkeyphrase (\npaperid,\nkeyphraseid\n)\n\nCREATE TABLE dataset (\ndatasetid,\ndatasetname\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what are popular datasets used in structured prediction\nSELECT", - "input": "", - "output": "SELECT DISTINCT COUNT(1), dataset.datasetid FROM dataset, keyphrase, paperdataset, paperkeyphrase WHERE keyphrase.keyphrasename = 'structured prediction' AND paperdataset.datasetid = dataset.datasetid AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paperkeyphrase.paperid = paperdataset.paperid GROUP BY dataset.datasetid ORDER BY COUNT(1) DESC", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i want to see the cheapest flight from DENVER to PITTSBURGH\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND fare.one_direction_cost = (SELECT MIN(FAREalias1.one_direction_cost) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, fare AS FAREalias1, flight AS FLIGHTalias1, flight_fare AS FLIGHT_FAREalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'DENVER' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'PITTSBURGH' AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me flights from SEATTLE to SAN FRANCISCO that leave after 1700\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.departure_time > 1700 AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SEATTLE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- list the cheapest one way flight from MIAMI FLORIDA to CHARLOTTE NORTH CAROLINA\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare, state AS STATE_0, state AS STATE_1 WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'MIAMI' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CHARLOTTE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code AND STATE_0.state_code = CITY_0.state_code AND STATE_0.state_name = 'FLORIDA' AND STATE_1.state_code = CITY_1.state_code AND STATE_1.state_name = 'NORTH CAROLINA') AND fare.one_direction_cost = (SELECT MIN(FAREalias1.one_direction_cost) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, fare AS FAREalias1, flight AS FLIGHTalias1, flight_fare AS FLIGHT_FAREalias1, state AS STATEalias2, state AS STATEalias3 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'MIAMI' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'CHARLOTTE' AND FAREalias1.round_trip_required = 'NO' AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code AND STATEalias2.state_code = CITYalias2.state_code AND STATEalias2.state_name = 'FLORIDA' AND STATEalias3.state_code = CITYalias3.state_code AND STATEalias3.state_name = 'NORTH CAROLINA') AND fare.round_trip_required = 'NO' AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what states border montana\nSELECT", - "input": "", - "output": "SELECT border FROM border_info WHERE state_name = 'montana'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i would like to fly from ATLANTA to SAN FRANCISCO with a stopover in DALLAS\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'DALLAS' AND flight_stop.stop_airport = AIRPORT_SERVICE_2.airport_code AND flight.flight_id = flight_stop.flight_id AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE keyword (\nkeyword,\nkid\n)\n\nCREATE TABLE domain_author (\naid,\ndid\n)\n\nCREATE TABLE author (\naid,\nhomepage,\nname,\noid\n)\n\nCREATE TABLE domain_publication (\ndid,\npid\n)\n\nCREATE TABLE domain_conference (\ncid,\ndid\n)\n\nCREATE TABLE writes (\naid,\npid\n)\n\nCREATE TABLE domain_journal (\ndid,\njid\n)\n\nCREATE TABLE publication_keyword (\nkid,\npid\n)\n\nCREATE TABLE organization (\ncontinent,\nhomepage,\nname,\noid\n)\n\nCREATE TABLE domain (\ndid,\nname\n)\n\nCREATE TABLE publication (\nabstract,\ncid,\ncitation_num,\njid,\npid,\nreference_num,\ntitle,\nyear\n)\n\nCREATE TABLE conference (\ncid,\nhomepage,\nname\n)\n\nCREATE TABLE journal (\nhomepage,\njid,\nname\n)\n\nCREATE TABLE domain_keyword (\ndid,\nkid\n)\n\nCREATE TABLE cite (\ncited,\nciting\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- return me the journals, which have more than 60 papers containing keyword ' Relational Database ' .\nSELECT", - "input": "", - "output": "SELECT journal.name FROM journal, keyword, publication, publication_keyword WHERE keyword.keyword = 'Relational Database' AND publication_keyword.kid = keyword.kid AND publication.jid = journal.jid AND publication.pid = publication_keyword.pid GROUP BY journal.name HAVING COUNT(DISTINCT (publication.title)) > 60", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Is GREEK 441 section 825 provided in the Winter 2007 semester ?\nSELECT", - "input": "", - "output": "SELECT COUNT(*) > 0 FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course_offering.section_number = 825 AND course.department = 'GREEK' AND course.number = 441 AND semester.semester = 'Winter' AND semester.year = 2007", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- get SATURDAY fares from WASHINGTON to TORONTO\nSELECT", - "input": "", - "output": "SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'TORONTO' AND DAYS_1.day_name = 'SATURDAY' AND flight.flight_days = DAYS_1.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND DAYS_0.day_name = 'SATURDAY' AND fare_basis.basis_days = DAYS_0.days_code AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Who is responsible for teaching intelligent systems courses ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT instructor.name FROM instructor INNER JOIN offering_instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN course_offering ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN area ON course_offering.course_id = area.course_id WHERE area.area LIKE '%intelligent systems%'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\nCREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what is the biggest city in the us\nSELECT", - "input": "", - "output": "SELECT city_name FROM city WHERE population = (SELECT MAX(CITYalias1.population) FROM city AS CITYalias1)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- do you have a UA flight from BOSTON to WASHINGTON\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'UA'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i want a flight on TW from BOSTON to DENVER\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND flight.to_airport = AIRPORT_SERVICE_0.airport_code AND flight.from_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'TW'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i'd like to fly from BOSTON to SAN FRANCISCO could you find me the cheapest fare\nSELECT", - "input": "", - "output": "SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND fare.one_direction_cost = (SELECT MIN(FAREalias1.one_direction_cost) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, fare AS FAREalias1, flight AS FLIGHTalias1, flight_fare AS FLIGHT_FAREalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'BOSTON' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'SAN FRANCISCO' AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- In order to declare a major in ANTHRCUL , what classes must I take ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number FROM course, program_course WHERE course.department LIKE '%ANTHRCUL%' AND program_course.category LIKE 'PreMajor' AND program_course.course_id = course.course_id", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what time are flights from DENVER to SAN FRANCISCO on CO\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.departure_time FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.airline_code = 'CO'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- flights from MIAMI to CLEVELAND\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'MIAMI' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CLEVELAND' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- display all flights from BALTIMORE to BOSTON on 7 29\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON' AND date_day.day_number = 29 AND date_day.month_number = 7 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE review (\nrid,\nbusiness_id,\nuser_id,\nrating,\ntext,\nyear,\nmonth\n)\n\nCREATE TABLE neighborhood (\nid,\nbusiness_id,\nneighborhood_name\n)\n\nCREATE TABLE business (\nbid,\nbusiness_id,\nname,\nfull_address,\ncity,\nlatitude,\nlongitude,\nreview_count,\nis_open,\nrating,\nstate\n)\n\nCREATE TABLE user (\nuid,\nuser_id,\nname\n)\n\nCREATE TABLE tip (\ntip_id,\nbusiness_id,\ntext,\nuser_id,\nlikes,\nyear,\nmonth\n)\n\nCREATE TABLE checkin (\ncid,\nbusiness_id,\ncount,\nday\n)\n\nCREATE TABLE category (\nid,\nbusiness_id,\ncategory_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- List all the Italian restaurant in ' Los Angeles\nSELECT", - "input": "", - "output": "SELECT business.name FROM business, category AS CATEGORY_0, category AS CATEGORY_1 WHERE business.city = 'Los Angeles' AND CATEGORY_0.business_id = business.business_id AND CATEGORY_0.category_name = 'Italian' AND CATEGORY_1.business_id = business.business_id AND CATEGORY_1.category_name = 'restaurant'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what are the flights from CLEVELAND to INDIANAPOLIS for wednesday the 12 of 4\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'INDIANAPOLIS' AND date_day.day_number = 12 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CLEVELAND' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what are the flights from ORLANDO to CLEVELAND on US that arrive around 10pm\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (((flight.arrival_time <= 2230 AND flight.arrival_time >= 2130) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CLEVELAND' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ORLANDO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.airline_code = 'US'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what are the flights which depart from SAN FRANCISCO fly to WASHINGTON via INDIANAPOLIS and arrive by 2100\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE ((CITY_2.city_code = AIRPORT_SERVICE_2.city_code AND CITY_2.city_name = 'INDIANAPOLIS' AND flight_stop.stop_airport = AIRPORT_SERVICE_2.airport_code AND flight.arrival_time <= 2100 AND flight.flight_id = flight_stop.flight_id) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me flights between MEMPHIS and LAS VEGAS on sunday\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'LAS VEGAS' AND date_day.day_number = 27 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'MEMPHIS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what are the flights between PITTSBURGH and BALTIMORE on 8 10\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND date_day.day_number = 10 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me the flights from SAN FRANCISCO to WASHINGTON\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'SAN FRANCISCO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- show me flights from ATLANTA to WASHINGTON\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ATLANTA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- When will Sarah Mcdowell teach 763 next ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT semester.semester, semester.year FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.number = 763 AND course_offering.semester = semester.semester_id AND instructor.name LIKE '%Sarah Mcdowell%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester_id > (SELECT SEMESTERalias1.semester_id FROM semester AS SEMESTERalias1 WHERE SEMESTERalias1.semester = 'WN' AND SEMESTERalias1.year = 2016) ORDER BY semester.semester_id LIMIT 1", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Are there 16 -credit LATINOAM courses ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT name, number FROM course WHERE department = 'LATINOAM' AND credits = 16", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What classes are least demanding , while as yet satisfying the PreMajor necessity ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%PreMajor%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%PreMajor%')", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- How many professors will be teaching ROMLANG 500 in the Spring of 2020 ?\nSELECT", - "input": "", - "output": "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 = 'ROMLANG' AND course.number = 500 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id AND semester.semester = 'Spring' AND semester.semester_id = course_offering.semester AND semester.year = 2020", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE border_info (\nstate_name,\nborder\n)\n\nCREATE TABLE river (\nriver_name,\nlength,\ntraverse,\ncountry_name\n)\n\nCREATE TABLE city (\ncity_name,\nstate_name,\npopulation,\ncountry_name\n)\n\nCREATE TABLE road (\nroad_name,\nstate_name\n)\n\nCREATE TABLE lake (\nlake_name,\narea,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE highlow (\nstate_name,\nhighest_point,\nhighest_elevation,\nlowest_point,\nlowest_elevation\n)\n\nCREATE TABLE mountain (\nmountain_name,\nmountain_altitude,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE state (\nstate_name,\ncapital,\npopulation,\narea,\ncountry_name,\ndensity\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- how many major rivers cross ohio\nSELECT", - "input": "", - "output": "SELECT COUNT(river_name) FROM river WHERE length > 750 AND traverse = 'ohio'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- what kind of airplanes are used by DL flying between WASHINGTON and DENVER\nSELECT", - "input": "", - "output": "SELECT DISTINCT aircraft.aircraft_code FROM aircraft, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, equipment_sequence, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND equipment_sequence.aircraft_code = aircraft.aircraft_code AND flight.aircraft_code_sequence = equipment_sequence.aircraft_code_sequence AND flight.airline_code = 'DL'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- What amount of upper level classes have labs ?\nSELECT", - "input": "", - "output": "SELECT COUNT(DISTINCT course.course_id) FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.has_lab = 'Y' AND program_course.category LIKE '%ULCS%'", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE class_of_service (\nbooking_class,\nrank,\nclass_description\n)\n\nCREATE TABLE airline (\nairline_code,\nairline_name,\nnote\n)\n\nCREATE TABLE date_day (\nmonth_number,\nday_number,\nyear,\nday_name\n)\n\nCREATE TABLE time_interval (\nperiod,\nbegin_time,\nend_time\n)\n\nCREATE TABLE fare_basis (\nfare_basis_code,\nbooking_class,\nclass_type,\npremium,\neconomy,\ndiscounted,\nnight,\nseason,\nbasis_days\n)\n\nCREATE TABLE fare (\nfare_id,\nfrom_airport,\nto_airport,\nfare_basis_code,\nfare_airline,\nrestriction_code,\none_direction_cost,\nround_trip_cost,\nround_trip_required\n)\n\nCREATE TABLE airport (\nairport_code,\nairport_name,\nairport_location,\nstate_code,\ncountry_name,\ntime_zone_code,\nminimum_connect_time\n)\n\nCREATE TABLE dual_carrier (\nmain_airline,\nlow_flight_number,\nhigh_flight_number,\ndual_airline,\nservice_name\n)\n\nCREATE TABLE flight (\naircraft_code_sequence,\nairline_code,\nairline_flight,\narrival_time,\nconnections,\ndeparture_time,\ndual_carrier,\nflight_days,\nflight_id,\nflight_number,\nfrom_airport,\nmeal_code,\nstops,\ntime_elapsed,\nto_airport\n)\n\nCREATE TABLE code_description (\ncode,\ndescription\n)\n\nCREATE TABLE city (\ncity_code,\ncity_name,\nstate_code,\ncountry_name,\ntime_zone_code\n)\n\nCREATE TABLE ground_service (\ncity_code,\nairport_code,\ntransport_type,\nground_fare\n)\n\nCREATE TABLE restriction (\nrestriction_code,\nadvance_purchase,\nstopovers,\nsaturday_stay_required,\nminimum_stay,\nmaximum_stay,\napplication,\nno_discounts\n)\n\nCREATE TABLE month (\nmonth_number,\nmonth_name\n)\n\nCREATE TABLE days (\ndays_code,\nday_name\n)\n\nCREATE TABLE flight_fare (\nflight_id,\nfare_id\n)\n\nCREATE TABLE state (\nstate_code,\nstate_name,\ncountry_name\n)\n\nCREATE TABLE flight_stop (\nflight_id,\nstop_number,\nstop_days,\nstop_airport,\narrival_time,\narrival_airline,\narrival_flight_number,\ndeparture_time,\ndeparture_airline,\ndeparture_flight_number,\nstop_time\n)\n\nCREATE TABLE compartment_class (\ncompartment,\nclass_type\n)\n\nCREATE TABLE time_zone (\ntime_zone_code,\ntime_zone_name,\nhours_from_gmt\n)\n\nCREATE TABLE equipment_sequence (\naircraft_code_sequence,\naircraft_code\n)\n\nCREATE TABLE food_service (\nmeal_code,\nmeal_number,\ncompartment,\nmeal_description\n)\n\nCREATE TABLE airport_service (\ncity_code,\nairport_code,\nmiles_distant,\ndirection,\nminutes_distant\n)\n\nCREATE TABLE flight_leg (\nflight_id,\nleg_number,\nleg_flight\n)\n\nCREATE TABLE aircraft (\naircraft_code,\naircraft_description,\nmanufacturer,\nbasic_type,\nengines,\npropulsion,\nwide_body,\nwing_span,\nlength,\nweight,\ncapacity,\npay_load,\ncruising_speed,\nrange_miles,\npressurized\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- i would like the first flight from TORONTO to MONTREAL next friday\nSELECT", - "input": "", - "output": "SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MONTREAL' AND date_day.day_number = 25 AND date_day.month_number = 6 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'TORONTO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time = (SELECT MIN(FLIGHTalias1.departure_time) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, date_day AS DATE_DAYalias1, days AS DAYSalias1, flight AS FLIGHTalias1 WHERE (CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'MONTREAL' AND DATE_DAYalias1.day_number = 25 AND DATE_DAYalias1.month_number = 6 AND DATE_DAYalias1.year = 1991 AND DAYSalias1.day_name = DATE_DAYalias1.day_name AND FLIGHTalias1.flight_days = DAYSalias1.days_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'TORONTO' AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code)", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- For a CS major , what classes are available this Winter that would count towards that ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program, program_course, semester WHERE program_course.course_id = course.course_id AND program_course.course_id = course.course_id AND program.name LIKE '%CS%' AND program.program_id = program_course.program_id AND semester.semester = 'Winter' AND semester.semester_id = course_offering.semester AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Can you tell me who the GSIs were for last semester 's SEAS 698 ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT student.firstname, student.lastname FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN gsi ON gsi.course_offering_id = course_offering.offering_id INNER JOIN student ON student.student_id = gsi.student_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE course.department = 'SEAS' AND course.number = 698 AND semester.semester = 'FA' AND semester.year = 2015", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- Which MDE classes can be taken next semester ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program, program_course, semester WHERE course.course_id = course_offering.course_id AND program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016", - "history": [] - }, - { - "db_id": "database", - "instruction": "CREATE TABLE program_course (\nprogram_id,\ncourse_id,\nworkload,\ncategory\n)\n\nCREATE TABLE area (\ncourse_id,\narea\n)\n\nCREATE TABLE jobs (\njob_id,\njob_title,\ndescription,\nrequirement,\ncity,\nstate,\ncountry,\nzip\n)\n\nCREATE TABLE semester (\nsemester_id,\nsemester,\nyear\n)\n\nCREATE TABLE requirement (\nrequirement_id,\nrequirement,\ncollege\n)\n\nCREATE TABLE instructor (\ninstructor_id,\nname,\nuniqname\n)\n\nCREATE TABLE course_prerequisite (\npre_course_id,\ncourse_id\n)\n\nCREATE TABLE offering_instructor (\noffering_instructor_id,\noffering_id,\ninstructor_id\n)\n\nCREATE TABLE comment_instructor (\ninstructor_id,\nstudent_id,\nscore,\ncomment_text\n)\n\nCREATE TABLE program (\nprogram_id,\nname,\ncollege,\nintroduction\n)\n\nCREATE TABLE program_requirement (\nprogram_id,\ncategory,\nmin_credit,\nadditional_req\n)\n\nCREATE TABLE course_offering (\noffering_id,\ncourse_id,\nsemester,\nsection_number,\nstart_time,\nend_time,\nmonday,\ntuesday,\nwednesday,\nthursday,\nfriday,\nsaturday,\nsunday,\nhas_final_project,\nhas_final_exam,\ntextbook,\nclass_address,\nallow_audit\n)\n\nCREATE TABLE student (\nstudent_id,\nlastname,\nfirstname,\nprogram_id,\ndeclare_major,\ntotal_credit,\ntotal_gpa,\nentered_as,\nadmit_term,\npredicted_graduation_semester,\ndegree,\nminor,\ninternship\n)\n\nCREATE TABLE gsi (\ncourse_offering_id,\nstudent_id\n)\n\nCREATE TABLE ta (\ncampus_job_id,\nstudent_id,\nlocation\n)\n\nCREATE TABLE student_record (\nstudent_id,\ncourse_id,\nsemester,\ngrade,\nhow,\ntransfer_source,\nearn_credit,\nrepeat_term,\ntest_id\n)\n\nCREATE TABLE course_tags_count (\ncourse_id,\nclear_grading,\npop_quiz,\ngroup_projects,\ninspirational,\nlong_lectures,\nextra_credit,\nfew_tests,\ngood_feedback,\ntough_tests,\nheavy_papers,\ncares_for_students,\nheavy_assignments,\nrespected,\nparticipation,\nheavy_reading,\ntough_grader,\nhilarious,\nwould_take_again,\ngood_lecture,\nno_skip\n)\n\nCREATE TABLE course (\ncourse_id,\nname,\ndepartment,\nnumber,\ncredits,\nadvisory_requirement,\nenforced_requirement,\ndescription,\nnum_semesters,\nnum_enrolled,\nhas_discussion,\nhas_lab,\nhas_projects,\nhas_exams,\nnum_reviews,\nclarity_score,\neasiness_score,\nhelpfulness_score\n)\n\n\n-- Using valid SQLite, answer the following questions for the tables provided above.\n\n-- How many people are in 477 ?\nSELECT", - "input": "", - "output": "SELECT DISTINCT num_enrolled FROM course WHERE department = 'EECS' AND number = 477", - "history": [] - } -] \ No newline at end of file diff --git a/dbgpt_hub/train/src/llmtuner/__init__.py b/dbgpt_hub/train/src/llmtuner/__init__.py deleted file mode 100644 index 3bfae90..0000000 --- a/dbgpt_hub/train/src/llmtuner/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# Level: api, webui > chat > tuner > dsets > extras, hparams -from llmtuner.tuner import export_model, run_exp - - -__version__ = "0.1.7" diff --git a/dbgpt_hub/train/src/llmtuner/dsets/__init__.py b/dbgpt_hub/train/src/llmtuner/dsets/__init__.py deleted file mode 100644 index cccbd74..0000000 --- a/dbgpt_hub/train/src/llmtuner/dsets/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from llmtuner.dsets.loader import get_dataset -from llmtuner.dsets.preprocess import preprocess_dataset -from llmtuner.dsets.utils import split_dataset diff --git a/dbgpt_hub/train/src/llmtuner/dsets/loader.py b/dbgpt_hub/train/src/llmtuner/dsets/loader.py deleted file mode 100644 index 641ed39..0000000 --- a/dbgpt_hub/train/src/llmtuner/dsets/loader.py +++ /dev/null @@ -1,126 +0,0 @@ -import os -from typing import TYPE_CHECKING, List, Union - -from datasets import concatenate_datasets, interleave_datasets, load_dataset - -from llmtuner.dsets.utils import checksum, EXT2TYPE -from llmtuner.extras.logging import get_logger - -if TYPE_CHECKING: - from datasets import Dataset, IterableDataset - from llmtuner.hparams import ModelArguments, DataArguments - - -logger = get_logger(__name__) - - -def get_dataset( - model_args: "ModelArguments", data_args: "DataArguments" -) -> Union["Dataset", "IterableDataset"]: - max_samples = data_args.max_samples - all_datasets: List[ - Union["Dataset", "IterableDataset"] - ] = [] # support multiple datasets - - for dataset_attr in data_args.dataset_list: - logger.info("Loading dataset {}...".format(dataset_attr)) - - if dataset_attr.load_from == "hf_hub": - data_path = dataset_attr.dataset_name - data_files = None - elif dataset_attr.load_from == "script": - data_path = os.path.join(data_args.dataset_dir, dataset_attr.dataset_name) - data_files = None - elif dataset_attr.load_from == "file": - data_path = None - data_files: List[str] = [] - - if os.path.isdir( - os.path.join(data_args.dataset_dir, dataset_attr.dataset_name) - ): # directory - for file_name in os.listdir( - os.path.join(data_args.dataset_dir, dataset_attr.dataset_name) - ): - data_files.append( - os.path.join( - data_args.dataset_dir, dataset_attr.dataset_name, file_name - ) - ) - if data_path is None: - data_path = EXT2TYPE.get(file_name.split(".")[-1], None) - else: - assert data_path == EXT2TYPE.get( - file_name.split(".")[-1], None - ), "file type does not match." - elif os.path.isfile( - os.path.join(data_args.dataset_dir, dataset_attr.dataset_name) - ): # single file - data_files.append( - os.path.join(data_args.dataset_dir, dataset_attr.dataset_name) - ) - data_path = EXT2TYPE.get(dataset_attr.dataset_name.split(".")[-1], None) - else: - raise ValueError("File not found.") - - assert data_path, "File extension must be txt, csv, json or jsonl." - checksum(data_files, dataset_attr.dataset_sha1) - else: - raise NotImplementedError - - dataset = load_dataset( - data_path, - data_files=data_files, - split=data_args.split, - cache_dir=model_args.cache_dir, - streaming=data_args.streaming, - use_auth_token=True if model_args.use_auth_token else None, - ) - - if max_samples is not None: - max_samples_temp = min(len(dataset), max_samples) - dataset = dataset.select(range(max_samples_temp)) - - for column_name in ["prompt", "query", "response", "history"]: # align datasets - if ( - getattr(dataset_attr, column_name) - and getattr(dataset_attr, column_name) != column_name - ): - dataset = dataset.rename_column( - getattr(dataset_attr, column_name), column_name - ) - - if dataset_attr.system_prompt: # add system prompt - if data_args.streaming: - dataset = dataset.map(lambda _: {"system": dataset_attr.system_prompt}) - else: - dataset = dataset.add_column( - "system", [dataset_attr.system_prompt] * len(dataset) - ) - - all_datasets.append(dataset) - - if len(data_args.dataset_list) == 1: - return all_datasets[0] - elif data_args.mix_strategy == "concat": - if data_args.streaming: - logger.warning( - "The samples between different datasets will not be mixed in streaming mode." - ) - return concatenate_datasets(all_datasets) - elif data_args.mix_strategy.startswith("interleave"): - if not data_args.streaming: - logger.warning( - "We recommend using `mix_strategy=concat` in non-streaming mode." - ) - stopping_strategy = ( - "first_exhausted" - if data_args.mix_strategy.endswith("under") - else "all_exhausted" - ) - return interleave_datasets( - all_datasets, - data_args.interleave_probs, - stopping_strategy=stopping_strategy, - ) - else: - raise ValueError("Unknown mixing strategy.") diff --git a/dbgpt_hub/train/src/llmtuner/dsets/preprocess.py b/dbgpt_hub/train/src/llmtuner/dsets/preprocess.py deleted file mode 100644 index d1801cc..0000000 --- a/dbgpt_hub/train/src/llmtuner/dsets/preprocess.py +++ /dev/null @@ -1,200 +0,0 @@ -import tiktoken -from typing import TYPE_CHECKING, Any, Dict, Generator, List, Literal, Union -from itertools import chain - -from llmtuner.extras.constants import IGNORE_INDEX -from llmtuner.extras.template import get_template_and_fix_tokenizer - -if TYPE_CHECKING: - from datasets import Dataset, IterableDataset - from transformers import Seq2SeqTrainingArguments - from transformers.tokenization_utils import PreTrainedTokenizer - from llmtuner.hparams import DataArguments - - -def preprocess_dataset( - dataset: Union["Dataset", "IterableDataset"], - tokenizer: "PreTrainedTokenizer", - data_args: "DataArguments", - training_args: "Seq2SeqTrainingArguments", -) -> Union["Dataset", "IterableDataset"]: - column_names = list(next(iter(dataset)).keys()) - template = get_template_and_fix_tokenizer(data_args.template, tokenizer) - - def construct_example(examples: Dict[str, List[Any]]) -> Generator[Any, None, None]: - for i in range(len(examples["prompt"])): - query, response = examples["prompt"][i], examples["response"][i] - query = ( - query + "\n" + examples["query"][i] - if "query" in examples and examples["query"][i] - else query - ) - history = examples["history"][i] if "history" in examples else None - system = examples["system"][i] if "system" in examples else None - yield query, response, history, system - - def preprocess_pretrain_dataset(examples: Dict[str, List[Any]]) -> Dict[str, Any]: - # build grouped texts with format `X1 X2 X3 ...` (without ) - if isinstance( - getattr(tokenizer, "tokenizer", None), tiktoken.Encoding - ): # for tiktoken tokenizer (Qwen) - kwargs = dict(allowed_special="all") - else: - kwargs = dict(add_special_tokens=False) - - tokenized_examples = tokenizer(examples["prompt"], **kwargs) - concatenated_examples = { - k: list(chain(*tokenized_examples[k])) for k in tokenized_examples.keys() - } - total_length = len(concatenated_examples[list(concatenated_examples.keys())[0]]) - block_size = data_args.max_source_length - # we drop the small remainder, and if the total_length < block_size, we exclude this batch - total_length = (total_length // block_size) * block_size - # split by chunks of max_source_length - result = { - k: [t[i : i + block_size] for i in range(0, total_length, block_size)] - for k, t in concatenated_examples.items() - } - return result - - def preprocess_supervised_dataset(examples: Dict[str, List[Any]]) -> Dict[str, Any]: - # build inputs with format ` X Y ` and labels with format ` ... Y ` - # for multiturn examples, we only mask the prompt part in each prompt-response pair. - model_inputs = {"input_ids": [], "attention_mask": [], "labels": []} - max_length = data_args.max_source_length + data_args.max_target_length - - for query, response, history, system in construct_example(examples): - input_ids, labels = [], [] - - for source_ids, target_ids in template.encode_multiturn( - tokenizer, query, response, history, system - ): - if len(source_ids) > data_args.max_source_length: - source_ids = source_ids[: data_args.max_source_length] - if len(target_ids) > data_args.max_target_length: - target_ids = target_ids[: data_args.max_target_length] - - if len(input_ids) + len(source_ids) + len(target_ids) > max_length: - break - - input_ids += source_ids + target_ids - labels += [IGNORE_INDEX] * len(source_ids) + target_ids - - model_inputs["input_ids"].append(input_ids) - model_inputs["attention_mask"].append([1] * len(input_ids)) - model_inputs["labels"].append(labels) - - return model_inputs - - def preprocess_unsupervised_dataset( - examples: Dict[str, List[Any]] - ) -> Dict[str, Any]: - # build inputs with format ` X` and labels with format `Y ` - model_inputs = {"input_ids": [], "attention_mask": [], "labels": []} - - for query, response, history, system in construct_example(examples): - source_ids, target_ids = template.encode_oneturn( - tokenizer, query, response, history, system - ) - - if len(source_ids) > data_args.max_source_length: - source_ids = source_ids[: data_args.max_source_length] - if len(target_ids) > data_args.max_target_length: - target_ids = target_ids[: data_args.max_target_length] - - model_inputs["input_ids"].append(source_ids) - model_inputs["attention_mask"].append([1] * len(source_ids)) - model_inputs["labels"].append(target_ids) - - return model_inputs - - def preprocess_pairwise_dataset(examples): - # build input pairs with format ` X`, `Y1 ` and `Y2 ` - model_inputs = {"prompt_ids": [], "chosen_ids": [], "rejected_ids": []} - for query, response, history, system in construct_example(examples): - prompt_ids, chosen_ids = template.encode_oneturn( - tokenizer, query, response[0], history, system - ) - _, rejected_ids = template.encode_oneturn( - tokenizer, query, response[1], history, system - ) - - if len(prompt_ids) > data_args.max_source_length: - prompt_ids = prompt_ids[: data_args.max_source_length] - if len(chosen_ids) > data_args.max_target_length: - chosen_ids = chosen_ids[: data_args.max_target_length] - if len(rejected_ids) > data_args.max_target_length: - rejected_ids = rejected_ids[: data_args.max_target_length] - - model_inputs["prompt_ids"].append(prompt_ids) - model_inputs["chosen_ids"].append(chosen_ids) - model_inputs["rejected_ids"].append(rejected_ids) - return model_inputs - - def print_supervised_dataset_example(example): - print("input_ids:\n{}".format(example["input_ids"])) - print( - "inputs:\n{}".format( - tokenizer.decode(example["input_ids"], skip_special_tokens=False) - ) - ) - print("label_ids:\n{}".format(example["labels"])) - print( - "labels:\n{}".format( - tokenizer.decode( - [ - token_id if token_id != IGNORE_INDEX else tokenizer.pad_token_id - for token_id in example["labels"] - ], - skip_special_tokens=False, - ) - ) - ) - - def print_pairwise_dataset_example(example): - print("prompt_ids:\n{}".format(example["prompt_ids"])) - print( - "prompt:\n{}".format( - tokenizer.decode(example["prompt_ids"], skip_special_tokens=False) - ) - ) - print("chosen_ids:\n{}".format(example["chosen_ids"])) - print( - "chosen:\n{}".format( - tokenizer.decode(example["chosen_ids"], skip_special_tokens=False) - ) - ) - print("rejected_ids:\n{}".format(example["rejected_ids"])) - print( - "rejected:\n{}".format( - tokenizer.decode(example["rejected_ids"], skip_special_tokens=False) - ) - ) - - def print_unsupervised_dataset_example(example): - print("input_ids:\n{}".format(example["input_ids"])) - print( - "inputs:\n{}".format( - tokenizer.decode(example["input_ids"], skip_special_tokens=False) - ) - ) - - dataset = dataset.filter(lambda example: example["prompt"] and example["response"]) - preprocess_function = preprocess_supervised_dataset - print_function = print_supervised_dataset_example - - with training_args.main_process_first(desc="dataset map pre-processing"): - kwargs = {} - if not data_args.streaming: - kwargs = dict( - num_proc=data_args.preprocessing_num_workers, - load_from_cache_file=not data_args.overwrite_cache, - desc="Running tokenizer on dataset", - ) - - dataset = dataset.map( - preprocess_function, batched=True, remove_columns=column_names, **kwargs - ) - - print_function(next(iter(dataset))) - return dataset diff --git a/dbgpt_hub/train/src/llmtuner/dsets/utils.py b/dbgpt_hub/train/src/llmtuner/dsets/utils.py deleted file mode 100644 index a8fa517..0000000 --- a/dbgpt_hub/train/src/llmtuner/dsets/utils.py +++ /dev/null @@ -1,73 +0,0 @@ -import hashlib -from typing import TYPE_CHECKING, Dict, List, Optional, Union - -from llmtuner.extras.logging import get_logger - -if TYPE_CHECKING: - from datasets import Dataset, IterableDataset - from transformers import TrainingArguments - from llmtuner.hparams import DataArguments - - -logger = get_logger(__name__) - - -EXT2TYPE = {"csv": "csv", "json": "json", "jsonl": "json", "txt": "text"} - - -def checksum(data_files: List[str], file_sha1: Optional[str] = None) -> None: - if file_sha1 is None: - logger.warning( - "Checksum failed: missing SHA-1 hash value in dataset_info.json." - ) - return - - if len(data_files) != 1: - logger.warning("Checksum failed: too many files.") - return - - with open(data_files[0], "rb") as f: - sha1 = hashlib.sha1(f.read()).hexdigest() - if sha1 != file_sha1: - logger.warning( - "Checksum failed: mismatched SHA-1 hash value at {}.".format( - data_files[0] - ) - ) - - -def split_dataset( - dataset: Union["Dataset", "IterableDataset"], - data_args: "DataArguments", - training_args: "TrainingArguments", -) -> Dict[str, "Dataset"]: - if training_args.do_train: - if data_args.val_size > 1e-6: # Split the dataset - if data_args.streaming: - val_set = dataset.take(int(data_args.val_size)) - train_set = dataset.skip(int(data_args.val_size)) - dataset = dataset.shuffle( - buffer_size=data_args.buffer_size, seed=training_args.seed - ) - return {"train_dataset": train_set, "eval_dataset": val_set} - else: - val_size = ( - int(data_args.val_size) - if data_args.val_size > 1 - else data_args.val_size - ) - dataset = dataset.train_test_split( - test_size=val_size, seed=training_args.seed - ) - return { - "train_dataset": dataset["train"], - "eval_dataset": dataset["test"], - } - else: - if data_args.streaming: - dataset = dataset.shuffle( - buffer_size=data_args.buffer_size, seed=training_args.seed - ) - return {"train_dataset": dataset} - else: # do_eval or do_predict - return {"eval_dataset": dataset} diff --git a/dbgpt_hub/train/src/llmtuner/extras/__init__.py b/dbgpt_hub/train/src/llmtuner/extras/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/dbgpt_hub/train/src/llmtuner/extras/callbacks.py b/dbgpt_hub/train/src/llmtuner/extras/callbacks.py deleted file mode 100644 index 59a1b90..0000000 --- a/dbgpt_hub/train/src/llmtuner/extras/callbacks.py +++ /dev/null @@ -1,188 +0,0 @@ -import os -import json -import time -from typing import TYPE_CHECKING -from datetime import timedelta - -from transformers import TrainerCallback -from transformers.trainer_utils import has_length - -from llmtuner.extras.constants import LOG_FILE_NAME -from llmtuner.extras.logging import get_logger - -if TYPE_CHECKING: - from transformers import TrainingArguments, TrainerState, TrainerControl - - -logger = get_logger(__name__) - - -class LogCallback(TrainerCallback): - def __init__(self, runner=None): - self.runner = runner - self.in_training = False - self.start_time = time.time() - self.cur_steps = 0 - self.max_steps = 0 - self.elapsed_time = "" - self.remaining_time = "" - - def timing(self): - cur_time = time.time() - elapsed_time = cur_time - self.start_time - avg_time_per_step = elapsed_time / self.cur_steps if self.cur_steps != 0 else 0 - remaining_time = (self.max_steps - self.cur_steps) * avg_time_per_step - self.elapsed_time = str(timedelta(seconds=int(elapsed_time))) - self.remaining_time = str(timedelta(seconds=int(remaining_time))) - - def on_train_begin( - self, - args: "TrainingArguments", - state: "TrainerState", - control: "TrainerControl", - **kwargs - ): - r""" - Event called at the beginning of training. - """ - if state.is_local_process_zero: - self.in_training = True - self.start_time = time.time() - self.max_steps = state.max_steps - if os.path.exists(os.path.join(args.output_dir, LOG_FILE_NAME)): - logger.warning("Previous log file in this folder will be deleted.") - os.remove(os.path.join(args.output_dir, LOG_FILE_NAME)) - - def on_train_end( - self, - args: "TrainingArguments", - state: "TrainerState", - control: "TrainerControl", - **kwargs - ): - r""" - Event called at the end of training. - """ - if state.is_local_process_zero: - self.in_training = False - self.cur_steps = 0 - self.max_steps = 0 - - def on_substep_end( - self, - args: "TrainingArguments", - state: "TrainerState", - control: "TrainerControl", - **kwargs - ): - r""" - Event called at the end of an substep during gradient accumulation. - """ - if ( - state.is_local_process_zero - and self.runner is not None - and self.runner.aborted - ): - control.should_epoch_stop = True - control.should_training_stop = True - - def on_step_end( - self, - args: "TrainingArguments", - state: "TrainerState", - control: "TrainerControl", - **kwargs - ): - r""" - Event called at the end of a training step. - """ - if state.is_local_process_zero: - self.cur_steps = state.global_step - self.timing() - if self.runner is not None and self.runner.aborted: - control.should_epoch_stop = True - control.should_training_stop = True - - def on_evaluate( - self, - args: "TrainingArguments", - state: "TrainerState", - control: "TrainerControl", - **kwargs - ): - r""" - Event called after an evaluation phase. - """ - if state.is_local_process_zero and not self.in_training: - self.cur_steps = 0 - self.max_steps = 0 - - def on_predict( - self, - args: "TrainingArguments", - state: "TrainerState", - control: "TrainerControl", - *other, - **kwargs - ): - r""" - Event called after a successful prediction. - """ - if state.is_local_process_zero and not self.in_training: - self.cur_steps = 0 - self.max_steps = 0 - - def on_log( - self, - args: "TrainingArguments", - state: "TrainerState", - control: "TrainerControl", - **kwargs - ) -> None: - r""" - Event called after logging the last logs. - """ - if not state.is_local_process_zero: - return - - logs = dict( - current_steps=self.cur_steps, - total_steps=self.max_steps, - loss=state.log_history[-1].get("loss", None), - eval_loss=state.log_history[-1].get("eval_loss", None), - predict_loss=state.log_history[-1].get("predict_loss", None), - reward=state.log_history[-1].get("reward", None), - learning_rate=state.log_history[-1].get("learning_rate", None), - epoch=state.log_history[-1].get("epoch", None), - percentage=round(self.cur_steps / self.max_steps * 100, 2) - if self.max_steps != 0 - else 100, - elapsed_time=self.elapsed_time, - remaining_time=self.remaining_time, - ) - os.makedirs(args.output_dir, exist_ok=True) - with open( - os.path.join(args.output_dir, "trainer_log.jsonl"), "a", encoding="utf-8" - ) as f: - f.write(json.dumps(logs) + "\n") - - def on_prediction_step( - self, - args: "TrainingArguments", - state: "TrainerState", - control: "TrainerControl", - **kwargs - ): - r""" - Event called after a prediction step. - """ - eval_dataloader = kwargs.pop("eval_dataloader", None) - if ( - state.is_local_process_zero - and has_length(eval_dataloader) - and not self.in_training - ): - if self.max_steps == 0: - self.max_steps = len(eval_dataloader) - self.cur_steps += 1 - self.timing() diff --git a/dbgpt_hub/train/src/llmtuner/extras/constants.py b/dbgpt_hub/train/src/llmtuner/extras/constants.py deleted file mode 100644 index 8ad7ff6..0000000 --- a/dbgpt_hub/train/src/llmtuner/extras/constants.py +++ /dev/null @@ -1,86 +0,0 @@ -IGNORE_INDEX = -100 - -LOG_FILE_NAME = "trainer_log.jsonl" - -VALUE_HEAD_FILE_NAME = "value_head.bin" - -FINETUNING_ARGS_NAME = "finetuning_args.json" - -LAYERNORM_NAMES = ["norm", "ln_f", "ln_attn", "ln_mlp"] - -METHODS = ["full", "freeze", "lora"] - -STAGES = ["SFT", "Reward Modeling", "PPO", "DPO", "Pre-Training"] - -DATASET_STAGE_MAP = { - "SFT": "sft", - "Pre-Training": "pt", - "Reward Modeling": "rm", - "PPO": "sft", - "DPO": "rm", -} - -SUPPORTED_MODELS = { - "LLaMA-7B": "huggyllama/llama-7b", - "LLaMA-13B": "huggyllama/llama-13b", - "LLaMA-30B": "huggyllama/llama-30b", - "LLaMA-65B": "huggyllama/llama-65b", - "LLaMA2-7B": "meta-llama/Llama-2-7b-hf", - "LLaMA2-13B": "meta-llama/Llama-2-13b-hf", - "LLaMA2-70B": "meta-llama/Llama-2-70b-hf", - "LLaMA2-7B-Chat": "meta-llama/Llama-2-7b-chat-hf", - "LLaMA2-13B-Chat": "meta-llama/Llama-2-13b-chat-hf", - "LLaMA2-70B-Chat": "meta-llama/Llama-2-70b-chat-hf", - "ChineseLLaMA2-7B": "ziqingyang/chinese-llama-2-7b", - "ChineseLLaMA2-13B": "ziqingyang/chinese-llama-2-13b", - "ChineseLLaMA2-7B-Chat": "ziqingyang/chinese-alpaca-2-7b", - "ChineseLLaMA2-13B-Chat": "ziqingyang/chinese-alpaca-2-13b", - "BLOOM-560M": "bigscience/bloom-560m", - "BLOOM-3B": "bigscience/bloom-3b", - "BLOOM-7B1": "bigscience/bloom-7b1", - "BLOOMZ-560M": "bigscience/bloomz-560m", - "BLOOMZ-3B": "bigscience/bloomz-3b", - "BLOOMZ-7B1-mt": "bigscience/bloomz-7b1-mt", - "Falcon-7B": "tiiuae/falcon-7b", - "Falcon-7B-Chat": "tiiuae/falcon-7b-instruct", - "Falcon-40B": "tiiuae/falcon-40b", - "Falcon-40B-Chat": "tiiuae/falcon-40b-instruct", - "Baichuan-7B": "baichuan-inc/Baichuan-7B", - "Baichuan-13B": "baichuan-inc/Baichuan-13B-Base", - "Baichuan-13B-Chat": "baichuan-inc/Baichuan-13B-Chat", - "Baichuan2-7B": "baichuan-inc/Baichuan2-7B-Base", - "Baichuan2-13B": "baichuan-inc/Baichuan2-13B-Base", - "Baichuan2-7B-Chat": "baichuan-inc/Baichuan2-7B-Chat", - "Baichuan2-13B-Chat": "baichuan-inc/Baichuan2-13B-Chat", - "InternLM-7B": "internlm/internlm-7b", - "InternLM-7B-Chat": "internlm/internlm-chat-7b", - "Qwen-7B": "Qwen/Qwen-7B", - "Qwen-7B-Chat": "Qwen/Qwen-7B-Chat", - "XVERSE-13B": "xverse/XVERSE-13B", - "ChatGLM2-6B-Chat": "THUDM/chatglm2-6b", -} - -DEFAULT_MODULE = { - "LLaMA": "q_proj,v_proj", - "LLaMA2": "q_proj,v_proj", - "ChineseLLaMA2": "q_proj,v_proj", - "BLOOM": "query_key_value", - "BLOOMZ": "query_key_value", - "Falcon": "query_key_value", - "Baichuan": "W_pack", - "Baichuan2": "W_pack", - "InternLM": "q_proj,v_proj", - "Qwen": "c_attn", - "XVERSE": "q_proj,v_proj", - "ChatGLM2": "query_key_value", -} - -DEFAULT_TEMPLATE = { - "LLaMA2": "llama2", - "ChineseLLaMA2": "llama2_zh", - "Baichuan": "baichuan", - "Baichuan2": "baichuan2", - "InternLM": "intern", - "Qwen": "chatml", - "ChatGLM2": "chatglm2", -} diff --git a/dbgpt_hub/train/src/llmtuner/extras/logging.py b/dbgpt_hub/train/src/llmtuner/extras/logging.py deleted file mode 100644 index 280865f..0000000 --- a/dbgpt_hub/train/src/llmtuner/extras/logging.py +++ /dev/null @@ -1,42 +0,0 @@ -import sys -import logging - - -class LoggerHandler(logging.Handler): - def __init__(self): - super().__init__() - self.log = "" - - def reset(self): - self.log = "" - - def emit(self, record): - if record.name == "httpx": - return - log_entry = self.format(record) - self.log += log_entry - self.log += "\n\n" - - -def reset_logging(): - r""" - Removes basic config of root logger - """ - root = logging.getLogger() - list(map(root.removeHandler, root.handlers)) - list(map(root.removeFilter, root.filters)) - - -def get_logger(name: str) -> logging.Logger: - formatter = logging.Formatter( - fmt="%(asctime)s - %(levelname)s - %(name)s - %(message)s", - datefmt="%m/%d/%Y %H:%M:%S", - ) - handler = logging.StreamHandler(sys.stdout) - handler.setFormatter(formatter) - - logger = logging.getLogger(name) - logger.setLevel(logging.INFO) - logger.addHandler(handler) - - return logger diff --git a/dbgpt_hub/train/src/llmtuner/extras/misc.py b/dbgpt_hub/train/src/llmtuner/extras/misc.py deleted file mode 100644 index be8d241..0000000 --- a/dbgpt_hub/train/src/llmtuner/extras/misc.py +++ /dev/null @@ -1,141 +0,0 @@ -import torch -from typing import TYPE_CHECKING, List, Optional, Tuple -from transformers import InfNanRemoveLogitsProcessor, LogitsProcessorList - -from llmtuner.extras.constants import LAYERNORM_NAMES - -if TYPE_CHECKING: - from transformers.modeling_utils import PreTrainedModel - - -class AverageMeter: - r""" - Computes and stores the average and current value. - """ - - def __init__(self): - self.reset() - - def reset(self): - self.val = 0 - self.avg = 0 - self.sum = 0 - self.count = 0 - - def update(self, val, n=1): - self.val = val - self.sum += val * n - self.count += n - self.avg = self.sum / self.count - - -def get_logits_processor() -> LogitsProcessorList: - logits_processor = LogitsProcessorList() - logits_processor.append(InfNanRemoveLogitsProcessor()) - return logits_processor - - -def count_parameters(model: torch.nn.Module) -> Tuple[int, int]: - r""" - Returns the number of trainable parameters and number of all parameters in the model. - """ - trainable_params, all_param = 0, 0 - for param in model.parameters(): - num_params = param.numel() - # if using DS Zero 3 and the weights are initialized empty - if num_params == 0 and hasattr(param, "ds_numel"): - num_params = param.ds_numel - - # Due to the design of 4bit linear layers from bitsandbytes, multiply the number of parameters by 2 - if param.__class__.__name__ == "Params4bit": - num_params = num_params * 2 - - all_param += num_params - if param.requires_grad: - trainable_params += num_params - - return trainable_params, all_param - - -# Includes: (1) cast the layernorm in fp32 (2) make output embedding layer require grads (3) upcast the lm_head to fp32 -# Inspired by: https://github.com/huggingface/peft/blob/c0209c35abbf88c63aa267800d98a8e212ed0a42/src/peft/utils/other.py#L35 -def prepare_model_for_training( - model: "PreTrainedModel", - finetuning_type: str, - output_layer_name: Optional[str] = "lm_head", - use_gradient_checkpointing: Optional[bool] = True, - layer_norm_names: Optional[List[str]] = LAYERNORM_NAMES, -) -> "PreTrainedModel": - for name, param in model.named_parameters(): - if param.ndim == 1 and any( - layer_norm_name in name for layer_norm_name in layer_norm_names - ): - param.data = param.data.to(torch.float32) - - if use_gradient_checkpointing: - if hasattr(model, "enable_input_require_grads"): - model.enable_input_require_grads() - else: - - def make_inputs_require_grad(module, input, output): - output.requires_grad_(True) - - model.get_input_embeddings().register_forward_hook(make_inputs_require_grad) - - model.gradient_checkpointing_enable() - model.config.use_cache = ( - False # turn off when gradient checkpointing is enabled - ) - - if finetuning_type != "full" and hasattr(model, output_layer_name): - output_layer: torch.nn.Linear = getattr(model, output_layer_name) - input_dtype = output_layer.weight.dtype - - class CastOutputToFloat(torch.nn.Sequential): - def forward(self, x: torch.Tensor) -> torch.Tensor: - return super().forward(x.to(input_dtype)).to(torch.float32) - - setattr(model, output_layer_name, CastOutputToFloat(output_layer)) - - return model - - -def torch_gc() -> None: - r""" - Collects GPU memory. - """ - if torch.cuda.is_available(): - torch.cuda.empty_cache() - torch.cuda.ipc_collect() - - -def dispatch_model(model: "PreTrainedModel") -> "PreTrainedModel": - r""" - Dispatches a pre-trained model to GPUs with balanced memory. - Borrowed from: https://github.com/huggingface/transformers/blob/v4.31.0/src/transformers/modeling_utils.py#L2803 - """ - if getattr(model, "is_loaded_in_8bit", False) or getattr( - model, "is_loaded_in_4bit", False - ): # do nothing - return model - - if torch.cuda.device_count() > 1: - from accelerate import dispatch_model - from accelerate.utils import infer_auto_device_map, get_balanced_memory - - if model._no_split_modules is None: - raise ValueError( - "The model class needs to implement the `_no_split_modules` attribute." - ) - - kwargs = { - "dtype": model.dtype, - "no_split_module_classes": model._no_split_modules, - } - max_memory = get_balanced_memory(model, **kwargs) - # Make sure tied weights are tied before creating the device map. - model.tie_weights() - device_map = infer_auto_device_map(model, max_memory=max_memory, **kwargs) - return dispatch_model(model, device_map) - else: - return model.cuda() diff --git a/dbgpt_hub/train/src/llmtuner/extras/ploting.py b/dbgpt_hub/train/src/llmtuner/extras/ploting.py deleted file mode 100644 index 5269dd8..0000000 --- a/dbgpt_hub/train/src/llmtuner/extras/ploting.py +++ /dev/null @@ -1,64 +0,0 @@ -import os -import math -import json -import matplotlib.pyplot as plt -from typing import List, Optional -from transformers.trainer import TRAINER_STATE_NAME - -from llmtuner.extras.logging import get_logger - - -logger = get_logger(__name__) - - -def smooth(scalars: List[float]) -> List[float]: - r""" - EMA implementation according to TensorBoard. - """ - last = scalars[0] - smoothed = list() - weight = 1.8 * ( - 1 / (1 + math.exp(-0.05 * len(scalars))) - 0.5 - ) # a sigmoid function - for next_val in scalars: - smoothed_val = last * weight + (1 - weight) * next_val - smoothed.append(smoothed_val) - last = smoothed_val - return smoothed - - -def plot_loss( - save_dictionary: os.PathLike, keys: Optional[List[str]] = ["loss"] -) -> None: - with open( - os.path.join(save_dictionary, TRAINER_STATE_NAME), "r", encoding="utf-8" - ) as f: - data = json.load(f) - - for key in keys: - steps, metrics = [], [] - for i in range(len(data["log_history"])): - if key in data["log_history"][i]: - steps.append(data["log_history"][i]["step"]) - metrics.append(data["log_history"][i][key]) - - if len(metrics) == 0: - logger.warning(f"No metric {key} to plot.") - continue - - plt.figure() - plt.plot(steps, metrics, alpha=0.4, label="original") - plt.plot(steps, smooth(metrics), label="smoothed") - plt.title("training {} of {}".format(key, save_dictionary)) - plt.xlabel("step") - plt.ylabel(key) - plt.legend() - plt.savefig( - os.path.join(save_dictionary, "training_{}.png".format(key)), - format="png", - dpi=100, - ) - print( - "Figure saved:", - os.path.join(save_dictionary, "training_{}.png".format(key)), - ) diff --git a/dbgpt_hub/train/src/llmtuner/extras/save_and_load.py b/dbgpt_hub/train/src/llmtuner/extras/save_and_load.py deleted file mode 100644 index 95f656c..0000000 --- a/dbgpt_hub/train/src/llmtuner/extras/save_and_load.py +++ /dev/null @@ -1,61 +0,0 @@ -import os -import torch -from typing import Dict - -from transformers.trainer import WEIGHTS_NAME, WEIGHTS_INDEX_NAME -from transformers.modeling_utils import load_sharded_checkpoint - -from llmtuner.extras.constants import VALUE_HEAD_FILE_NAME -from llmtuner.extras.logging import get_logger - - -logger = get_logger(__name__) - - -def get_state_dict(model: torch.nn.Module) -> Dict[str, torch.Tensor]: - state_dict: Dict[str, torch.Tensor] = model.state_dict() - filtered_state_dict = {} - - for k, v in model.named_parameters(): - if v.requires_grad: - filtered_state_dict[k] = state_dict[k].cpu().clone().detach() - - return filtered_state_dict - - -def load_trainable_params(model: torch.nn.Module, checkpoint_dir: os.PathLike) -> bool: - weights_file = os.path.join(checkpoint_dir, WEIGHTS_NAME) - if os.path.exists(weights_file): - model_state_dict = torch.load(weights_file, map_location="cpu") - model.load_state_dict(model_state_dict, strict=False) # skip missing keys - elif os.path.exists(os.path.join(checkpoint_dir, WEIGHTS_INDEX_NAME)): - load_sharded_checkpoint(model, checkpoint_dir, strict=False) - else: - logger.warning( - "Provided path ({}) does not contain pre-trained weights.".format( - checkpoint_dir - ) - ) - return False - return True - - -def load_valuehead_params(model: torch.nn.Module, checkpoint_dir: os.PathLike) -> bool: - valuehead_file = os.path.join(checkpoint_dir, VALUE_HEAD_FILE_NAME) - if not os.path.exists(valuehead_file): - logger.warning( - "Provided path ({}) does not contain valuehead weights.".format( - checkpoint_dir - ) - ) - return False - valuehead_state_dict = torch.load(valuehead_file, map_location="cpu") - model.register_buffer("reward_head_weight", valuehead_state_dict["summary.weight"]) - model.register_buffer("reward_head_bias", valuehead_state_dict["summary.bias"]) - model.register_buffer( - "default_head_weight", torch.zeros_like(valuehead_state_dict["summary.weight"]) - ) - model.register_buffer( - "default_head_bias", torch.zeros_like(valuehead_state_dict["summary.bias"]) - ) - return True diff --git a/dbgpt_hub/train/src/llmtuner/extras/template.py b/dbgpt_hub/train/src/llmtuner/extras/template.py deleted file mode 100644 index 1fbe7d1..0000000 --- a/dbgpt_hub/train/src/llmtuner/extras/template.py +++ /dev/null @@ -1,546 +0,0 @@ -import tiktoken -from dataclasses import dataclass -from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union - -from llmtuner.extras.logging import get_logger - -if TYPE_CHECKING: - from transformers import PreTrainedTokenizer - - -logger = get_logger(__name__) - - -@dataclass -class Template: - prefix: List[Union[str, Dict[str, str]]] - prompt: List[Union[str, Dict[str, str]]] - system: str - sep: List[Union[str, Dict[str, str]]] - stop_words: List[str] - use_history: bool - - def encode_oneturn( - self, - tokenizer: "PreTrainedTokenizer", - query: str, - resp: str, - history: Optional[List[Tuple[str, str]]] = None, - system: Optional[str] = None, - ) -> Tuple[List[int], List[int]]: - r""" - Returns a single pair of token ids representing prompt and response respectively. - """ - system, history = self._format(query, resp, history, system) - encoded_pairs = self._encode(tokenizer, system, history) - prompt_ids = [] - for query_ids, resp_ids in encoded_pairs[:-1]: - prompt_ids = prompt_ids + query_ids + resp_ids - prompt_ids, answer_ids = prompt_ids + encoded_pairs[-1][0], encoded_pairs[-1][1] - return prompt_ids, answer_ids - - def encode_multiturn( - self, - tokenizer: "PreTrainedTokenizer", - query: str, - resp: str, - history: Optional[List[Tuple[str, str]]] = None, - system: Optional[str] = None, - ) -> List[Tuple[List[int], List[int]]]: - r""" - Returns multiple pairs of token ids representing prompts and responses respectively. - """ - system, history = self._format(query, resp, history, system) - encoded_pairs = self._encode(tokenizer, system, history) - return encoded_pairs - - def _format( - self, - query: str, - resp: str, - history: Optional[List[Tuple[str, str]]] = None, - system: Optional[str] = None, - ) -> Tuple[str, List[Tuple[str, str]]]: - r""" - Aligns inputs to the standard format. - """ - system = system or self.system # use system if provided - history = history if (history and self.use_history) else [] - history = history + [(query, resp)] - return system, history - - def _get_special_ids( - self, tokenizer: "PreTrainedTokenizer" - ) -> Tuple[List[int], List[int]]: - if tokenizer.bos_token_id is not None and getattr( - tokenizer, "add_bos_token", True - ): # baichuan-13b has no bos token - bos_ids = [tokenizer.bos_token_id] - else: - bos_ids = [] # bos token is optional - - if tokenizer.eos_token_id is not None: - eos_ids = [tokenizer.eos_token_id] - else: - raise ValueError("EOS token is required.") - - return bos_ids, eos_ids - - def _encode( - self, - tokenizer: "PreTrainedTokenizer", - system: str, - history: List[Tuple[str, str]], - ) -> List[Tuple[List[int], List[int]]]: - r""" - Encodes formatted inputs to pairs of token ids. - Turn 0: bos + prefix + sep + query resp + eos - Turn t: sep + bos + query resp + eos - """ - bos_ids, eos_ids = self._get_special_ids(tokenizer) - sep_ids = self._convert_inputs_to_ids(tokenizer, context=self.sep) - encoded_pairs = [] - for turn_idx, (query, resp) in enumerate(history): - if turn_idx == 0: - prefix_ids = self._convert_inputs_to_ids( - tokenizer, context=self.prefix, system=system - ) - if len(prefix_ids) != 0: # has prefix - prefix_ids = bos_ids + prefix_ids + sep_ids - else: - prefix_ids = bos_ids - else: - prefix_ids = sep_ids + bos_ids - - query_ids = self._convert_inputs_to_ids( - tokenizer, context=self.prompt, query=query, idx=str(turn_idx) - ) - resp_ids = self._convert_inputs_to_ids(tokenizer, context=[resp]) - encoded_pairs.append((prefix_ids + query_ids, resp_ids + eos_ids)) - return encoded_pairs - - def _convert_inputs_to_ids( - self, - tokenizer: "PreTrainedTokenizer", - context: List[Union[str, Dict[str, str]]], - system: Optional[str] = None, - query: Optional[str] = None, - idx: Optional[str] = None, - ) -> List[int]: - r""" - Converts context to token ids. - """ - if isinstance( - getattr(tokenizer, "tokenizer", None), tiktoken.Encoding - ): # for tiktoken tokenizer (Qwen) - kwargs = dict(allowed_special="all") - else: - kwargs = dict(add_special_tokens=False) - - token_ids = [] - for elem in context: - if isinstance(elem, str): - elem = ( - elem.replace("{{system}}", system, 1) - if system is not None - else elem - ) - elem = ( - elem.replace("{{query}}", query, 1) if query is not None else elem - ) - elem = elem.replace("{{idx}}", idx, 1) if idx is not None else elem - token_ids = token_ids + tokenizer.encode(elem, **kwargs) - elif isinstance(elem, dict): - token_ids = token_ids + [ - tokenizer.convert_tokens_to_ids(elem.get("token")) - ] - else: - raise NotImplementedError - - return token_ids - - - -@dataclass -class Llama2Template(Template): - def _encode( - self, - tokenizer: "PreTrainedTokenizer", - system: str, - history: List[Tuple[str, str]], - ) -> List[Tuple[List[int], List[int]]]: - r""" - Encodes formatted inputs to pairs of token ids. - Turn 0: bos + prefix + query resp + eos - Turn t: bos + query resp + eos - """ - bos_ids, eos_ids = self._get_special_ids(tokenizer) - encoded_pairs = [] - for turn_idx, (query, resp) in enumerate(history): - if turn_idx == 0: # llama2 template has no sep_ids - query = self.prefix[0].replace("{{system}}", system) + query - query_ids = self._convert_inputs_to_ids( - tokenizer, context=self.prompt, query=query - ) - resp_ids = self._convert_inputs_to_ids(tokenizer, context=[resp]) - encoded_pairs.append((bos_ids + query_ids, resp_ids + eos_ids)) - return encoded_pairs - - -templates: Dict[str, Template] = {} - - -def register_template( - name: str, - prefix: List[Union[str, Dict[str, str]]], - prompt: List[Union[str, Dict[str, str]]], - system: str, - sep: List[Union[str, Dict[str, str]]], - stop_words: Optional[List[str]] = [], - use_history: Optional[bool] = True, -) -> None: - template_class = Llama2Template if "llama2" in name else Template - templates[name] = template_class( - prefix=prefix, - prompt=prompt, - system=system, - sep=sep, - stop_words=stop_words, - use_history=use_history, - ) - - -def get_template_and_fix_tokenizer( - name: str, tokenizer: "PreTrainedTokenizer" -) -> Template: - template = templates.get(name, None) - assert template is not None, "Template {} does not exist.".format(name) - - additional_special_tokens = template.stop_words - if len(template.stop_words): # inplace method - if tokenizer.eos_token_id is not None: - additional_special_tokens.append(tokenizer.eos_token) - - tokenizer.eos_token = additional_special_tokens[ - 0 - ] # use the first stop word as eos token - additional_special_tokens.pop(0) - logger.info("Replace eos token: {}".format(tokenizer.eos_token)) - - if tokenizer.eos_token_id is None: - tokenizer.eos_token = "<|endoftext|>" - logger.info("Add eos token: {}".format(tokenizer.eos_token)) - - if tokenizer.pad_token_id is None: - if tokenizer.unk_token_id is not None: - tokenizer.pad_token = tokenizer.unk_token - else: - tokenizer.pad_token = tokenizer.eos_token - logger.info("Add pad token: {}".format(tokenizer.pad_token)) - - tokenizer.add_special_tokens( - dict(additional_special_tokens=additional_special_tokens), - replace_additional_special_tokens=False, - ) - return template - - -r""" -Supports language model inference without histories. -""" -register_template( - name="vanilla", - prefix=[], - prompt=["{{query}}"], - system="", - sep=[], - use_history=False, -) - - -r""" -Default template. -""" -register_template( - name="default", - prefix=["{{system}}"], - prompt=["Human: {{query}}\nAssistant: "], - system=( - "A chat between a curious user and an artificial intelligence assistant. " - "The assistant gives helpful, detailed, and polite answers to the user's questions." - ), - sep=["\n"], -) - - -r""" -Supports: https://huggingface.co/meta-llama/Llama-2-7b-chat-hf - https://huggingface.co/meta-llama/Llama-2-13b-chat-hf - https://huggingface.co/meta-llama/Llama-2-70b-chat-hf -""" -register_template( - name="llama2", - prefix=["<>\n{{system}}\n<>\n\n"], - prompt=["[INST] {{query}} [/INST] "], - system=( - "You are a helpful, respectful and honest assistant. " - "Always answer as helpfully as possible, while being safe. " - "Your answers should not include any harmful, unethical, " - "racist, sexist, toxic, dangerous, or illegal content. " - "Please ensure that your responses are socially unbiased and positive in nature.\n" - "If a question does not make any sense, or is not factually coherent, " - "explain why instead of answering something not correct. " - "If you don't know the answer to a question, please don't share false information." - ), - sep=[], -) - - -r""" -Supports: https://github.com/ymcui/Chinese-LLaMA-Alpaca-2 - https://huggingface.co/ziqingyang/chinese-alpaca-2-7b -""" -register_template( - name="llama2_zh", - prefix=["<>\n{{system}}\n<>\n\n"], - prompt=["[INST] {{query}} [/INST] "], - system="You are a helpful assistant. 你是一个乐于助人的助手。", - sep=[], -) - - -r""" -Supports: https://huggingface.co/tatsu-lab/alpaca-7b-wdiff - https://github.com/ymcui/Chinese-LLaMA-Alpaca -""" -register_template( - name="alpaca", - prefix=["{{system}}"], - prompt=["### Instruction:\n{{query}}\n\n### Response:\n"], - system=( - "Below is an instruction that describes a task. " - "Write a response that appropriately completes the request." - ), - sep=["\n\n"], -) - - -r""" -Supports: https://huggingface.co/lmsys/vicuna-7b-delta-v1.1 - https://huggingface.co/lmsys/vicuna-13b-delta-v1.1 -""" -register_template( - name="vicuna", - prefix=["{{system}}"], - prompt=["USER: {{query}} ASSISTANT: "], - system=( - "A chat between a curious user and an artificial intelligence assistant. " - "The assistant gives helpful, detailed, and polite answers to the user's questions." - ), - sep=[], -) - - -r""" -Supports: https://huggingface.co/BelleGroup/BELLE-LLaMA-EXT-13B -""" -register_template( - name="belle", - prefix=["{{system}}"], - prompt=["Human: {{query}}\n\nBelle: "], - system="", - sep=["\n\n"], -) - - -r""" -Supports: https://github.com/CVI-SZU/Linly -""" -register_template( - name="linly", - prefix=["{{system}}"], - prompt=["User: {{query}}\nBot: "], - system="", - sep=["\n"], -) - - -r""" -Supports: https://github.com/Neutralzz/BiLLa -""" -register_template( - name="billa", - prefix=["{{system}}"], - prompt=["Human: {{query}}\nAssistant: "], - system="", - sep=["\n"], -) - - -r""" -Supports: https://huggingface.co/IDEA-CCNL/Ziya-LLaMA-13B-v1 -""" -register_template( - name="ziya", - prefix=["{{system}}"], - prompt=[{"token": ""}, ":{{query}}\n", {"token": ""}, ":"], - system="", - sep=["\n"], -) - - -r""" -Supports: https://huggingface.co/qhduan/aquilachat-7b -""" -register_template( - name="aquila", - prefix=["{{system}}"], - prompt=["Human: {{query}}###Assistant: "], - system=( - "A chat between a curious human and an artificial intelligence assistant. " - "The assistant gives helpful, detailed, and polite answers to the human's questions." - ), - sep=["###"], -) - - -r""" -Supports: https://huggingface.co/internlm/internlm-chat-7b -""" -register_template( - name="intern", - prefix=["{{system}}"], - prompt=["<|User|>:{{query}}", {"token": ""}, "\n<|Bot|>:"], - system="", - sep=["\n"], - stop_words=["", ""], # internlm cannot replace eos token -) - - -r""" -Supports: https://huggingface.co/baichuan-inc/Baichuan-13B-Chat -Used for training and inference of the fine-tuned models. -""" -register_template( - name="baichuan", - prefix=["{{system}}"], - prompt=[ - {"token": ""}, # user token - "{{query}}", - {"token": ""}, # assistant token - ], - system="", - sep=[], - stop_words=[], -) - - -r""" -Supports: https://huggingface.co/baichuan-inc/Baichuan-13B-Chat -Used for inference of the original model. -""" -register_template( - name="baichuan_eval", - prefix=["{{system}}", {"token": ""}], # user token - prompt=["{{query}}", {"token": ""}], # assistant token - system="", - sep=[], - stop_words=[""], # user token -) - -r""" -Supports: https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat - https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat -Used for training and inference of the fine-tuned models. -""" -register_template( - name="baichuan2", - prefix=["{{system}}"], - prompt=[ - {"token": ""}, # user token - "{{query}}", - {"token": ""}, # assistant token - ], - system="", - sep=[], -) - - -r""" -Supports: https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat - https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat -Used for inference of the original model. -""" -register_template( - name="baichuan2_eval", - prefix=["{{system}}", {"token": ""}], # user token - prompt=["{{query}}", {"token": ""}], # assistant token - system="", - sep=[], - stop_words=[""], # user token -) - - -r""" -Supports: https://huggingface.co/HuggingFaceH4/starchat-alpha - https://huggingface.co/HuggingFaceH4/starchat-beta - -""" -register_template( - name="starchat", - prefix=[{"token": "<|system|>"}, "\n{{system}}", {"token": "<|end|>"}], - prompt=[ - {"token": "<|user|>"}, - "\n{{query}}", - {"token": "<|end|>"}, - "\n", - {"token": "<|assistant|>"}, - ], - system="", - sep=["\n"], - stop_words=["<|end|>"], -) - - -r""" -Supports: https://huggingface.co/Qwen/Qwen-7B-Chat -""" -register_template( - name="chatml", - prefix=[{"token": "<|im_start|>"}, "system\n{{system}}", {"token": "<|im_end|>"}], - prompt=[ - {"token": "<|im_start|>"}, - "user\n{{query}}", - {"token": "<|im_end|>"}, - "\n", - {"token": "<|im_start|>"}, - "assistant\n", - ], - system="You are a helpful assistant.", - sep=["\n"], - stop_words=["<|im_end|>"], -) - - -r""" -Supports: https://huggingface.co/THUDM/chatglm2-6b -""" -register_template( - name="chatglm2", - prefix=[{"token": "[gMASK]"}, {"token": "sop"}, "{{system}}"], - prompt=["[Round {{idx}}]\n\n问:{{query}}\n\n答:"], - system="", - sep=["\n\n"], -) - - -r""" -Supports: https://huggingface.co/xverse/XVERSE-13B-Chat -""" -register_template( - name="xverse", - prefix=["{{system}}"], - prompt=["Human: {{query}}\n\nAssistant: "], - system="", - sep=[], -) diff --git a/dbgpt_hub/train/src/llmtuner/hparams/__init__.py b/dbgpt_hub/train/src/llmtuner/hparams/__init__.py deleted file mode 100644 index f0547cc..0000000 --- a/dbgpt_hub/train/src/llmtuner/hparams/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from .data_args import DataArguments -from .finetuning_args import FinetuningArguments -from .generating_args import GeneratingArguments -from .model_args import ModelArguments diff --git a/dbgpt_hub/train/src/llmtuner/hparams/data_args.py b/dbgpt_hub/train/src/llmtuner/hparams/data_args.py deleted file mode 100644 index 7a129b2..0000000 --- a/dbgpt_hub/train/src/llmtuner/hparams/data_args.py +++ /dev/null @@ -1,171 +0,0 @@ -import os -import json -from typing import List, Literal, Optional -from dataclasses import dataclass, field - - -@dataclass -class DatasetAttr: - load_from: str - dataset_name: Optional[str] = None - dataset_sha1: Optional[str] = None - system_prompt: Optional[str] = None - stage: Optional[str] = None - - def __repr__(self) -> str: - return self.dataset_name - - def __post_init__(self): - self.prompt = "instruction" - self.query = "input" - self.response = "output" - self.history = None - - -@dataclass -class DataArguments: - r""" - Arguments pertaining to what data we are going to input our model for training and evaluation. - """ - template: str = field( - metadata={ - "help": "Which template to use for constructing prompts in training and inference." - } - ) - dataset: Optional[str] = field( - default="alpaca_en", - metadata={ - "help": "The name of provided dataset(s) to use. Use commas to separate multiple datasets." - }, - ) - dataset_dir: Optional[str] = field( - default="data", metadata={"help": "The name of the folder containing datasets."} - ) - split: Optional[str] = field( - default="train", - metadata={"help": "Which dataset split to use for training and evaluation."}, - ) - streaming: Optional[bool] = field( - default=False, metadata={"help": "Enable streaming mode."} - ) - buffer_size: Optional[int] = field( - default=16384, - metadata={ - "help": "Size of the buffer to randomly sample examples from in streaming mode." - }, - ) - mix_strategy: Optional[ - Literal["concat", "interleave_under", "interleave_over"] - ] = field(default="concat", metadata={"help": "Strategy to use in dataset mixing."}) - interleave_probs: Optional[str] = field( - default=None, - metadata={ - "help": "Probabilities to sample data from datasets. Use commas to separate multiple datasets." - }, - ) - overwrite_cache: Optional[bool] = field( - default=False, - metadata={"help": "Overwrite the cached training and evaluation sets."}, - ) - preprocessing_num_workers: Optional[int] = field( - default=None, - metadata={"help": "The number of processes to use for the preprocessing."}, - ) - max_source_length: Optional[int] = field( - default=512, - metadata={ - "help": "The maximum total input sequence length after tokenization." - }, - ) - max_target_length: Optional[int] = field( - default=512, - metadata={ - "help": "The maximum total output sequence length after tokenization." - }, - ) - max_samples: Optional[int] = field( - default=None, - metadata={ - "help": "For debugging purposes, truncate the number of examples for each dataset." - }, - ) - eval_num_beams: Optional[int] = field( - default=None, - metadata={ - "help": "Number of beams to use for evaluation. This argument will be passed to `model.generate`" - }, - ) - ignore_pad_token_for_loss: Optional[bool] = field( - default=True, - metadata={ - "help": "Whether to ignore the tokens corresponding to padded labels in the loss computation or not." - }, - ) - system_prompt: Optional[str] = field( - default=None, - metadata={ - "help": "System prompt to add before the user query. Use `|` to separate multiple prompts in training." - }, - ) - val_size: Optional[float] = field( - default=0, - metadata={ - "help": "Size of the development set, should be an integer or a float in range `[0,1)`." - }, - ) - - def init_for_training(self): # support mixing multiple datasets - dataset_names = [ds.strip() for ds in self.dataset.split(",")] - with open(os.path.join(self.dataset_dir, "dataset_info.json"), "r") as f: - dataset_info = json.load(f) - - prompt_list = self.system_prompt.split("|") if self.system_prompt else [None] - prompt_list = prompt_list * (len(dataset_names) // len(prompt_list)) - assert len(prompt_list) == len( - dataset_names - ), "Number of system prompts should be equal to datasets or 1." - - if self.interleave_probs is not None: - self.interleave_probs = [ - float(prob.strip()) for prob in self.interleave_probs.split(",") - ] - - self.dataset_list: List[DatasetAttr] = [] - for i, name in enumerate(dataset_names): - if name not in dataset_info: - raise ValueError( - "Undefined dataset {} in dataset_info.json.".format(name) - ) - - if "hf_hub_url" in dataset_info[name]: - dataset_attr = DatasetAttr( - "hf_hub", - dataset_name=dataset_info[name]["hf_hub_url"], - stage=dataset_info[name].get("stage", None), - ) - elif "script_url" in dataset_info[name]: - dataset_attr = DatasetAttr( - "script", - dataset_name=dataset_info[name]["script_url"], - stage=dataset_info[name].get("stage", None), - ) - else: - dataset_attr = DatasetAttr( - "file", - dataset_name=dataset_info[name]["file_name"], - dataset_sha1=dataset_info[name].get("file_sha1", None), - stage=dataset_info[name].get("stage", None), - ) - - if "columns" in dataset_info[name]: - dataset_attr.prompt = dataset_info[name]["columns"].get("prompt", None) - dataset_attr.query = dataset_info[name]["columns"].get("query", None) - dataset_attr.response = dataset_info[name]["columns"].get( - "response", None - ) - dataset_attr.history = dataset_info[name]["columns"].get( - "history", None - ) - - dataset_attr.system_prompt = prompt_list[i] - self.dataset_list.append(dataset_attr) diff --git a/dbgpt_hub/train/src/llmtuner/hparams/finetuning_args.py b/dbgpt_hub/train/src/llmtuner/hparams/finetuning_args.py deleted file mode 100644 index 5a8894a..0000000 --- a/dbgpt_hub/train/src/llmtuner/hparams/finetuning_args.py +++ /dev/null @@ -1,123 +0,0 @@ -import json -from typing import Literal, Optional -from dataclasses import asdict, dataclass, field - - -@dataclass -class FinetuningArguments: - r""" - Arguments pertaining to which techniques we are going to fine-tuning with. - """ - finetuning_type: Optional[Literal["lora", "freeze", "full", "none"]] = field( - default="lora", metadata={"help": "Which fine-tuning method to use."} - ) - num_hidden_layers: Optional[int] = field( - default=32, - metadata={ - "help": 'Number of decoder blocks in the model for partial-parameter (freeze) fine-tuning. \ - LLaMA choices: ["32", "40", "60", "80"], \ - LLaMA-2 choices: ["32", "40", "80"], \ - BLOOM choices: ["24", "30", "70"], \ - Falcon choices: ["32", "60"], \ - Baichuan choices: ["32", "40"] \ - Qwen choices: ["32"], \ - XVERSE choices: ["40"], \ - ChatGLM2 choices: ["28"]' - }, - ) - num_layer_trainable: Optional[int] = field( - default=3, - metadata={ - "help": "Number of trainable layers for partial-parameter (freeze) fine-tuning." - }, - ) - name_module_trainable: Optional[ - Literal["mlp", "self_attn", "self_attention"] - ] = field( - default="mlp", - metadata={ - "help": 'Name of trainable modules for partial-parameter (freeze) fine-tuning. \ - LLaMA choices: ["mlp", "self_attn"], \ - BLOOM & Falcon & ChatGLM2 choices: ["mlp", "self_attention"], \ - Baichuan choices: ["mlp", "self_attn"], \ - Qwen choices: ["mlp", "attn"], \ - LLaMA-2, InternLM, XVERSE choices: the same as LLaMA.' - }, - ) - lora_rank: Optional[int] = field( - default=8, metadata={"help": "The intrinsic dimension for LoRA fine-tuning."} - ) - lora_alpha: Optional[float] = field( - default=32.0, - metadata={ - "help": "The scale factor for LoRA fine-tuning (similar with the learning rate)." - }, - ) - lora_dropout: Optional[float] = field( - default=0.1, metadata={"help": "Dropout rate for the LoRA fine-tuning."} - ) - lora_target: Optional[str] = field( - default=None, - metadata={ - "help": 'Name(s) of target modules to apply LoRA. Use commas to separate multiple modules. \ - LLaMA choices: ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"], \ - BLOOM & Falcon & ChatGLM2 choices: ["query_key_value", "self_attention.dense", "mlp.dense"], \ - Baichuan choices: ["W_pack", "o_proj", "gate_proj", "up_proj", "down_proj"], \ - Qwen choices: ["c_attn", "attn.c_proj", "w1", "w2", "mlp.c_proj"], \ - LLaMA-2, InternLM, XVERSE choices: the same as LLaMA.' - }, - ) - resume_lora_training: Optional[bool] = field( - default=True, - metadata={ - "help": "Whether to resume training from the last LoRA weights or create new weights after merging them." - }, - ) - ppo_score_norm: Optional[bool] = field( - default=False, metadata={"help": "Use score normalization in PPO Training."} - ) - dpo_beta: Optional[float] = field( - default=0.1, metadata={"help": "The beta parameter for the DPO loss."} - ) - - def __post_init__(self): - if isinstance( - self.lora_target, str - ): # support custom target modules/layers of LoRA - self.lora_target = [ - target.strip() for target in self.lora_target.split(",") - ] - - if ( - self.num_layer_trainable > 0 - ): # fine-tuning the last n layers if num_layer_trainable > 0 - trainable_layer_ids = [ - self.num_hidden_layers - k - 1 for k in range(self.num_layer_trainable) - ] - else: # fine-tuning the first n layers if num_layer_trainable < 0 - trainable_layer_ids = [k for k in range(-self.num_layer_trainable)] - - self.trainable_layers = [ - "{:d}.{}".format(idx, self.name_module_trainable) - for idx in trainable_layer_ids - ] - - assert self.finetuning_type in [ - "lora", - "freeze", - "full", - "none", - ], "Invalid fine-tuning method." - - def save_to_json(self, json_path: str): - r"""Saves the content of this instance in JSON format inside `json_path`.""" - json_string = json.dumps(asdict(self), indent=2, sort_keys=True) + "\n" - with open(json_path, "w", encoding="utf-8") as f: - f.write(json_string) - - @classmethod - def load_from_json(cls, json_path: str): - r"""Creates an instance from the content of `json_path`.""" - with open(json_path, "r", encoding="utf-8") as f: - text = f.read() - return cls(**json.loads(text)) diff --git a/dbgpt_hub/train/src/llmtuner/hparams/generating_args.py b/dbgpt_hub/train/src/llmtuner/hparams/generating_args.py deleted file mode 100644 index dc8e738..0000000 --- a/dbgpt_hub/train/src/llmtuner/hparams/generating_args.py +++ /dev/null @@ -1,65 +0,0 @@ -from typing import Any, Dict, Optional -from dataclasses import asdict, dataclass, field - - -@dataclass -class GeneratingArguments: - r""" - Arguments pertaining to specify the decoding parameters. - """ - do_sample: Optional[bool] = field( - default=True, - metadata={ - "help": "Whether or not to use sampling, use greedy decoding otherwise." - }, - ) - temperature: Optional[float] = field( - default=0.95, - metadata={"help": "The value used to modulate the next token probabilities."}, - ) - top_p: Optional[float] = field( - default=0.7, - metadata={ - "help": "The smallest set of most probable tokens with probabilities that add up to top_p or higher are kept." - }, - ) - top_k: Optional[int] = field( - default=50, - metadata={ - "help": "The number of highest probability vocabulary tokens to keep for top-k filtering." - }, - ) - num_beams: Optional[int] = field( - default=1, - metadata={"help": "Number of beams for beam search. 1 means no beam search."}, - ) - max_length: Optional[int] = field( - default=None, - metadata={ - "help": "The maximum length the generated tokens can have. It can be overridden by max_new_tokens." - }, - ) - max_new_tokens: Optional[int] = field( - default=512, - metadata={ - "help": "The maximum numbers of tokens to generate, ignoring the number of tokens in the prompt." - }, - ) - repetition_penalty: Optional[float] = field( - default=1.0, - metadata={ - "help": "The parameter for repetition penalty. 1.0 means no penalty." - }, - ) - length_penalty: Optional[float] = field( - default=1.0, - metadata={ - "help": "Exponential penalty to the length that is used with beam-based generation." - }, - ) - - def to_dict(self) -> Dict[str, Any]: - args = asdict(self) - if args.get("max_new_tokens", None): - args.pop("max_length", None) - return args diff --git a/dbgpt_hub/train/src/llmtuner/hparams/model_args.py b/dbgpt_hub/train/src/llmtuner/hparams/model_args.py deleted file mode 100644 index cb81456..0000000 --- a/dbgpt_hub/train/src/llmtuner/hparams/model_args.py +++ /dev/null @@ -1,108 +0,0 @@ -import torch -from typing import Literal, Optional -from dataclasses import dataclass, field - - -@dataclass -class ModelArguments: - r""" - Arguments pertaining to which model/config/tokenizer we are going to fine-tune. - """ - model_name_or_path: str = field( - metadata={ - "help": "Path to pretrained model or model identifier from huggingface.co/models." - } - ) - cache_dir: Optional[str] = field( - default=None, - metadata={ - "help": "Where to store the pretrained models downloaded from huggingface.co." - }, - ) - use_fast_tokenizer: Optional[bool] = field( - default=False, - metadata={ - "help": "Whether to use one of the fast tokenizer (backed by the tokenizers library) or not." - }, - ) - use_auth_token: Optional[bool] = field( - default=False, - metadata={ - "help": "Will use the token generated when running `huggingface-cli login`." - }, - ) - model_revision: Optional[str] = field( - default="main", - metadata={ - "help": "The specific model version to use (can be a branch name, tag name or commit id)." - }, - ) - padding_side: Optional[Literal["left", "right"]] = field( - default="left", - metadata={"help": "The side on which the model should have padding applied."}, - ) - quantization_bit: Optional[int] = field( - default=None, metadata={"help": "The number of bits to quantize the model."} - ) - quantization_type: Optional[Literal["fp4", "nf4"]] = field( - default="nf4", - metadata={"help": "Quantization data type to use in int4 training."}, - ) - double_quantization: Optional[bool] = field( - default=True, - metadata={ - "help": "Whether to use double quantization in int4 training or not." - }, - ) - rope_scaling: Optional[Literal["linear", "dynamic"]] = field( - default=None, metadata={"help": "Adopt scaled rotary positional embeddings."} - ) - checkpoint_dir: Optional[str] = field( - default=None, - metadata={ - "help": "Path to the directory(s) containing the delta model checkpoints as well as the configurations." - }, - ) - # reward_model: Optional[str] = field( - # default=None, - # metadata={"help": "Path to the directory containing the checkpoints of the reward model."} - # ) - plot_loss: Optional[bool] = field( - default=False, - metadata={ - "help": "Whether to plot the training loss after fine-tuning or not." - }, - ) - hf_auth_token: Optional[str] = field( - default=None, metadata={"help": "Auth token to log in with Hugging Face Hub."} - ) - compute_dtype: Optional[torch.dtype] = field( - default=None, - metadata={ - "help": "Used in quantization configs. Do not specify this argument manually." - }, - ) - model_max_length: Optional[int] = field( - default=None, - metadata={ - "help": "Used in rope scaling. Do not specify this argument manually." - }, - ) - - def __post_init__(self): - if self.compute_dtype is not None or self.model_max_length is not None: - raise ValueError("These arguments cannot be specified.") - - if self.checkpoint_dir is not None: # support merging multiple lora weights - self.checkpoint_dir = [cd.strip() for cd in self.checkpoint_dir.split(",")] - - if self.quantization_bit is not None: - assert self.quantization_bit in [ - 4, - 8, - ], "We only accept 4-bit or 8-bit quantization." - - if self.use_auth_token == True and self.hf_auth_token is not None: - from huggingface_hub.hf_api import HfFolder # lazy load - - HfFolder.save_token(self.hf_auth_token) diff --git a/dbgpt_hub/train/src/llmtuner/tuner/__init__.py b/dbgpt_hub/train/src/llmtuner/tuner/__init__.py deleted file mode 100644 index 4d5a83e..0000000 --- a/dbgpt_hub/train/src/llmtuner/tuner/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from llmtuner.tuner.tune import export_model, run_exp diff --git a/dbgpt_hub/train/src/llmtuner/tuner/core/__init__.py b/dbgpt_hub/train/src/llmtuner/tuner/core/__init__.py deleted file mode 100644 index bd1c5cf..0000000 --- a/dbgpt_hub/train/src/llmtuner/tuner/core/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from llmtuner.tuner.core.parser import get_train_args, get_infer_args -from llmtuner.tuner.core.loader import load_model_and_tokenizer diff --git a/dbgpt_hub/train/src/llmtuner/tuner/core/adapter.py b/dbgpt_hub/train/src/llmtuner/tuner/core/adapter.py deleted file mode 100644 index bd8ddc3..0000000 --- a/dbgpt_hub/train/src/llmtuner/tuner/core/adapter.py +++ /dev/null @@ -1,118 +0,0 @@ -import os -import torch -from typing import TYPE_CHECKING - -from peft import PeftModel, TaskType, LoraConfig, get_peft_model -from peft.utils import CONFIG_NAME, WEIGHTS_NAME - -from llmtuner.extras.logging import get_logger -from llmtuner.extras.save_and_load import load_trainable_params - -if TYPE_CHECKING: - from transformers.modeling_utils import PreTrainedModel - from llmtuner.hparams import ModelArguments, FinetuningArguments - - -logger = get_logger(__name__) - - -def init_adapter( - model: "PreTrainedModel", - model_args: "ModelArguments", - finetuning_args: "FinetuningArguments", - is_trainable: bool, - is_mergeable: bool, -) -> "PreTrainedModel": - r""" - Initializes the adapters. - - Support full-parameter, freeze and LoRA training. - - Note that the trainable parameters must be cast to float32. - """ - - if finetuning_args.finetuning_type == "none" and is_trainable: - raise ValueError("You cannot use finetuning_type=none while training.") - - if finetuning_args.finetuning_type == "full" and is_trainable: - logger.info("Fine-tuning method: Full") - model = model.float() - - if finetuning_args.finetuning_type == "freeze": - logger.info("Fine-tuning method: Freeze") - - for name, param in model.named_parameters(): - if not any( - trainable_layer in name - for trainable_layer in finetuning_args.trainable_layers - ): - param.requires_grad_(False) - else: - param.data = param.data.to(torch.float32) - - if model_args.checkpoint_dir is not None: - assert load_trainable_params( - model, model_args.checkpoint_dir[0] - ), "Model checkpoint is not correctly loaded." - - if finetuning_args.finetuning_type == "lora": - logger.info("Fine-tuning method: LoRA") - latest_checkpoint = None - - if model_args.checkpoint_dir is not None: - assert os.path.exists( - os.path.join(model_args.checkpoint_dir[0], WEIGHTS_NAME) - ), "Provided path ({}) does not contain a LoRA weight.".format( - model_args.checkpoint_dir[0] - ) - assert os.path.exists( - os.path.join(model_args.checkpoint_dir[0], CONFIG_NAME) - ), "The given checkpoint may be not a LoRA checkpoint, please specify `--finetuning_type full/freeze` instead." - - if (is_trainable and finetuning_args.resume_lora_training) or ( - not is_mergeable - ): # continually fine-tuning - checkpoints_to_merge, latest_checkpoint = ( - model_args.checkpoint_dir[:-1], - model_args.checkpoint_dir[-1], - ) - else: - checkpoints_to_merge = model_args.checkpoint_dir - - for checkpoint in checkpoints_to_merge: - model = PeftModel.from_pretrained(model, checkpoint) - model = model.merge_and_unload() - - if len(checkpoints_to_merge) > 0: - logger.info( - "Merged {} model checkpoint(s).".format(len(checkpoints_to_merge)) - ) - - if ( - latest_checkpoint is not None - ): # resume lora training or quantized inference - model = PeftModel.from_pretrained( - model, latest_checkpoint, is_trainable=is_trainable - ) - - if ( - is_trainable and latest_checkpoint is None - ): # create new lora weights while training - lora_config = LoraConfig( - task_type=TaskType.CAUSAL_LM, - inference_mode=False, - r=finetuning_args.lora_rank, - lora_alpha=finetuning_args.lora_alpha, - lora_dropout=finetuning_args.lora_dropout, - target_modules=finetuning_args.lora_target, - ) - model = get_peft_model(model, lora_config) - - if model_args.checkpoint_dir is not None: - logger.info( - "Loaded fine-tuned model from checkpoint(s): {}".format( - ",".join(model_args.checkpoint_dir) - ) - ) - - return model diff --git a/dbgpt_hub/train/src/llmtuner/tuner/core/loader.py b/dbgpt_hub/train/src/llmtuner/tuner/core/loader.py deleted file mode 100644 index 57d18e1..0000000 --- a/dbgpt_hub/train/src/llmtuner/tuner/core/loader.py +++ /dev/null @@ -1,255 +0,0 @@ -import os -import math -import torch -from types import MethodType -from typing import TYPE_CHECKING, Literal, Optional, Tuple - -from transformers import ( - AutoConfig, - AutoModelForCausalLM, - AutoTokenizer, - BitsAndBytesConfig, - PretrainedConfig, - PreTrainedModel, - PreTrainedTokenizerBase, -) -from transformers.utils import check_min_version -from transformers.utils.versions import require_version -from transformers.deepspeed import is_deepspeed_zero3_enabled -from trl import AutoModelForCausalLMWithValueHead - -from llmtuner.extras.logging import reset_logging, get_logger -from llmtuner.extras.misc import count_parameters, prepare_model_for_training -from llmtuner.extras.save_and_load import load_valuehead_params -from llmtuner.hparams import FinetuningArguments -from llmtuner.tuner.core.adapter import init_adapter - -if TYPE_CHECKING: - from transformers import PreTrainedTokenizer - from llmtuner.hparams import ModelArguments - - -logger = get_logger(__name__) - - -check_min_version("4.29.1") -require_version("datasets>=2.12.0", "To fix: pip install datasets>=2.12.0") -require_version("accelerate>=0.21.0", "To fix: pip install accelerate>=0.21.0") -require_version("peft>=0.4.0", "To fix: pip install peft>=0.4.0") -require_version("trl>=0.5.0", "To fix: pip install trl>=0.5.0") - - -def load_model_and_tokenizer( - model_args: "ModelArguments", - finetuning_args: "FinetuningArguments", - is_trainable: Optional[bool] = False, - stage: Optional[Literal["pt", "sft", "rm", "ppo"]] = "sft", -) -> Tuple[PreTrainedModel, "PreTrainedTokenizer"]: - r""" - Loads pretrained model and tokenizer. - - Support both training and inference. - """ - if (not is_trainable) and model_args.checkpoint_dir is None: - logger.warning( - "Checkpoint is not found at evaluation, load the original model." - ) - finetuning_args = FinetuningArguments(finetuning_type="none") - - config_kwargs = { - "trust_remote_code": True, - "cache_dir": model_args.cache_dir, - "revision": model_args.model_revision, - "use_auth_token": True if model_args.use_auth_token else None, - } - - tokenizer = AutoTokenizer.from_pretrained( - model_args.model_name_or_path, - use_fast=model_args.use_fast_tokenizer, - padding_side=model_args.padding_side, - **config_kwargs - ) - - if ( - finetuning_args.finetuning_type == "full" - and model_args.checkpoint_dir is not None - ): - model_to_load = model_args.checkpoint_dir[0] - else: - model_to_load = model_args.model_name_or_path - - config = AutoConfig.from_pretrained(model_to_load, **config_kwargs) - - if hasattr(config, "fp16") and hasattr(config, "bf16"): # fix Qwen config - if model_args.compute_dtype == torch.bfloat16: - setattr(config, "bf16", True) - else: - setattr(config, "fp16", True) - - # Set RoPE scaling - if model_args.rope_scaling is not None: - if hasattr(config, "use_dynamic_ntk"): # for Qwen models - if is_trainable: - logger.warning("Qwen model does not support RoPE scaling in training.") - else: - setattr(config, "use_dynamic_ntk", True) - setattr(config, "use_logn_attn", True) - logger.info("Using dynamic NTK scaling.") - - elif hasattr(config, "rope_scaling"): # for LLaMA models - require_version( - "transformers>=4.31.0", "RoPE scaling requires transformers>=4.31.0" - ) - - if is_trainable: - if model_args.rope_scaling == "dynamic": - logger.warning( - "Dynamic NTK may not work well with fine-tuning. " - "See: https://github.com/huggingface/transformers/pull/24653" - ) - - current_max_length = getattr(config, "max_position_embeddings", None) - if ( - current_max_length - and model_args.model_max_length > current_max_length - ): - scaling_factor = float( - math.ceil(model_args.model_max_length / current_max_length) - ) - else: - logger.warning( - "Input length is smaller than max length. Consider increase input length." - ) - scaling_factor = 1.0 - else: - scaling_factor = 2.0 - - setattr( - config, - "rope_scaling", - {"type": model_args.rope_scaling, "factor": scaling_factor}, - ) - logger.info( - "Using {} scaling strategy and setting scaling factor to {}".format( - model_args.rope_scaling, scaling_factor - ) - ) - - else: - logger.warning("Current model does not support RoPE scaling.") - - # Quantization configurations (using bitsandbytes library). - is_mergeable = True - if model_args.quantization_bit is not None: - if is_deepspeed_zero3_enabled(): - raise ValueError("DeepSpeed ZeRO-3 is incompatible with quantization.") - - if model_args.quantization_bit == 8: - require_version( - "bitsandbytes>=0.37.0", "To fix: pip install bitsandbytes>=0.37.0" - ) - config_kwargs["load_in_8bit"] = True - config_kwargs["quantization_config"] = BitsAndBytesConfig(load_in_8bit=True) - - elif model_args.quantization_bit == 4: - require_version( - "bitsandbytes>=0.39.0", "To fix: pip install bitsandbytes>=0.39.0" - ) - config_kwargs["load_in_4bit"] = True - config_kwargs["quantization_config"] = BitsAndBytesConfig( - load_in_4bit=True, - bnb_4bit_compute_dtype=model_args.compute_dtype, - bnb_4bit_use_double_quant=model_args.double_quantization, - bnb_4bit_quant_type=model_args.quantization_type, - ) - - is_mergeable = False - config_kwargs["device_map"] = ( - {"": int(os.environ.get("LOCAL_RANK", "0"))} if is_trainable else "auto" - ) - logger.info("Quantizing model to {} bit.".format(model_args.quantization_bit)) - - # Load and prepare pre-trained models (without valuehead). - model = AutoModelForCausalLM.from_pretrained( - model_to_load, - config=config, - torch_dtype=model_args.compute_dtype, - low_cpu_mem_usage=(not is_deepspeed_zero3_enabled()), - **config_kwargs - ) - - # Disable custom generate method (for Qwen) - if "GenerationMixin" not in str(model.generate.__func__): - model.generate = MethodType(PreTrainedModel.generate, model) - - # Fix LM head (for ChatGLM2) - if not hasattr(model, "lm_head") and hasattr(model, "transformer"): - setattr(model, "lm_head", model.transformer.output_layer) - - # Register auto class to save the custom code files. - if isinstance(config, PretrainedConfig) and "AutoConfig" in getattr( - config, "auto_map", {} - ): - config.__class__.register_for_auto_class() - if isinstance(model, PreTrainedModel) and "AutoModelForCausalLM" in getattr( - config, "auto_map", {} - ): - model.__class__.register_for_auto_class() - if isinstance( - tokenizer, PreTrainedTokenizerBase - ) and "AutoTokenizer" in tokenizer.init_kwargs.get("auto_map", {}): - tokenizer.__class__.register_for_auto_class() - - # Initialize adapters - model = ( - prepare_model_for_training(model, finetuning_args.finetuning_type) - if is_trainable - else model - ) - model = init_adapter(model, model_args, finetuning_args, is_trainable, is_mergeable) - - # Prepare model with valuehead for RLHF - if stage == "rm" or stage == "ppo": - model: AutoModelForCausalLMWithValueHead = ( - AutoModelForCausalLMWithValueHead.from_pretrained(model) - ) - reset_logging() - if ( - stage == "rm" and model_args.checkpoint_dir is not None - ): # load valuehead weights to evaluate reward model - logger.warning( - "Only the last checkpoint containing valuehead will be loaded as the valuehead." - ) - if load_valuehead_params(model, model_args.checkpoint_dir[-1]): - model.v_head.load_state_dict( - { - "summary.weight": getattr(model, "reward_head_weight"), - "summary.bias": getattr(model, "reward_head_bias"), - } - ) - - if stage == "ppo": # load reward model - logger.info("Load reward model from {}".format(model_args.reward_model)) - model.pretrained_model.load_adapter( - model_args.reward_model, "reward", is_trainable=False - ) - assert load_valuehead_params( - model, model_args.reward_model - ), "Reward model is not correctly loaded." - - # Prepare model for inference - if not is_trainable: - model.requires_grad_(False) # fix all model params - infer_dtype = ( - torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float16 - ) # detect cuda capability - model = model.to(infer_dtype) if model_args.quantization_bit is None else model - - trainable_params, all_param = count_parameters(model) - logger.info( - "trainable params: {:d} || all params: {:d} || trainable%: {:.4f}".format( - trainable_params, all_param, 100 * trainable_params / all_param - ) - ) - - return model, tokenizer diff --git a/dbgpt_hub/train/src/llmtuner/tuner/core/parser.py b/dbgpt_hub/train/src/llmtuner/tuner/core/parser.py deleted file mode 100644 index d2dddbc..0000000 --- a/dbgpt_hub/train/src/llmtuner/tuner/core/parser.py +++ /dev/null @@ -1,227 +0,0 @@ -import os -import sys -import torch -import datasets -import transformers -from typing import Any, Dict, Optional, Tuple -from transformers import HfArgumentParser, Seq2SeqTrainingArguments -from transformers.trainer_utils import get_last_checkpoint - -from llmtuner.extras.logging import get_logger -from llmtuner.hparams import ( - ModelArguments, - DataArguments, - FinetuningArguments, - GeneratingArguments, -) - - -logger = get_logger(__name__) - - -def _parse_args( - parser: HfArgumentParser, args: Optional[Dict[str, Any]] = None -) -> Tuple[Any]: - if args is not None: - return parser.parse_dict(args) - elif len(sys.argv) == 2 and sys.argv[1].endswith(".yaml"): - return parser.parse_yaml_file(os.path.abspath(sys.argv[1])) - elif len(sys.argv) == 2 and sys.argv[1].endswith(".json"): - return parser.parse_json_file(os.path.abspath(sys.argv[1])) - else: - return parser.parse_args_into_dataclasses() - - -def parse_train_args( - args: Optional[Dict[str, Any]] = None -) -> Tuple[ - ModelArguments, - DataArguments, - Seq2SeqTrainingArguments, - FinetuningArguments, - GeneratingArguments, -]: - parser = HfArgumentParser( - ( - ModelArguments, - DataArguments, - Seq2SeqTrainingArguments, - FinetuningArguments, - GeneratingArguments, - ) - ) - return _parse_args(parser, args) - - -def parse_infer_args( - args: Optional[Dict[str, Any]] = None -) -> Tuple[ModelArguments, DataArguments, FinetuningArguments, GeneratingArguments]: - parser = HfArgumentParser( - (ModelArguments, DataArguments, FinetuningArguments, GeneratingArguments) - ) - return _parse_args(parser, args) - - -def get_train_args( - args: Optional[Dict[str, Any]] = None -) -> Tuple[ - ModelArguments, - DataArguments, - Seq2SeqTrainingArguments, - FinetuningArguments, - GeneratingArguments, -]: - ( - model_args, - data_args, - training_args, - finetuning_args, - generating_args, - ) = parse_train_args(args) - - # Setup logging - if training_args.should_log: - # The default of training_args.log_level is passive, so we set log level at info here to have that default. - transformers.utils.logging.set_verbosity_info() - - log_level = training_args.get_process_log_level() - datasets.utils.logging.set_verbosity(log_level) - transformers.utils.logging.set_verbosity(log_level) - transformers.utils.logging.enable_default_handler() - transformers.utils.logging.enable_explicit_format() - - # Check arguments (do not check finetuning_args since it may be loaded from checkpoints) - data_args.init_for_training() - - if training_args.max_steps == -1 and data_args.streaming: - raise ValueError("Please specify `max_steps` in streaming mode.") - - if data_args.val_size > 1e-6 and data_args.val_size < 1 and data_args.streaming: - raise ValueError("Streaming mode should have an integer val size.") - - if training_args.do_train and training_args.predict_with_generate: - raise ValueError( - "`predict_with_generate` cannot be set as True while training." - ) - - if ( - training_args.do_train - and finetuning_args.finetuning_type == "lora" - and finetuning_args.lora_target is None - ): - raise ValueError("Please specify `lora_target` in LoRA training.") - - if ( - model_args.quantization_bit is not None - and finetuning_args.finetuning_type != "lora" - ): - raise ValueError("Quantization is only compatible with the LoRA method.") - - if model_args.checkpoint_dir is not None: - if finetuning_args.finetuning_type != "lora": - if len(model_args.checkpoint_dir) != 1: - raise ValueError("Only LoRA tuning accepts multiple checkpoints.") - elif ( - model_args.quantization_bit is not None - and len(model_args.checkpoint_dir) != 1 - ): - raise ValueError("Quantized model only accepts a single checkpoint.") - - if model_args.quantization_bit is not None and (not training_args.do_train): - logger.warning("Evaluating model in 4/8-bit mode may cause lower scores.") - - if training_args.do_train and (not training_args.fp16) and (not training_args.bf16): - logger.warning("We recommend enable mixed precision training.") - - # postprocess data_args - if data_args.max_samples is not None and data_args.streaming: - logger.warning( - "`max_samples` is incompatible with `streaming`. Disabling max_samples." - ) - data_args.max_samples = None - - # postprocess training_args - if ( - training_args.local_rank != -1 - and training_args.ddp_find_unused_parameters is None - and finetuning_args.finetuning_type == "lora" - ): - logger.warning( - "`ddp_find_unused_parameters` needs to be set as False for LoRA in DDP training." - ) - training_args_dict = training_args.to_dict() - training_args_dict.update(dict(ddp_find_unused_parameters=False)) - training_args = Seq2SeqTrainingArguments(**training_args_dict) - - if ( - training_args.resume_from_checkpoint is None - and training_args.do_train - and os.path.isdir(training_args.output_dir) - and not training_args.overwrite_output_dir - ): - last_checkpoint = get_last_checkpoint(training_args.output_dir) - if last_checkpoint is None and len(os.listdir(training_args.output_dir)) > 0: - raise ValueError( - "Output directory already exists and is not empty. Use `overwrite_output_dir`." - ) - - if last_checkpoint is not None: - training_args_dict = training_args.to_dict() - training_args_dict.update(dict(resume_from_checkpoint=last_checkpoint)) - training_args = Seq2SeqTrainingArguments(**training_args_dict) - logger.info( - "Resuming from checkpoint. Change `output_dir` or use `overwrite_output_dir` to avoid." - ) - - # postprocess model_args - if training_args.bf16: - if not torch.cuda.is_bf16_supported(): - raise ValueError("Current device does not support bf16 training.") - model_args.compute_dtype = torch.bfloat16 - else: - model_args.compute_dtype = torch.float16 - - model_args.model_max_length = ( - data_args.max_source_length + data_args.max_target_length - ) - - # Log on each process the small summary: - logger.info( - "Process rank: {}, device: {}, n_gpu: {}\n distributed training: {}, compute dtype: {}".format( - training_args.local_rank, - training_args.device, - training_args.n_gpu, - bool(training_args.local_rank != -1), - str(model_args.compute_dtype), - ) - ) - logger.info(f"Training/evaluation parameters {training_args}") - - # Set seed before initializing model. - transformers.set_seed(training_args.seed) - - return model_args, data_args, training_args, finetuning_args, generating_args - - -def get_infer_args( - args: Optional[Dict[str, Any]] = None -) -> Tuple[ModelArguments, DataArguments, FinetuningArguments, GeneratingArguments]: - model_args, data_args, finetuning_args, generating_args = parse_infer_args(args) - - if ( - model_args.quantization_bit is not None - and finetuning_args.finetuning_type != "lora" - ): - raise ValueError("Quantization is only compatible with the LoRA method.") - - if model_args.checkpoint_dir is not None: - if finetuning_args.finetuning_type != "lora": - if len(model_args.checkpoint_dir) != 1: - raise ValueError("Only LoRA tuning accepts multiple checkpoints.") - elif ( - model_args.quantization_bit is not None - and len(model_args.checkpoint_dir) != 1 - ): - raise ValueError("Quantized model only accepts a single checkpoint.") - - return model_args, data_args, finetuning_args, generating_args diff --git a/dbgpt_hub/train/src/llmtuner/tuner/core/trainer.py b/dbgpt_hub/train/src/llmtuner/tuner/core/trainer.py deleted file mode 100644 index d050a7d..0000000 --- a/dbgpt_hub/train/src/llmtuner/tuner/core/trainer.py +++ /dev/null @@ -1,135 +0,0 @@ -import os -import torch -from typing import TYPE_CHECKING, Dict, Optional - -from transformers import Seq2SeqTrainer -from transformers.trainer import TRAINING_ARGS_NAME, WEIGHTS_NAME -from transformers.modeling_utils import PreTrainedModel, unwrap_model -from peft import PeftModel -from trl import PreTrainedModelWrapper - -from llmtuner.extras.constants import FINETUNING_ARGS_NAME, VALUE_HEAD_FILE_NAME -from llmtuner.extras.logging import get_logger -from llmtuner.extras.save_and_load import get_state_dict, load_trainable_params - -if TYPE_CHECKING: - from transformers import PreTrainedTokenizer, Seq2SeqTrainingArguments, TrainerState - from llmtuner.hparams import FinetuningArguments - - -logger = get_logger(__name__) - - -class PeftModelMixin: - r""" - Patches the save and load methods in Hugging Face Trainer for PeftModel and ModelWithValueHead. - """ - - def __init__(self) -> None: # for type checking - self.model: PreTrainedModel = None - self.tokenizer: "PreTrainedTokenizer" = None - self.args: "Seq2SeqTrainingArguments" = None - self.finetuning_args: "FinetuningArguments" = None - self.state: "TrainerState" = None - raise AssertionError("Mixin should not be initialized.") - - def _save( - self, - output_dir: Optional[str] = None, - state_dict: Optional[Dict[str, torch.Tensor]] = None, - ) -> None: - r""" - Saves trainable parameters as model checkpoint. - - This function will only be executed at the process zero. - - Subclass and override to inject custom behavior. It should not be directly used by external scripts. - """ - output_dir = output_dir if output_dir is not None else self.args.output_dir - os.makedirs(output_dir, exist_ok=True) - logger.info(f"Saving model checkpoint to {output_dir}") - - model = unwrap_model(self.model) - if isinstance(model, PreTrainedModelWrapper): - # Custom state dict: https://github.com/lvwerra/trl/blob/v0.4.7/trl/models/modeling_value_head.py#L200 - model_state_dict = state_dict or model.state_dict() - v_head_state_dict = { - name.replace("v_head.", ""): model_state_dict[name] - .cpu() - .clone() - .detach() - for name in model_state_dict.keys() - if name.startswith("v_head.") - } - - torch.save( - v_head_state_dict, os.path.join(output_dir, VALUE_HEAD_FILE_NAME) - ) - model = model.pretrained_model - - state_dict = state_dict or get_state_dict(model) - if isinstance(model, (PeftModel, PreTrainedModel)): - model.config.use_cache = True - model.save_pretrained( - output_dir, - state_dict=state_dict, - safe_serialization=self.args.save_safetensors, - ) - model.config.use_cache = False - else: - torch.save(state_dict, os.path.join(output_dir, WEIGHTS_NAME)) - - if ( - self.finetuning_args.finetuning_type == "full" - and self.tokenizer is not None - ): - try: - self.tokenizer.save_pretrained(output_dir) - except: - logger.warning("Cannot save tokenizer, copy the files manually.") - - with open( - os.path.join(output_dir, TRAINING_ARGS_NAME), "w", encoding="utf-8" - ) as f: - f.write(self.args.to_json_string() + "\n") - - self.finetuning_args.save_to_json( - os.path.join(output_dir, FINETUNING_ARGS_NAME) - ) - - def _load_best_model(self): - r""" - Loads trainable parameters from model checkpoint. - - Subclass and override to inject custom behavior. It should not be directly used by external scripts. - """ - logger.info( - f"Loading best model from {self.state.best_model_checkpoint} (score: {self.state.best_metric})." - ) - model = unwrap_model(self.model) - - if isinstance(model, PreTrainedModelWrapper): - model.v_head.load_state_dict( - torch.load( - os.path.join( - self.state.best_model_checkpoint, VALUE_HEAD_FILE_NAME - ), - map_location="cpu", - ) - ) - model = model.pretrained_model - - if isinstance(model, PeftModel): - model.load_adapter(self.state.best_model_checkpoint, model.active_adapter) - else: # freeze/full-tuning - load_trainable_params(model, self.state.best_model_checkpoint) - - -class PeftTrainer(PeftModelMixin, Seq2SeqTrainer): - r""" - Inherits Seq2SeqTrainer to support parameter-efficient checkpoints. - """ - - def __init__(self, finetuning_args: "FinetuningArguments", **kwargs): - Seq2SeqTrainer.__init__(self, **kwargs) - self.finetuning_args = finetuning_args diff --git a/dbgpt_hub/train/src/llmtuner/tuner/sft/__init__.py b/dbgpt_hub/train/src/llmtuner/tuner/sft/__init__.py deleted file mode 100644 index 493dd1a..0000000 --- a/dbgpt_hub/train/src/llmtuner/tuner/sft/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from llmtuner.tuner.sft.workflow import run_sft diff --git a/dbgpt_hub/train/src/llmtuner/tuner/sft/metric.py b/dbgpt_hub/train/src/llmtuner/tuner/sft/metric.py deleted file mode 100644 index a9b39fc..0000000 --- a/dbgpt_hub/train/src/llmtuner/tuner/sft/metric.py +++ /dev/null @@ -1,66 +0,0 @@ -import numpy as np -from dataclasses import dataclass -from typing import TYPE_CHECKING, Dict, Sequence, Tuple, Union - -import jieba -from rouge_chinese import Rouge -from nltk.translate.bleu_score import sentence_bleu, SmoothingFunction - -from llmtuner.extras.constants import IGNORE_INDEX - -if TYPE_CHECKING: - from transformers.tokenization_utils import PreTrainedTokenizer - - -@dataclass -class ComputeMetrics: - r""" - Wraps the tokenizer into metric functions, used in Seq2SeqPeftTrainer. - """ - - tokenizer: "PreTrainedTokenizer" - - def __call__( - self, eval_preds: Sequence[Union[np.ndarray, Tuple[np.ndarray]]] - ) -> Dict[str, float]: - r""" - Uses the model predictions to compute metrics. - """ - preds, labels = eval_preds - score_dict = {"rouge-1": [], "rouge-2": [], "rouge-l": [], "bleu-4": []} - - preds = np.where(preds != IGNORE_INDEX, preds, self.tokenizer.pad_token_id) - labels = np.where(labels != IGNORE_INDEX, labels, self.tokenizer.pad_token_id) - - decoded_preds = self.tokenizer.batch_decode(preds, skip_special_tokens=True) - decoded_labels = self.tokenizer.batch_decode(labels, skip_special_tokens=True) - - for pred, label in zip(decoded_preds, decoded_labels): - hypothesis = list(jieba.cut(pred)) - reference = list(jieba.cut(label)) - - if ( - len(" ".join(hypothesis).split()) == 0 - or len(" ".join(reference).split()) == 0 - ): - result = { - "rouge-1": {"f": 0.0}, - "rouge-2": {"f": 0.0}, - "rouge-l": {"f": 0.0}, - } - else: - rouge = Rouge() - scores = rouge.get_scores(" ".join(hypothesis), " ".join(reference)) - result = scores[0] - - for k, v in result.items(): - score_dict[k].append(round(v["f"] * 100, 4)) - - bleu_score = sentence_bleu( - [list(label)], - list(pred), - smoothing_function=SmoothingFunction().method3, - ) - score_dict["bleu-4"].append(round(bleu_score * 100, 4)) - - return {k: float(np.mean(v)) for k, v in score_dict.items()} diff --git a/dbgpt_hub/train/src/llmtuner/tuner/sft/trainer.py b/dbgpt_hub/train/src/llmtuner/tuner/sft/trainer.py deleted file mode 100644 index 3810c21..0000000 --- a/dbgpt_hub/train/src/llmtuner/tuner/sft/trainer.py +++ /dev/null @@ -1,131 +0,0 @@ -import os -import json -import torch -import numpy as np -import torch.nn as nn -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union - -from llmtuner.extras.constants import IGNORE_INDEX -from llmtuner.extras.logging import get_logger -from llmtuner.tuner.core.trainer import PeftTrainer - -if TYPE_CHECKING: - from transformers.trainer import PredictionOutput - - -logger = get_logger(__name__) - - -class Seq2SeqPeftTrainer(PeftTrainer): - r""" - Inherits PeftTrainer to compute generative metrics such as BLEU and ROUGE. - """ - - def prediction_step( - self, - model: nn.Module, - inputs: Dict[str, Union[torch.Tensor, Any]], - prediction_loss_only: bool, - ignore_keys: Optional[List[str]] = None, - ) -> Tuple[Optional[float], Optional[torch.Tensor], Optional[torch.Tensor]]: - r""" - Removes the prompt part in the generated tokens. - - Subclass and override to inject custom behavior. - """ - prompt_len, label_len = inputs["input_ids"].size(-1), inputs["labels"].size(-1) - if prompt_len > label_len: - inputs["labels"] = self._pad_tensors_to_target_len( - inputs["labels"], inputs["input_ids"] - ) - if label_len > prompt_len: - inputs["input_ids"] = self._pad_tensors_to_target_len( - inputs["input_ids"], inputs["labels"] - ) - if "attention_mask" in inputs: - inputs["attention_mask"] = self._pad_tensors_to_target_len( - inputs["attention_mask"], inputs["labels"], pad_token_id=0 - ) - if "position_ids" in inputs: - inputs["position_ids"] = self._pad_tensors_to_target_len( - inputs["position_ids"], inputs["labels"], pad_token_id=0 - ) - - loss, generated_tokens, labels = super().prediction_step( - model, - inputs, - prediction_loss_only=prediction_loss_only, - ignore_keys=ignore_keys, - ) - if generated_tokens is not None: - generated_tokens[ - :, : max(prompt_len, label_len) - ] = self.tokenizer.pad_token_id * torch.ones_like( - generated_tokens[:, : max(prompt_len, label_len)] - ) - - return loss, generated_tokens, labels - - def _pad_tensors_to_target_len( - self, - src_tensor: torch.Tensor, - tgt_tensor: torch.Tensor, - pad_token_id: Optional[int] = None, - ) -> torch.Tensor: - r""" - Pads the tensor to the same length as the target tensor. - - Should only be called when predict_with_generate=True. - """ - if pad_token_id is None: - if self.tokenizer is not None and hasattr(self.tokenizer, "pad_token_id"): - assert ( - self.tokenizer.padding_side == "left" - ), "This method only accepts left-padded tensor." - pad_token_id = self.tokenizer.pad_token_id - else: - raise ValueError("PAD token is required.") - - padded_tensor = pad_token_id * torch.ones_like(tgt_tensor) - padded_tensor[:, -src_tensor.shape[-1] :] = src_tensor # adopt left-padding - return padded_tensor.contiguous() # in contiguous memory - - def save_predictions(self, predict_results: "PredictionOutput") -> None: - r""" - Saves model predictions to `output_dir`. - - A custom behavior that not contained in Seq2SeqTrainer. - """ - if not self.is_world_process_zero(): - return - - output_prediction_file = os.path.join( - self.args.output_dir, "generated_predictions.jsonl" - ) - logger.info(f"Saving prediction results to {output_prediction_file}") - - preds = np.where( - predict_results.predictions != IGNORE_INDEX, - predict_results.predictions, - self.tokenizer.pad_token_id, - ) - labels = np.where( - predict_results.label_ids != IGNORE_INDEX, - predict_results.label_ids, - self.tokenizer.pad_token_id, - ) - - decoded_preds = self.tokenizer.batch_decode( - preds, skip_special_tokens=True, clean_up_tokenization_spaces=True - ) - decoded_labels = self.tokenizer.batch_decode( - labels, skip_special_tokens=True, clean_up_tokenization_spaces=True - ) - - with open(output_prediction_file, "w", encoding="utf-8") as writer: - res: List[str] = [] - for pred, label in zip(decoded_preds, decoded_labels): - res.append( - json.dumps({"label": label, "predict": pred}, ensure_ascii=False) - ) - writer.write("\n".join(res)) diff --git a/dbgpt_hub/train/src/llmtuner/tuner/sft/workflow.py b/dbgpt_hub/train/src/llmtuner/tuner/sft/workflow.py deleted file mode 100644 index 8362a8d..0000000 --- a/dbgpt_hub/train/src/llmtuner/tuner/sft/workflow.py +++ /dev/null @@ -1,111 +0,0 @@ -# Inspired by: https://github.com/huggingface/transformers/blob/v4.29.2/examples/pytorch/summarization/run_summarization.py - -from typing import TYPE_CHECKING, Optional, List -from transformers import DataCollatorForSeq2Seq, Seq2SeqTrainingArguments - -from llmtuner.dsets import get_dataset, preprocess_dataset, split_dataset -from llmtuner.extras.constants import IGNORE_INDEX -from llmtuner.extras.misc import get_logits_processor -from llmtuner.extras.ploting import plot_loss -from llmtuner.tuner.core import load_model_and_tokenizer -from llmtuner.tuner.sft.metric import ComputeMetrics -from llmtuner.tuner.sft.trainer import Seq2SeqPeftTrainer - -if TYPE_CHECKING: - from transformers import TrainerCallback - from llmtuner.hparams import ( - ModelArguments, - DataArguments, - FinetuningArguments, - GeneratingArguments, - ) - - -def run_sft( - model_args: "ModelArguments", - data_args: "DataArguments", - training_args: "Seq2SeqTrainingArguments", - finetuning_args: "FinetuningArguments", - generating_args: "GeneratingArguments", - callbacks: Optional[List["TrainerCallback"]] = None, -): - dataset = get_dataset(model_args, data_args) - model, tokenizer = load_model_and_tokenizer( - model_args, finetuning_args, training_args.do_train - ) - dataset = preprocess_dataset(dataset, tokenizer, data_args, training_args) - data_collator = DataCollatorForSeq2Seq( - tokenizer=tokenizer, - label_pad_token_id=IGNORE_INDEX - if data_args.ignore_pad_token_for_loss - else tokenizer.pad_token_id, - ) - - # Override the decoding parameters of Seq2SeqTrainer - training_args_dict = training_args.to_dict() - training_args_dict.update( - dict( - generation_max_length=training_args.generation_max_length - or data_args.max_target_length, - generation_num_beams=data_args.eval_num_beams - or training_args.generation_num_beams, - ) - ) - training_args = Seq2SeqTrainingArguments(**training_args_dict) - - # Initialize our Trainer - trainer = Seq2SeqPeftTrainer( - finetuning_args=finetuning_args, - model=model, - args=training_args, - tokenizer=tokenizer, - data_collator=data_collator, - callbacks=callbacks, - compute_metrics=ComputeMetrics(tokenizer) - if training_args.predict_with_generate - else None, - **split_dataset(dataset, data_args, training_args) - ) - - # Keyword arguments for `model.generate` - gen_kwargs = generating_args.to_dict() - gen_kwargs["eos_token_id"] = list( - set([tokenizer.eos_token_id] + tokenizer.additional_special_tokens_ids) - ) - gen_kwargs["pad_token_id"] = tokenizer.pad_token_id - gen_kwargs["logits_processor"] = get_logits_processor() - - # Training - if training_args.do_train: - train_result = trainer.train( - resume_from_checkpoint=training_args.resume_from_checkpoint - ) - trainer.log_metrics("train", train_result.metrics) - trainer.save_metrics("train", train_result.metrics) - trainer.save_state() - trainer.save_model() - if trainer.is_world_process_zero() and model_args.plot_loss: - plot_loss(training_args.output_dir, keys=["loss", "eval_loss"]) - - # Evaluation - if training_args.do_eval: - metrics = trainer.evaluate(metric_key_prefix="eval", **gen_kwargs) - if ( - training_args.predict_with_generate - ): # eval_loss will be wrong if predict_with_generate is enabled - metrics.pop("eval_loss", None) - trainer.log_metrics("eval", metrics) - trainer.save_metrics("eval", metrics) - - # Predict - if training_args.do_predict: - predict_results = trainer.predict( - dataset, metric_key_prefix="predict", **gen_kwargs - ) - if ( - training_args.predict_with_generate - ): # predict_loss will be wrong if predict_with_generate is enabled - predict_results.metrics.pop("predict_loss", None) - trainer.log_metrics("predict", predict_results.metrics) - trainer.save_metrics("predict", predict_results.metrics) - trainer.save_predictions(predict_results) diff --git a/dbgpt_hub/train/src/llmtuner/tuner/tune.py b/dbgpt_hub/train/src/llmtuner/tuner/tune.py deleted file mode 100644 index 6743041..0000000 --- a/dbgpt_hub/train/src/llmtuner/tuner/tune.py +++ /dev/null @@ -1,52 +0,0 @@ -from typing import TYPE_CHECKING, Any, Dict, List, Optional - -from llmtuner.extras.callbacks import LogCallback -from llmtuner.extras.logging import get_logger -from llmtuner.tuner.core import get_train_args, load_model_and_tokenizer -from llmtuner.tuner.sft import run_sft - - -if TYPE_CHECKING: - from transformers import TrainerCallback - - -logger = get_logger(__name__) - - -def run_exp( - args: Optional[Dict[str, Any]] = None, - callbacks: Optional[List["TrainerCallback"]] = None, -): - ( - model_args, - data_args, - training_args, - finetuning_args, - generating_args, - ) = get_train_args(args) - callbacks = [LogCallback()] if callbacks is None else callbacks - - run_sft( - model_args, - data_args, - training_args, - finetuning_args, - generating_args, - callbacks, - ) - - -def export_model( - args: Optional[Dict[str, Any]] = None, max_shard_size: Optional[str] = "10GB" -): - model_args, _, training_args, finetuning_args, _ = get_train_args(args) - model, tokenizer = load_model_and_tokenizer(model_args, finetuning_args) - model.save_pretrained(training_args.output_dir, max_shard_size=max_shard_size) - try: - tokenizer.save_pretrained(training_args.output_dir) - except: - logger.warning("Cannot save tokenizer, please copy the files manually.") - - -if __name__ == "__main__": - run_exp() diff --git a/dbgpt_hub/train/src/train_bash.py b/dbgpt_hub/train/src/train_bash.py deleted file mode 100644 index 9ddd058..0000000 --- a/dbgpt_hub/train/src/train_bash.py +++ /dev/null @@ -1,14 +0,0 @@ -from llmtuner import run_exp - - -def main(): - run_exp() - - -def _mp_fn(index): - # For xla_spawn (TPUs) - main() - - -if __name__ == "__main__": - main() diff --git a/dbgpt_hub/train/tests/modeling_baichuan.py b/dbgpt_hub/train/tests/modeling_baichuan.py deleted file mode 100644 index f7bdf2b..0000000 --- a/dbgpt_hub/train/tests/modeling_baichuan.py +++ /dev/null @@ -1,855 +0,0 @@ -# Copyright (c) 2023, Baichuan Intelligent Technology. All rights reserved. - -import math -from typing import List, Optional, Tuple, Union - -import torch -import torch.utils.checkpoint -import torch.nn.functional as F -from torch import nn -from torch.nn import CrossEntropyLoss -from transformers import PreTrainedModel -from transformers.activations import ACT2FN -from transformers.modeling_outputs import ( - BaseModelOutputWithPast, - CausalLMOutputWithPast, -) -from transformers.utils import logging -from transformers.generation.utils import GenerationConfig - -from .configuration_baichuan import BaichuanConfig - - -logger = logging.get_logger(__name__) - - -# Copied from transformers.models.bloom.modeling_bloom._make_causal_mask -def _make_causal_mask( - input_ids_shape: torch.Size, device: torch.device, past_key_values_length: int -) -> torch.BoolTensor: - """ - Make causal mask used for self-attention. - """ - batch_size, target_length = input_ids_shape - mask = torch.empty( - (target_length, target_length + past_key_values_length), - dtype=torch.bool, - device=device, - ) - # ONNX doesn't support `torch.Tensor.triu` properly, thus we use this workaround - seq_ids = torch.arange(target_length, device=device) - mask[:, past_key_values_length:] = seq_ids[:, None] < seq_ids[None, :] - - if past_key_values_length > 0: - mask[:, :past_key_values_length] = False - - expanded_mask = mask[None, None, :, :].expand( - batch_size, 1, target_length, target_length + past_key_values_length - ) - return expanded_mask - - -# Copied from transformers.models.bloom.modeling_bloom._expand_mask -def _expand_mask(mask: torch.Tensor, tgt_length: int) -> torch.BoolTensor: - """ - Expands attention_mask from `[batch_size, src_length]` to `[batch_size, 1, tgt_length, src_length]`. - """ - batch_size, src_length = mask.shape - tgt_length = tgt_length if tgt_length is not None else src_length - - expanded_mask = ~(mask[:, None, None, :].to(torch.bool)) - return expanded_mask.expand(batch_size, 1, tgt_length, src_length) - - -# Copied from transformers.models.bloom.modeling_bloom.build_alibi_tensor -def build_alibi_tensor( - attention_mask: torch.Tensor, num_heads: int, dtype: torch.dtype -) -> torch.Tensor: - """ - Link to paper: https://arxiv.org/abs/2108.12409 Alibi tensor is not causal as the original paper mentions, it - relies on a translation invariance of softmax for quick implementation: with l being a tensor, and a fixed value - `softmax(l+a) = softmax(l)`. - - Args: - Returns tensor shaped (batch_size * num_heads, 1, max_seq_len) - attention_mask (`torch.Tensor`): - Token-wise attention mask, this should be of shape (batch_size, max_seq_len). - num_heads (`int`, *required*): - number of heads - dtype (`torch.dtype`, *optional*, default=`torch.bfloat16`): - dtype of the output tensor - """ - batch_size, seq_length = attention_mask.shape - closest_power_of_2 = 2 ** math.floor(math.log2(num_heads)) - base = torch.tensor( - 2 ** (-(2 ** -(math.log2(closest_power_of_2) - 3))), - device=attention_mask.device, - dtype=torch.float32, - ) - powers = torch.arange( - 1, 1 + closest_power_of_2, device=attention_mask.device, dtype=torch.int32 - ) - slopes = torch.pow(base, powers) - - if closest_power_of_2 != num_heads: - extra_base = torch.tensor( - 2 ** (-(2 ** -(math.log2(2 * closest_power_of_2) - 3))), - device=attention_mask.device, - dtype=torch.float32, - ) - num_remaining_heads = min(closest_power_of_2, num_heads - closest_power_of_2) - extra_powers = torch.arange( - 1, - 1 + 2 * num_remaining_heads, - 2, - device=attention_mask.device, - dtype=torch.int32, - ) - slopes = torch.cat([slopes, torch.pow(extra_base, extra_powers)], dim=0) - - # Note: alibi will added to the attention bias that will be applied to the query, key product of attention - # => therefore alibi will have to be of shape (batch_size, num_heads, query_length, key_length) - # => here we set (batch_size=1, num_heads=num_heads, query_length=1, key_length=max_length) - # => the query_length dimension will then be broadcasted correctly - arange_tensor = ((attention_mask.cumsum(dim=-1) - 1) * attention_mask)[:, None, :] - alibi = slopes[..., None] * arange_tensor - return alibi.reshape(batch_size * num_heads, 1, seq_length).to(dtype) - - -class RMSNorm(nn.Module): - def __init__(self, hidden_size, epsilon=1e-6): - super().__init__() - self.weight = nn.Parameter(torch.ones(hidden_size)) - self.epsilon = epsilon - - def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: - input_dtype = hidden_states.dtype - variance = hidden_states.to(torch.float32).pow(2).mean(-1, keepdim=True) - hidden_states = hidden_states * torch.rsqrt(variance + self.epsilon) - - return (self.weight * hidden_states).to(input_dtype) - - -class MLP(nn.Module): - def __init__( - self, - hidden_size: int, - intermediate_size: int, - hidden_act: str, - ): - super().__init__() - self.gate_proj = nn.Linear(hidden_size, intermediate_size, bias=False) - self.down_proj = nn.Linear(intermediate_size, hidden_size, bias=False) - self.up_proj = nn.Linear(hidden_size, intermediate_size, bias=False) - self.act_fn = ACT2FN[hidden_act] - - def forward(self, x): - return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x)) - - -class BaichuanAttention(nn.Module): - def __init__(self, config: BaichuanConfig): - super().__init__() - self.config = config - self.hidden_size = config.hidden_size - self.num_heads = config.num_attention_heads - self.head_dim = self.hidden_size // self.num_heads - self.max_position_embeddings = config.model_max_length - - if (self.head_dim * self.num_heads) != self.hidden_size: - raise ValueError( - f"hidden_size {self.hidden_size} is not divisible by num_heads {self.num_heads}" - ) - - # Layer-wise attention scaling - self.inv_norm_factor = 1.0 / math.sqrt(self.head_dim) - self.beta = 1.0 - - self.W_pack = nn.Linear(self.hidden_size, 3 * self.hidden_size, bias=False) - self.o_proj = nn.Linear( - self.num_heads * self.head_dim, self.hidden_size, bias=False - ) - - def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int): - return ( - tensor.view(bsz, seq_len, self.num_heads, self.head_dim) - .transpose(1, 2) - .contiguous() - ) - - def forward( - self, - hidden_states: torch.Tensor, - alibi: torch.Tensor, - attention_mask: torch.Tensor, - past_key_value: Optional[Tuple[torch.Tensor]] = None, - output_attentions: bool = False, - use_cache: bool = False, - ) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]: - bsz, q_len, _ = hidden_states.size() - - proj = self.W_pack(hidden_states) # [batch_size, seq_length, 3 x hidden_size] - proj = ( - proj.unflatten(-1, (3, self.hidden_size)) - .unsqueeze(0) - .transpose(0, -2) - .squeeze(-2) - ) - query_states = proj[0].view(bsz, q_len, self.num_heads, self.head_dim) - key_states = proj[1].view(bsz, q_len, self.num_heads, self.head_dim) - value_states = proj[2].view(bsz, q_len, self.num_heads, self.head_dim) - - query_states = query_states.transpose(1, 2).reshape( - bsz * self.num_heads, q_len, self.head_dim - ) - key_states = key_states.permute(0, 2, 3, 1).reshape( - bsz * self.num_heads, self.head_dim, q_len - ) - value_states = value_states.transpose(1, 2).reshape( - bsz * self.num_heads, q_len, self.head_dim - ) - - if past_key_value is not None: - # reuse k, v, self_attention - past_key, past_value = past_key_value - key_states = torch.cat([past_key, key_states], dim=2) - value_states = torch.cat([past_value, value_states], dim=1) - - _, _, kv_seq_len = key_states.shape - - past_key_value = (key_states, value_states) if use_cache else None - - # [batch_size * num_heads, q_length, kv_length] - # we use `torch.Tensor.baddbmm` instead of `torch.baddbmm` as the latter isn't supported by TorchScript v1.11 - matmul_result = alibi.baddbmm( - batch1=query_states, - batch2=key_states, - beta=self.beta, - alpha=self.inv_norm_factor, - ) - - # change view to [batch_size, num_heads, q_length, kv_length] - attention_scores = matmul_result.view(bsz, self.num_heads, q_len, kv_seq_len) - - # cast attention scores to fp32, compute scaled softmax and cast back to initial dtype - # [batch_size, num_heads, q_length, kv_length] - input_dtype = attention_scores.dtype - # `float16` has a minimum value of -65504.0, whereas `bfloat16` and `float32` have a minimum value of `-3.4e+38` - if input_dtype == torch.float16: - attention_scores = attention_scores.to(torch.float) - attn_weights = torch.masked_fill( - attention_scores, attention_mask, torch.finfo(attention_scores.dtype).min - ) - attention_probs = F.softmax(attn_weights, dim=-1, dtype=torch.float32).to( - input_dtype - ) - - # change view [batch_size x num_heads, q_length, kv_length] - attention_probs_reshaped = attention_probs.view( - bsz * self.num_heads, q_len, kv_seq_len - ) - - # matmul: [batch_size * num_heads, q_length, head_dim] - attn_output = torch.bmm(attention_probs_reshaped, value_states) - - attn_output = attn_output.view(bsz, self.num_heads, q_len, self.head_dim) - - attn_output = attn_output.transpose(1, 2).reshape(bsz, q_len, self.hidden_size) - attn_output = self.o_proj(attn_output) - - if not output_attentions: - attention_probs = None - - return attn_output, attention_probs, past_key_value - - -class BaichuanLayer(nn.Module): - def __init__(self, config: BaichuanConfig): - super().__init__() - self.hidden_size = config.hidden_size - self.self_attn = BaichuanAttention(config=config) - self.mlp = MLP( - hidden_size=self.hidden_size, - intermediate_size=config.intermediate_size, - hidden_act=config.hidden_act, - ) - self.input_layernorm = RMSNorm(config.hidden_size, epsilon=config.rms_norm_eps) - self.post_attention_layernorm = RMSNorm( - config.hidden_size, epsilon=config.rms_norm_eps - ) - - def forward( - self, - hidden_states: torch.Tensor, - alibi: torch.Tensor, - attention_mask: torch.Tensor, - past_key_value: Optional[Tuple[torch.Tensor]] = None, - output_attentions: Optional[bool] = False, - use_cache: Optional[bool] = False, - ) -> Tuple[ - torch.FloatTensor, Optional[Tuple[torch.FloatTensor, torch.FloatTensor]] - ]: - residual = hidden_states - - hidden_states = self.input_layernorm(hidden_states) - - # Self Attention - hidden_states, self_attn_weights, present_key_value = self.self_attn( - hidden_states=hidden_states, - alibi=alibi, - attention_mask=attention_mask, - past_key_value=past_key_value, - output_attentions=output_attentions, - use_cache=use_cache, - ) - hidden_states = residual + hidden_states - - # Fully Connected - residual = hidden_states - hidden_states = self.post_attention_layernorm(hidden_states) - hidden_states = self.mlp(hidden_states) - hidden_states = residual + hidden_states - - outputs = (hidden_states,) - - if output_attentions: - outputs += (self_attn_weights,) - - if use_cache: - outputs += (present_key_value,) - - return outputs - - -class BaichuanPreTrainedModel(PreTrainedModel): - config_class = BaichuanConfig - base_model_prefix = "model" - supports_gradient_checkpointing = True - _no_split_modules = ["BaichuanLayer"] - _skip_keys_device_placement = "past_key_values" - _keys_to_ignore_on_load_unexpected = [r"decoder\.version"] - - def _init_weights(self, module): - std = self.config.initializer_range - if isinstance(module, nn.Linear): - module.weight.data.normal_(mean=0.0, std=std) - if module.bias is not None: - module.bias.data.zero_() - elif isinstance(module, nn.Embedding): - module.weight.data.normal_(mean=0.0, std=std) - if module.padding_idx is not None: - module.weight.data[module.padding_idx].zero_() - - def _set_gradient_checkpointing(self, module, value=False): - if isinstance(module, BaichuanModel): - module.gradient_checkpointing = value - - @staticmethod - def _convert_to_standard_cache( - past_key_value: Tuple[Tuple[torch.Tensor, torch.Tensor]], batch_size: int - ) -> Tuple[Tuple[torch.Tensor, torch.Tensor]]: - """ - Standardizes the format of the cache so as to match most implementations, i.e. to tuple(tuple([batch_size, - num_heads, ...])) - """ - batch_size_times_num_heads, head_dim, seq_length = past_key_value[0][0].shape - num_heads = batch_size_times_num_heads // batch_size - # key: [batch_size * num_heads, head_dim, seq_length] -> [batch_size, num_heads, head_dim, seq_length] - # value: [batch_size * num_heads, seq_length, head_dim] -> [batch_size, num_heads, seq_length, head_dim] - return tuple( - ( - layer_past[0].view(batch_size, num_heads, head_dim, seq_length), - layer_past[1].view(batch_size, num_heads, seq_length, head_dim), - ) - for layer_past in past_key_value - ) - - @staticmethod - def _convert_to_baichuan_cache( - past_key_value: Tuple[Tuple[torch.Tensor, torch.Tensor]] - ) -> Tuple[Tuple[torch.Tensor, torch.Tensor]]: - """ - Converts the cache to the format expected by Baichuan, i.e. to tuple(tuple([batch_size * num_heads, ...])) - """ - batch_size, num_heads, head_dim, seq_length = past_key_value[0][0].shape - batch_size_times_num_heads = batch_size * num_heads - # key: [batch_size, num_heads, head_dim, seq_length] -> [batch_size * num_heads, head_dim, seq_length] - # value: [batch_size, num_heads, seq_length, head_dim] -> [batch_size * num_heads, seq_length, head_dim] - return tuple( - ( - layer_past[0].view(batch_size_times_num_heads, head_dim, seq_length), - layer_past[1].view(batch_size_times_num_heads, seq_length, head_dim), - ) - for layer_past in past_key_value - ) - - -class BaichuanModel(BaichuanPreTrainedModel): - def __init__(self, config: BaichuanConfig): - super().__init__(config) - self.padding_idx = config.pad_token_id - self.vocab_size = config.vocab_size - self.n_head = config.num_attention_heads - - self.embed_tokens = nn.Embedding( - config.vocab_size, config.hidden_size, self.padding_idx - ) - self.layers = nn.ModuleList( - [BaichuanLayer(config) for _ in range(config.num_hidden_layers)] - ) - self.norm = RMSNorm(config.hidden_size, epsilon=config.rms_norm_eps) - - self.gradient_checkpointing = config.gradient_checkpointing - self.post_init() - - def get_input_embeddings(self): - return self.embed_tokens - - def set_input_embeddings(self, value): - self.embed_tokens = value - - def build_alibi_tensor( - self, attention_mask: torch.Tensor, num_heads: int, dtype: torch.dtype - ) -> torch.Tensor: - return build_alibi_tensor(attention_mask, num_heads, dtype) - - def _prepare_attn_mask( - self, - attention_mask: torch.Tensor, - input_shape: Tuple[int, int], - past_key_values_length: int, - ) -> torch.BoolTensor: - # create causal mask - # [batch_size, seq_length] -> [batch_size, 1, tgt_length, src_length] - combined_attention_mask = None - device = attention_mask.device - _, src_length = input_shape - - if src_length > 1: - combined_attention_mask = _make_causal_mask( - input_shape, - device=device, - past_key_values_length=past_key_values_length, - ) - - # [batch_size, seq_length] -> [batch_size, 1, tgt_length, src_length] - expanded_attn_mask = _expand_mask(attention_mask, tgt_length=src_length) - combined_attention_mask = ( - expanded_attn_mask - if combined_attention_mask is None - else expanded_attn_mask | combined_attention_mask - ) - - return combined_attention_mask - - def forward( - self, - input_ids: torch.LongTensor = None, - attention_mask: Optional[torch.Tensor] = None, - past_key_values: Optional[List[torch.FloatTensor]] = None, - inputs_embeds: Optional[torch.FloatTensor] = None, - use_cache: Optional[bool] = None, - output_attentions: Optional[bool] = None, - output_hidden_states: Optional[bool] = None, - return_dict: Optional[bool] = None, - ) -> Union[Tuple, BaseModelOutputWithPast]: - output_attentions = ( - output_attentions - if output_attentions is not None - else self.config.output_attentions - ) - output_hidden_states = ( - output_hidden_states - if output_hidden_states is not None - else self.config.output_hidden_states - ) - use_cache = use_cache if use_cache is not None else self.config.use_cache - return_dict = ( - return_dict if return_dict is not None else self.config.use_return_dict - ) - - if input_ids is not None and inputs_embeds is not None: - raise ValueError( - "You cannot provide both input_ids and inputs_embeds simultaneously" - ) - elif input_ids is not None: - batch_size, seq_length = input_ids.shape - elif inputs_embeds is not None: - batch_size, seq_length, _ = inputs_embeds.shape - else: - raise ValueError("You need to provide input_ids or inputs_embeds") - - seq_length_with_past = seq_length - past_key_values_length = 0 - if past_key_values is not None: - past_key_values_length = past_key_values[0][0].shape[1] - seq_length_with_past = seq_length_with_past + past_key_values_length - - if inputs_embeds is None: - inputs_embeds = self.embed_tokens(input_ids) - - hidden_states = inputs_embeds - - if attention_mask is None: - attention_mask = torch.ones( - (batch_size, seq_length_with_past), device=hidden_states.device - ) - else: - attention_mask = attention_mask.to(hidden_states.device) - - if self.gradient_checkpointing and self.training: - if use_cache: - logger.warning_once( - "`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`..." - ) - use_cache = False - - # Compute alibi tensor: check build_alibi_tensor documentation - alibi = self.build_alibi_tensor( - attention_mask, self.n_head, dtype=hidden_states.dtype - ) - - causal_mask = self._prepare_attn_mask( - attention_mask, - input_shape=(batch_size, seq_length), - past_key_values_length=past_key_values_length, - ) - - # decoder layers - all_hidden_states = () if output_hidden_states else None - all_self_attns = () if output_attentions else None - next_decoder_cache = () if use_cache else None - - for idx, decoder_layer in enumerate(self.layers): - if output_hidden_states: - all_hidden_states += (hidden_states,) - - past_key_value = ( - past_key_values[idx] if past_key_values is not None else None - ) - - if self.gradient_checkpointing and self.training: - - def create_custom_forward(module): - def custom_forward(*inputs): - # None for past_key_value - return module(*inputs, output_attentions, None) - - return custom_forward - - layer_outputs = torch.utils.checkpoint.checkpoint( - create_custom_forward(decoder_layer), - hidden_states, - alibi, - causal_mask, - None, - ) - else: - layer_outputs = decoder_layer( - hidden_states, - alibi=alibi, - attention_mask=causal_mask, - past_key_value=past_key_value, - output_attentions=output_attentions, - use_cache=use_cache, - ) - - hidden_states = layer_outputs[0] - - if use_cache: - next_decoder_cache += (layer_outputs[2 if output_attentions else 1],) - - if output_attentions: - all_self_attns += (layer_outputs[1],) - - hidden_states = self.norm(hidden_states) - - # add hidden states from the last decoder layer - if output_hidden_states: - all_hidden_states += (hidden_states,) - - next_cache = next_decoder_cache if use_cache else None - - if not return_dict: - return tuple( - v - for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] - if v is not None - ) - - return BaseModelOutputWithPast( - last_hidden_state=hidden_states, - past_key_values=next_cache, - hidden_states=all_hidden_states, - attentions=all_self_attns, - ) - - -class BaichuanForCausalLM(BaichuanPreTrainedModel): - def __init__(self, config): - super().__init__(config) - self.model = BaichuanModel(config) - - self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False) - - # Initialize weights and apply final processing - self.post_init() - - def get_input_embeddings(self): - return self.model.embed_tokens - - def set_input_embeddings(self, value): - self.model.embed_tokens = value - - def get_output_embeddings(self): - return self.lm_head - - def set_output_embeddings(self, new_embeddings): - self.lm_head = new_embeddings - - def set_decoder(self, decoder): - self.model = decoder - - def get_decoder(self): - return self.model - - def forward( - self, - input_ids: torch.LongTensor = None, - attention_mask: Optional[torch.Tensor] = None, - past_key_values: Optional[List[torch.FloatTensor]] = None, - inputs_embeds: Optional[torch.FloatTensor] = None, - labels: Optional[torch.LongTensor] = None, - use_cache: Optional[bool] = None, - output_attentions: Optional[bool] = None, - output_hidden_states: Optional[bool] = None, - return_dict: Optional[bool] = None, - **kwargs, - ) -> Union[Tuple, CausalLMOutputWithPast]: - output_attentions = ( - output_attentions - if output_attentions is not None - else self.config.output_attentions - ) - output_hidden_states = ( - output_hidden_states - if output_hidden_states is not None - else self.config.output_hidden_states - ) - return_dict = ( - return_dict if return_dict is not None else self.config.use_return_dict - ) - - # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn) - outputs = self.model( - input_ids=input_ids, - attention_mask=attention_mask, - past_key_values=past_key_values, - inputs_embeds=inputs_embeds, - use_cache=use_cache, - output_attentions=output_attentions, - output_hidden_states=output_hidden_states, - return_dict=return_dict, - ) - - hidden_states = outputs[0] - logits = self.lm_head(hidden_states) - - loss = None - if labels is not None: - # Shift so that tokens < n predict n - shift_logits = logits[..., :-1, :].contiguous() - shift_labels = labels[..., 1:].contiguous() - # Flatten the tokens - loss_fct = CrossEntropyLoss() - shift_logits = shift_logits.view(-1, self.config.vocab_size) - shift_labels = shift_labels.view(-1) - # Enable model parallelism - shift_labels = shift_labels.to(shift_logits.device) - loss = loss_fct(shift_logits, shift_labels) - - if not return_dict: - output = (logits,) + outputs[1:] - return (loss,) + output if loss is not None else output - - return CausalLMOutputWithPast( - loss=loss, - logits=logits, - past_key_values=outputs.past_key_values, - hidden_states=outputs.hidden_states, - attentions=outputs.attentions, - ) - - def prepare_inputs_for_generation( - self, - input_ids: torch.LongTensor, - past_key_values: Optional[torch.Tensor] = None, - attention_mask: Optional[torch.Tensor] = None, - inputs_embeds: Optional[torch.Tensor] = None, - **kwargs, - ) -> dict: - if past_key_values: - input_ids = input_ids[:, -1:] - - # the cache may be in the standard format (e.g. in contrastive search) - if past_key_values[0][0].shape[0] == input_ids.shape[0]: - past_key_values = self._convert_to_baichuan_cache(past_key_values) - - # if `inputs_embeds` are passed, we only want to use them in the 1st generation step - if inputs_embeds is not None and past_key_values is None: - model_inputs = {"inputs_embeds": inputs_embeds} - else: - model_inputs = {"input_ids": input_ids} - - model_inputs.update( - { - "past_key_values": past_key_values, - "use_cache": kwargs.get("use_cache"), - "attention_mask": attention_mask, - } - ) - return model_inputs - - def _reorder_cache( - self, - past: Tuple[Tuple[torch.Tensor, torch.Tensor], ...], - beam_idx: torch.LongTensor, - ) -> Tuple[Tuple[torch.Tensor, torch.Tensor], ...]: - """ - This function is used to re-order the `past_key_values` cache if [`~PreTrainedModel.beam_search`] or - [`~PreTrainedModel.beam_sample`] is called. This is required to match `past_key_values` with the correct - beam_idx at every generation step. - - Output shares the same memory storage as `past`. - """ - standardized_past = self._convert_to_standard_cache( - past, batch_size=len(beam_idx) - ) - - # Get a copy of `beam_idx` on all the devices where we need those indices. - device_to_beam_idx = { - past_state.device: beam_idx.to(past_state.device) - for layer_past in past - for past_state in layer_past - } - reordered_past = tuple( - ( - layer_past[0].index_select(0, device_to_beam_idx[layer_past[0].device]), - layer_past[1].index_select(0, device_to_beam_idx[layer_past[0].device]), - ) - for layer_past in standardized_past - ) - return self._convert_to_baichuan_cache(reordered_past) - - def quantize(self, bits: int): - try: - from .quantizer import QLinear - except ImportError: - raise ImportError(f"Needs QLinear to run quantize.") - - for layer in self.model.layers: - layer.self_attn.W_pack = QLinear( - bits=bits, - weight=layer.self_attn.W_pack.weight, - bias=None, - ) - layer.self_attn.o_proj = QLinear( - bits=bits, - weight=layer.self_attn.o_proj.weight, - bias=None, - ) - layer.mlp.gate_proj = QLinear( - bits=bits, - weight=layer.mlp.gate_proj.weight, - bias=None, - ) - layer.mlp.down_proj = QLinear( - bits=bits, - weight=layer.mlp.down_proj.weight, - bias=None, - ) - layer.mlp.up_proj = QLinear( - bits=bits, - weight=layer.mlp.up_proj.weight, - bias=None, - ) - return self - - def _build_chat_input( - self, tokenizer, messages: List[dict], max_new_tokens: int = 0 - ): - max_new_tokens = max_new_tokens or self.generation_config.max_new_tokens - max_input_tokens = self.config.model_max_length - max_new_tokens - max_input_tokens = max(self.config.model_max_length // 2, max_input_tokens) - total_input, round_input = [], [] - for i, message in enumerate(messages[::-1]): - content_tokens = tokenizer.encode(message["content"]) - if message["role"] == "user": - round_input = ( - [self.generation_config.user_token_id] - + content_tokens - + round_input - ) - if ( - total_input - and len(total_input) + len(round_input) > max_input_tokens - ): - break - else: - total_input = round_input + total_input - if len(total_input) >= max_input_tokens: - break - else: - round_input = [] - elif message["role"] == "assistant": - round_input = ( - [self.generation_config.assistant_token_id] - + content_tokens - + [self.generation_config.eos_token_id] - + round_input - ) - else: - raise ValueError(f"message role not supported yet: {message['role']}") - total_input = total_input[-max_input_tokens:] # truncate left - total_input.append(self.generation_config.assistant_token_id) - total_input = torch.LongTensor([total_input]).to(self.device) - return total_input - - @torch.no_grad() - def chat( - self, - tokenizer, - messages: List[dict], - stream=False, - generation_config: Optional[GenerationConfig] = None, - ): - generation_config = generation_config or self.generation_config - input_ids = self._build_chat_input( - tokenizer, messages, generation_config.max_new_tokens - ) - if stream: - from transformers_stream_generator.main import ( - NewGenerationMixin, - StreamGenerationConfig, - ) - - self.__class__.generate = NewGenerationMixin.generate - self.__class__.sample_stream = NewGenerationMixin.sample_stream - stream_config = StreamGenerationConfig( - **generation_config.to_dict(), do_stream=True - ) - - def stream_generator(): - outputs = [] - for token in self.generate(input_ids, generation_config=stream_config): - outputs.append(token.item()) - yield tokenizer.decode(outputs, skip_special_tokens=True) - - return stream_generator() - else: - self.__class__.generate = PreTrainedModel.generate # disable stream - outputs = self.generate(input_ids, generation_config=generation_config) - response = tokenizer.decode( - outputs[0][len(input_ids[0]) :], skip_special_tokens=True - ) - return response diff --git a/dbgpt_hub/train/tests/quantize.py b/dbgpt_hub/train/tests/quantize.py deleted file mode 100644 index 1dac62d..0000000 --- a/dbgpt_hub/train/tests/quantize.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# Quantizes fine-tuned models with AutoGPTQ (https://github.com/PanQiWei/AutoGPTQ). -# Usage: python quantize.py --input_dir path_to_llama_model --output_dir path_to_quant_model --data_file alpaca.json -# --max_length 1024 --max_samples 1024 -# dataset format: instruction (string), input (string), output (string), history (List[string]) - - -import fire -from datasets import load_dataset -from transformers import AutoTokenizer -from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig - - -def quantize( - input_dir: str, output_dir: str, data_file: str, max_length: int, max_samples: int -): - tokenizer = AutoTokenizer.from_pretrained( - input_dir, use_fast=False, padding_side="left" - ) - - def format_example(examples): - prefix = ( - "A chat between a curious user and an artificial intelligence assistant. " - "The assistant gives helpful, detailed, and polite answers to the user's questions." - ) - texts = [] - for i in range(len(examples["instruction"])): - prompt = prefix + "\n" - if "history" in examples: - for user_query, bot_resp in examples["history"][i]: - prompt += "Human: {}\nAssistant: {}\n".format(user_query, bot_resp) - prompt += "Human: {}\nAssistant: {}".format( - examples["instruction"][i] + "\n" + examples["input"][i], - examples["output"][i], - ) - texts.append(prompt) - return tokenizer(texts, truncation=True, max_length=max_length) - - dataset = load_dataset("json", data_files=data_file)["train"] - column_names = list(dataset.column_names) - dataset = dataset.select(range(min(len(dataset), max_samples))) - dataset = dataset.map(format_example, batched=True, remove_columns=column_names) - dataset = dataset.shuffle() - - quantize_config = BaseQuantizeConfig(bits=4, group_size=128, desc_act=False) - - model = AutoGPTQForCausalLM.from_pretrained( - input_dir, quantize_config, trust_remote_code=True - ) - model.quantize(dataset) - model.save_quantized(output_dir) - - -if __name__ == "__main__": - fire.Fire(quantize) diff --git a/dbgpt_hub/train/tests/template_encode.py b/dbgpt_hub/train/tests/template_encode.py deleted file mode 100644 index bb38d25..0000000 --- a/dbgpt_hub/train/tests/template_encode.py +++ /dev/null @@ -1,37 +0,0 @@ -# Test Template Encode -# Usage: python .\tests\template_encode.py --model_name_and_path D:\llm\chinese-alpaca-2-7b -# --template llama2_zh --query 'how are you?' -# --history '[[\"Hello!\",\"Hi,I am llama2.\"]]' - -import sys -import fire -from typing import List, Optional, Tuple -from transformers import AutoTokenizer - -sys.path.append("./src") -from llmtuner.extras.template import get_template_and_fix_tokenizer - - -def encode( - model_name_and_path: str, - template: str, - query: str, - resp: Optional[str] = "", - history: Optional[List[Tuple[str, str]]] = None, - system: Optional[str] = None, -): - tokenizer = AutoTokenizer.from_pretrained( - model_name_and_path, trust_remote_code=True - ) - - template = get_template_and_fix_tokenizer(template, tokenizer) - - encoded_pairs = template.encode_multiturn(tokenizer, query, resp, history, system) - for prompt_ids, answer_ids in encoded_pairs: - print("=" * 50) - print("prompt_ids: {}, answer_ids: {}".format(prompt_ids, answer_ids)) - print("prompt decode: {}".format(tokenizer.decode(prompt_ids))) - - -if __name__ == "__main__": - fire.Fire(encode) diff --git a/dbgpt_hub/train/train_lora.py b/dbgpt_hub/train/train_lora.py deleted file mode 100644 index 92c675e..0000000 --- a/dbgpt_hub/train/train_lora.py +++ /dev/null @@ -1,312 +0,0 @@ -# ### TODO 此处文件待作废。 -# import os -# import torch -# import argparse -# import logging -# import pathlib -# from dataclasses import dataclass, field -# from typing import Dict, List, Tuple, Union -# from deepspeed import zero -# from deepspeed.runtime.zero.partition_parameters import ZeroParamStatus -# from peft import LoraConfig, get_peft_model, prepare_model_for_kbit_training -# from transformers import ( -# AutoModelForCausalLM, -# AutoTokenizer, -# BitsAndBytesConfig, -# HfArgumentParser, -# PreTrainedModel, -# PreTrainedTokenizer, -# Seq2SeqTrainer, -# deepspeed, -# ) - -# # TODO 待解决引用问题,白色的。0919 -# from dbgpt_hub.configs import DataArguments, ModelArguments, TrainingArguments -# from dbgpt_hub.data_process import make_supervised_data_module -# from dbgpt_hub.utils.model_utils import add_special_tokens_if_missing - - -# @dataclass -# class LoraArguments: -# lora_r: int = 32 -# lora_alpha: int = 16 -# lora_dropout: float = 0.05 -# lora_target_modules: List[str] = field( -# default_factory=lambda: [ -# "q_proj", -# "v_proj", -# "k_proj", -# "down_proj", -# "gate_proj", -# "up_proj", -# ] -# ) -# lora_weight_path: str = "" -# lora_bias: str = "none" -# q_lora: bool = False - - -# def maybe_zero_3(param: Union[torch.Tensor, object]) -> torch.Tensor: -# """ -# Applies zero.GatheredParameters to gather the parameter if it has ds_id attribute, -# and clones and detaches the tensor data if ds_status is ZeroParamStatus.NOT_AVAILABLE. - -# Args: -# param: The parameter to be processed. - -# Returns: -# The modified parameter. - -# Raises: -# AssertionError: If `param` has ds_id attribute but ds_status is not ZeroParamStatus.NOT_AVAILABLE. -# """ -# if hasattr(param, "ds_id"): -# assert param.ds_status == ZeroParamStatus.NOT_AVAILABLE, "Invalid ds_status" - -# with zero.GatheredParameters([param]): -# param = param.data.detach().cpu().clone() -# else: -# param = param.detach().cpu().clone() -# return param - - -# # Borrowed from peft.utils.get_peft_model_state_dict -# def get_peft_state_maybe_zero_3( -# named_params: List[Tuple[str, torch.Tensor]], bias: str -# ) -> Dict[str, torch.Tensor]: -# """ -# Filters and processes named parameters based on the specified bias. - -# Args: -# named_params: An iterable containing tuples of parameter names and their corresponding values. -# bias: The bias type. - -# Returns: -# A dictionary containing the filtered and possibly modified named parameters. - -# Raises: -# NotImplementedError: If an unsupported bias type is provided. -# """ -# to_return: Dict[str, torch.Tensor] = {} - -# if bias == "none": -# to_return = {k: t for k, t in named_params if "lora_" in k} -# elif bias == "all": -# to_return = {k: t for k, t in named_params if "lora_" in k or "bias" in k} -# elif bias == "lora_only": -# maybe_lora_bias: Dict[str, torch.Tensor] = {} -# lora_bias_names: set() = set() - -# for k, t in named_params: -# if "lora_" in k: -# to_return[k] = t -# bias_name = k.split("lora_")[0] + "bias" -# lora_bias_names.add(bias_name) -# elif "bias" in k: -# maybe_lora_bias[k] = t - -# for k, t in maybe_lora_bias.items(): -# bias_name = k.split("bias")[0] + "bias" -# if bias_name in lora_bias_names: -# to_return[bias_name] = t -# else: -# raise NotImplementedError("Unsupported bias type") - -# to_return = {k: maybe_zero_3(v) for k, v in to_return.items()} - -# return to_return - - -# def load_model_tokenizer( -# args: argparse.Namespace, -# ) -> Tuple[PreTrainedModel, PreTrainedTokenizer]: -# """ -# Load a pre-trained model and tokenizer for natural language processing tasks. - -# Args: -# args: An object containing the input arguments. - -# Returns: -# A tuple containing the loaded model and tokenizer. -# """ - -# # Determine torch dtype for model based on arguments -# if args.fp16: -# compute_dtype = torch.float16 -# elif args.bf16: -# compute_dtype = torch.bfloat16 -# else: -# compute_dtype = torch.float32 - -# device_map: Union[str, None] = "auto" -# if args.q_lora: -# world_size = int(os.environ.get("WORLD_SIZE", 1)) -# device_map = ( -# {"": int(os.environ.get("LOCAL_RANK") or 0)} if world_size != 1 else None -# ) -# if len(args.fsdp) > 0 or deepspeed.is_deepspeed_zero3_enabled(): -# logging.warning( -# "FSDP and ZeRO3 are both currently incompatible with QLoRA." -# ) - -# # Set configuration kwargs for tokenizer. -# config_kwargs = { -# "cache_dir": args.cache_dir, -# "use_auth_token": args.use_auth_token, -# "trust_remote_code": args.trust_remote_code, -# } - -# # support multi gpu -# if torch.cuda.is_available(): -# n_gpus = torch.cuda.device_count() -# device_map = "auto" -# # if we are in a distributed setting, we need to set the device map and max memory per device -# if os.environ.get("LOCAL_RANK") is not None: -# local_rank = int(os.environ.get("LOCAL_RANK", "0")) -# device_map = {"": local_rank} - -# # Load the pre-trained model -# print(f"Loading Model from {args.model_name_or_path}...") -# model = AutoModelForCausalLM.from_pretrained( -# args.model_name_or_path, -# device_map=device_map, -# quantization_config=BitsAndBytesConfig( -# load_in_4bit=True, -# llm_int8_threshold=6.0, -# llm_int8_has_fp16_weight=False, -# bnb_4bit_use_double_quant=True, -# bnb_4bit_quant_type="nf4", -# bnb_4bit_compute_dtype=compute_dtype, -# ) -# if args.q_lora -# else None, -# torch_dtype=compute_dtype, -# **config_kwargs, -# ) - -# # Add LoRA sparsity if specified -# logging.warning("Adding LoRA modules...") -# lora_config = LoraConfig( -# r=args.lora_r, -# lora_alpha=args.lora_alpha, -# target_modules=args.lora_target_modules, -# lora_dropout=args.lora_dropout, -# bias=args.lora_bias, -# task_type="CAUSAL_LM", -# ) -# if args.q_lora: -# logging.warning("Preparemodel for kbit training!!!") -# model = prepare_model_for_kbit_training( -# model, use_gradient_checkpointing=args.gradient_checkpointing -# ) -# if torch.cuda.device_count() > 1: -# # Keeps Trainer from trying its own DataParallelism when more than 1 GPU is available -# setattr(model, "model_parallel", True) -# setattr(model, "is_parallelizable", True) - -# logging.warning("Get the get peft model...") -# model = get_peft_model(model, lora_config) -# if args.deepspeed is not None and args.local_rank == 0: -# model.print_trainable_parameters() - -# if args.gradient_checkpointing: -# logging.warning("Using gradient checkpointing...") -# model.enable_input_require_grads() -# model.config.use_cache = ( -# False # Turn off when gradient checkpointing is enabled -# ) - -# # Load the tokenizer -# print(f"Loading tokenizer from {args.model_name_or_path}...") -# tokenizer = AutoTokenizer.from_pretrained( -# args.model_name_or_path, -# padding_side="right", -# use_fast=False, -# model_max_length=args.model_max_length, -# tokenizer_type="llama" if "llama" in args.model_name_or_path else None, -# **config_kwargs, -# ) - -# return model, tokenizer - - -# def train() -> None: -# """Trains a language model using Hugging Face's Transformers library. - -# Returns: -# None -# """ -# parser = HfArgumentParser( -# (ModelArguments, DataArguments, TrainingArguments, LoraArguments) -# ) -# ( -# model_args, -# data_args, -# training_args, -# lora_args, -# ) = parser.parse_args_into_dataclasses() -# data_args.init_for_training() -# args = argparse.Namespace( -# **vars(model_args), **vars(data_args), **vars(training_args), **vars(lora_args) -# ) -# # Log on each process the small summary: -# logging.warning( -# f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}" -# ) -# logging.warning( -# f"distributed training: {bool(training_args.local_rank != -1)}, 16-bits training: {training_args.fp16}" -# ) -# logging.warning(f"Training parameters {training_args}") - -# # load model and tokenizer -# model, tokenizer = load_model_tokenizer(args=args) -# logging.warning("Successfully loaded model and tokenizer.") - -# if "llama" in args.model_name_or_path or "baichuan" in args.model_name_or_path: -# logging.warning(f"Adding special tokens for {args.model_name_or_path}.") -# add_special_tokens_if_missing(tokenizer, model) - -# # Create a supervised dataset and Trainer, then train the model -# logging.warning("Creating a supervised dataset and DataCollator...") -# args.instruction_template = "spider" -# data_module = make_supervised_data_module(tokenizer=tokenizer, args=args) - -# # Create a Trainer object and start training -# logging.warning("Creating a Trainer...") -# trainer = Seq2SeqTrainer( -# model=model, tokenizer=tokenizer, args=training_args, **data_module -# ) - -# logging.warning("Starting training...") -# if training_args.resume_from_checkpoint and list( -# pathlib.Path(training_args.output_dir).glob("checkpoint-*") -# ): -# logging.warning("Resuming from checkpoint...") -# trainer.train(resume_from_checkpoint=True) -# else: -# trainer.train() - -# trainer.save_state() -# # Save the trained model -# # check if zero3 mode enabled -# if deepspeed.is_deepspeed_zero3_enabled(): -# # use deepspeed engine internal function to gather state dict -# # state_dict_zero3 contains whole parameters of base and lora adapters -# # we will not extract lora parameters since peft save_pretrained will do that -# # https://github.com/huggingface/peft/blob/3714aa2fff158fdfa637b2b65952580801d890b2/src/peft/peft_model.py#L125 -# # https://github.com/huggingface/peft/blob/3714aa2fff158fdfa637b2b65952580801d890b2/src/peft/utils/save_and_load.py#L19 -# state_dict_zero3 = trainer.model_wrapped._zero3_consolidated_16bit_state_dict() -# if training_args.local_rank == 0: -# state_dict = state_dict_zero3 -# else: -# # in other mode we use original code from fastchat team, to make sure our change is minimum -# state_dict = get_peft_state_maybe_zero_3( -# model.named_parameters(), lora_args.lora_bias -# ) - -# if training_args.local_rank == 0: -# model.save_pretrained(training_args.output_dir, state_dict=state_dict) - - -# if __name__ == "__main__": -# train() diff --git a/dbgpt_hub/train/train_qlora.py b/dbgpt_hub/train/train_qlora.py deleted file mode 100644 index b1d05fd..0000000 --- a/dbgpt_hub/train/train_qlora.py +++ /dev/null @@ -1,161 +0,0 @@ -# import argparse -# import os -# import sys -# import time -# import logging -# import torch -# import json -# import numpy as np -# import transformers -# from transformers import set_seed, Seq2SeqTrainer, GenerationConfig - -# from dbgpt_hub.configs import ( -# DataArguments, -# GenerationArguments, -# LoraArguments, -# ModelArguments, -# QuantArguments, -# TrainingArguments, -# ) -# from dbgpt_hub.data_process.data_utils import make_data_module -# from dbgpt_hub.llm_base import SavePeftModelCallback, get_accelerate_model -# from dbgpt_hub.utils.model_utils import ( -# get_last_checkpoint, -# print_trainable_parameters, -# ) - -# # sys.path.append( -# # os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -# # ) - -# if torch.cuda.is_available(): -# torch.backends.cuda.matmul.allow_tf32 = True - -# logger = logging.getLogger(__name__) - -# IGNORE_INDEX = -100 - - -# def main(): -# parser = transformers.HfArgumentParser( -# ( -# ModelArguments, -# DataArguments, -# TrainingArguments, -# LoraArguments, -# QuantArguments, -# GenerationArguments, -# ) -# ) -# ( -# model_args, -# data_args, -# training_args, -# lora_args, -# quant_args, -# generation_args, -# ) = parser.parse_args_into_dataclasses() -# # Check arguments (do not check finetuning_args since it may be loaded from checkpoints) -# data_args.init_for_training() -# training_args.generation_config = GenerationConfig(**vars(generation_args)) - -# args = argparse.Namespace( -# **vars(model_args), -# **vars(data_args), -# **vars(training_args), -# **vars(lora_args), -# **vars(quant_args), -# ) -# # init the logger before other steps -# # timestamp = time.strftime('%Y%m%d_%H%M%S', time.localtime()) -# # if not os.path.exists(args.output_dir): -# # os.makedirs(args.output_dir) -# # log_file = os.path.join(args.output_dir, f'{timestamp}.log') -# checkpoint_dir, completed_training = get_last_checkpoint(args.output_dir) -# if completed_training: -# print("Detected that training was already completed!") - -# model, tokenizer = get_accelerate_model(args, checkpoint_dir) - -# model.config.use_cache = False -# print("loaded model") -# set_seed(args.seed) - -# args.dataset_format = "spider" -# data_module = make_data_module(tokenizer=tokenizer, args=args) - -# trainer = Seq2SeqTrainer( -# model=model, -# tokenizer=tokenizer, -# args=training_args, -# **{k: v for k, v in data_module.items() if k != "predict_dataset"}, -# ) - -# # Callbacks -# if not args.full_finetune: -# trainer.add_callback(SavePeftModelCallback) - -# # Verifying the datatypes and parameter counts before training. -# print_trainable_parameters(args, model) -# dtypes = {} -# for _, p in model.named_parameters(): -# dtype = p.dtype -# if dtype not in dtypes: -# dtypes[dtype] = 0 -# dtypes[dtype] += p.numel() -# total = 0 -# for k, v in dtypes.items(): -# total += v -# for k, v in dtypes.items(): -# print(k, v, v / total) - -# all_metrics = {"run_name": args.run_name} -# # Training -# if args.do_train: -# logger.info("*** Train ***") -# # Note: `resume_from_checkpoint` not supported for adapter checkpoints by HF. -# # Currently adapter checkpoint is reloaded as expected but optimizer/scheduler states are not. -# train_result = trainer.train() -# metrics = train_result.metrics -# trainer.log_metrics("train", metrics) -# trainer.save_metrics("train", metrics) -# trainer.save_state() -# all_metrics.update(metrics) -# # Evaluation -# if args.do_eval: -# logger.info("*** Evaluate ***") -# metrics = trainer.evaluate(metric_key_prefix="eval") -# trainer.log_metrics("eval", metrics) -# trainer.save_metrics("eval", metrics) -# all_metrics.update(metrics) -# # Prediction -# if args.do_predict: -# logger.info("*** Predict ***") -# prediction_output = trainer.predict( -# test_dataset=data_module["predict_dataset"], metric_key_prefix="predict" -# ) -# prediction_metrics = prediction_output.metrics -# predictions = prediction_output.predictions -# predictions = np.where(predictions != -100, predictions, tokenizer.pad_token_id) -# predictions = tokenizer.batch_decode( -# predictions, skip_special_tokens=True, clean_up_tokenization_spaces=True -# ) -# with open(os.path.join(args.output_dir, "predictions.jsonl"), "w") as fout: -# for i, example in enumerate(data_module["predict_dataset"]): -# example["prediction_with_input"] = predictions[i].strip() -# example["prediction"] = ( -# predictions[i].replace(example["input"], "").strip() -# ) -# fout.write(json.dumps(example) + "\n") -# print(prediction_metrics) -# trainer.log_metrics("predict", prediction_metrics) -# trainer.save_metrics("predict", prediction_metrics) -# all_metrics.update(prediction_metrics) - -# if args.do_train or args.do_eval or args.do_predict: -# with open(os.path.join(args.output_dir, "metrics.json"), "w") as fout: -# fout.write(json.dumps(all_metrics)) - - -# if __name__ == "__main__": -# main() diff --git a/dbgpt_hub/train/train_sft.sh b/dbgpt_hub/train/train_sft.sh deleted file mode 100644 index 21cd4fe..0000000 --- a/dbgpt_hub/train/train_sft.sh +++ /dev/null @@ -1,25 +0,0 @@ -deepspeed --num_gpus 2 --master_port=9901 src/train_bash.py \ - --deepspeed ds_config.json \ - --quantization_bit 4 \ - --model_name_or_path /home/pci/data/cpf/Baichuan2-13B-Chat \ - --do_train \ - --dataset example_text2sql \ - --max_source_length 2048 \ - --max_target_length 512 \ - --template baichuan2 \ - --finetuning_type lora \ - --lora_rank 32 \ - --lora_alpha 64 \ - --lora_target W_pack \ - --output_dir path_to_sft_checkpoint \ - --overwrite_cache \ - --overwrite_output_dir \ - --per_device_train_batch_size 1 \ - --gradient_accumulation_steps 4 \ - --lr_scheduler_type cosine_with_restarts \ - --logging_steps 10 \ - --save_steps 1000 \ - --learning_rate 5e-5 \ - --num_train_epochs 6.0 \ - --plot_loss \ - --bf16 \ No newline at end of file