Upload data.jsonl with huggingface_hub
Browse files- data.jsonl +2 -2
data.jsonl
CHANGED
|
@@ -102,7 +102,6 @@
|
|
| 102 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doctor_id character varying(64) NOT NULL, diagnosis_code character varying(20) NOT NULL, code_type character varying(10) NOT NULL DEFAULT 'ICD-10', description text, diagnosis_date date NOT NULL, status character varying(32) NOT NULL, is_chronic boolean DEFAULT false, PRIMARY KEY (diagnosis_id) )\nCREATE TABLE healthcare.prescriptions ( prescription_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doctor_id character varying(64) NOT NULL, medication_id character varying(64) NOT NULL, dosage character varying(100) NOT NULL, frequency character varying(100) NOT NULL, route character varying(50), start_date date NOT NULL, end_date date, quantity_dispensed numeric(10,2), refills_allowed integer NOT NULL DEFAULT 0, prescription_date timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (prescription_id) )\nCREATE TABLE healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, plan_id character varying(64) NOT NULL, policy_number character varying(100) NOT NULL, group_number character varying(100), subscriber_name character varying(200), effective_date date NOT NULL, expiration_date date, is_primary boolean NOT NULL DEFAULT true, PRIMARY KEY (patient_insurance_id), UNIQUE (patient_id, plan_id, policy_number) )\n", "conversations": [{"role": "user", "content": "Show each patient's policy number, the associated insurance plan ID, and any medications they have been prescribed, including the medication ID and prescription date."}, {"role": "assistant", "content": "SELECT pi.patient_id, pi.policy_number, pi.plan_id, pr.medication_id, pr.prescription_date\nFROM healthcare.patient_insurance pi\nJOIN healthcare.prescriptions pr ON pi.patient_id = pr.patient_id;"}, {"role": "user", "content": "Only include prescriptions that were made after the insurance policy's effective date."}, {"role": "assistant", "content": "SELECT pi.patient_id, pi.policy_number, pi.plan_id, pr.medication_id, pr.prescription_date\nFROM healthcare.patient_insurance pi\nJOIN healthcare.prescriptions pr ON pi.patient_id = pr.patient_id\nWHERE pr.prescription_date >= pi.effective_date;"}, {"role": "user", "content": "Add the expiration date of the insurance policy and only show records where the prescription was made before the policy expired."}, {"role": "assistant", "content": "SELECT pi.patient_id, pi.policy_number, pi.plan_id, pi.expiration_date, pr.medication_id, pr.prescription_date\nFROM healthcare.patient_insurance pi\nJOIN healthcare.prescriptions pr ON pi.patient_id = pr.patient_id\nWHERE pr.prescription_date >= pi.effective_date\n AND (pi.expiration_date IS NULL OR pr.prescription_date < pi.expiration_date);"}]}
|
| 103 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.medical_records ( record_id text PRIMARY KEY, patient_id text, appointment_id text, doctor_id text, record_date timestamp, chief_complaint text, present_illness_history text, past_medical_history text, physical_examination_notes text, assessment text, treatment_plan text, vitals text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "List all medical records along with the chief complaint and record date for patients who had their medical record created after March 1, 2023 and whose record was created by doctor with ID 'doctor_123'."}, {"role": "assistant", "content": "SELECT record_id, patient_id, chief_complaint, record_date FROM healthcare.medical_records WHERE doctor_id = 'doctor_123' AND record_date > '2023-03-01';"}, {"role": "user", "content": "Can you also include the treatment plan for each record in the result?"}, {"role": "assistant", "content": "SELECT record_id, patient_id, chief_complaint, record_date, treatment_plan FROM healthcare.medical_records WHERE doctor_id = 'doctor_123' AND record_date > '2023-03-01';"}, {"role": "user", "content": "Actually, I only want records where the assessment field is not null."}, {"role": "assistant", "content": "SELECT record_id, patient_id, chief_complaint, record_date, treatment_plan FROM healthcare.medical_records WHERE doctor_id = 'doctor_123' AND record_date > '2023-03-01' AND assessment IS NOT NULL;"}, {"role": "user", "content": "Now, restrict the results to records where the chief complaint contains the word 'cough'."}, {"role": "assistant", "content": "SELECT record_id, patient_id, chief_complaint, record_date, treatment_plan FROM healthcare.medical_records WHERE doctor_id = 'doctor_123' AND record_date > '2023-03-01' AND assessment IS NOT NULL AND chief_complaint ILIKE '%cough%';"}]}
|
| 104 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.patient_insurance ( patient_insurance_id text, patient_id text, plan_id text, policy_number text, group_number text, subscriber_name text, effective_date date, expiration_date date, is_primary boolean )\n", "conversations": [{"role": "user", "content": "Show me all primary insurance policies along with their policy numbers and effective dates for patient with ID 'patient_555'."}, {"role": "assistant", "content": "SELECT patient_insurance_id, policy_number, effective_date FROM healthcare.patient_insurance WHERE patient_id = 'patient_555' AND is_primary = TRUE;"}, {"role": "user", "content": "Can you also show the group number for each policy?"}, {"role": "assistant", "content": "SELECT patient_insurance_id, policy_number, effective_date, group_number FROM healthcare.patient_insurance WHERE patient_id = 'patient_555' AND is_primary = TRUE;"}, {"role": "user", "content": "I only want to see those policies that are still active."}, {"role": "assistant", "content": "SELECT patient_insurance_id, policy_number, effective_date, group_number FROM healthcare.patient_insurance WHERE patient_id = 'patient_555' AND is_primary = TRUE AND expiration_date > CURRENT_DATE;"}, {"role": "user", "content": "Actually, can you order the results by expiration_date, with the soonest expiration first?"}, {"role": "assistant", "content": "SELECT patient_insurance_id, policy_number, effective_date, group_number FROM healthcare.patient_insurance WHERE patient_id = 'patient_555' AND is_primary = TRUE AND expiration_date > CURRENT_DATE ORDER BY expiration_date ASC;"}]}
|
| 105 |
-
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_type.text, description.text, diagnosis_date.date, status.text, is_chronic.boolean )\n", "conversations": [{"role": "user", "content": "Can you show me the total number of diagnosis records for each doctor, along with the doctor's ID? Please include only those diagnoses marked as 'chronic'."}, {"role": "assistant", "content": "SELECT doctor_id, COUNT(*) AS total_chronic_diagnoses FROM healthcare.diagnoses WHERE is_chronic = TRUE GROUP BY doctor_id;"}, {"role": "user", "content": "Now, can you also include the average number of chronic diagnoses per patient for each doctor in the results?"}, {"role": "assistant", "content": "SELECT doctor_id, COUNT(*) AS total_chronic_diagnoses, COUNT(*)::FLOAT / COUNT(DISTINCT patient_id) AS avg_chronic_per_patient FROM healthcare.diagnoses WHERE is_chronic = TRUE GROUP BY doctor_id;"}, {"role": "user", "content": "Please filter the results to only include doctors with at least 5 chronic diagnoses."}, {"role": "assistant", "content": "SELECT doctor_id, COUNT(*) AS total_chronic_diagnoses, COUNT(*)::FLOAT / COUNT(DISTINCT patient_id) AS avg_chronic_per_patient FROM healthcare.diagnoses WHERE is_chronic = TRUE GROUP BY doctor_id HAVING COUNT(*) >= 5;"}]}
|
| 106 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.medical_records ( record_id text, patient_id text, appointment_id text, doctor_id text, record_date timestamp, chief_complaint text, present_illness_history text, past_medical_history text, physical_examination_notes text, assessment text, treatment_plan text, vitals text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "List all medical records created by doctor 'doctor_001' for patients who had their last medical record on or after '2024-01-01', including record_id, patient_id, record_date, chief_complaint, and doctor_id."}, {"role": "assistant", "content": "SELECT mr.record_id, mr.patient_id, mr.record_date, mr.chief_complaint, mr.doctor_id\nFROM healthcare.medical_records mr\nJOIN (\n SELECT patient_id, MAX(record_date) AS last_record_date\n FROM healthcare.medical_records\n GROUP BY patient_id\n) last_rec ON mr.patient_id = last_rec.patient_id\nWHERE mr.doctor_id = 'doctor_001' AND last_rec.last_record_date >= '2024-01-01';"}, {"role": "user", "content": "Please refine the results to only include records where the 'assessment' field is not null."}, {"role": "assistant", "content": "SELECT mr.record_id, mr.patient_id, mr.record_date, mr.chief_complaint, mr.doctor_id\nFROM healthcare.medical_records mr\nJOIN (\n SELECT patient_id, MAX(record_date) AS last_record_date\n FROM healthcare.medical_records\n GROUP BY patient_id\n) last_rec ON mr.patient_id = last_rec.patient_id\nWHERE mr.doctor_id = 'doctor_001' AND last_rec.last_record_date >= '2024-01-01' AND mr.assessment IS NOT NULL;"}, {"role": "user", "content": "I received too many results. Can you only show records where 'treatment_plan' is also not null?"}, {"role": "assistant", "content": "SELECT mr.record_id, mr.patient_id, mr.record_date, mr.chief_complaint, mr.doctor_id\nFROM healthcare.medical_records mr\nJOIN (\n SELECT patient_id, MAX(record_date) AS last_record_date\n FROM healthcare.medical_records\n GROUP BY patient_id\n) last_rec ON mr.patient_id = last_rec.patient_id\nWHERE mr.doctor_id = 'doctor_001' AND last_rec.last_record_date >= '2024-01-01' AND mr.assessment IS NOT NULL AND mr.treatment_plan IS NOT NULL;"}]}
|
| 107 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.medications ( medication_id text PRIMARY KEY, medication_name text, generic_name text, manufacturer text, ndc_code text, description text )\n", "conversations": [{"role": "user", "content": "List the medication IDs and names for all entries where the description is missing or empty."}, {"role": "assistant", "content": "SELECT medication_id, medication_name FROM healthcare.medications WHERE description IS NULL OR description = '';"}, {"role": "user", "content": "For those medications, please also show the manufacturer and sort the results by medication name in ascending order."}, {"role": "assistant", "content": "SELECT medication_id, medication_name, manufacturer FROM healthcare.medications WHERE description IS NULL OR description = '' ORDER BY medication_name ASC;"}]}
|
| 108 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, phone_number text, email text, emergency_contact_name text, emergency_contact_phone text, created_at timestamp, updated_at timestamp )\nCREATE TABLE healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_minutes integer, reason text, status text, location_id text, notes text, created_at timestamp )\nCREATE TABLE healthcare.medical_records ( record_id text, patient_id text, appointment_id text, doctor_id text, record_date timestamp, chief_complaint text, present_illness_history text, past_medical_history text, physical_examination_notes text, assessment text, treatment_plan text, vitals text, created_at timestamp )\nCREATE TABLE healthcare.diagnoses ( diagnosis_id text, record_id text, patient_id text, doctor_id text, diagnosis_code text, code_type text, description text, diagnosis_date date, status text, is_chronic boolean )\nCREATE TABLE healthcare.medications ( medication_id text, medication_name text, generic_name text, manufacturer text, ndc_code text, description text )\nCREATE TABLE healthcare.prescriptions ( prescription_id text, record_id text, patient_id text, doctor_id text, medication_id text, dosage text, frequency text, route text, start_date date, end_date date, quantity_dispensed numeric, refills_allowed integer, prescription_date timestamp )\nCREATE TABLE healthcare.insurance_plans ( plan_id text, plan_name text, insurance_provider text, plan_type text, contact_phone text, website text )\nCREATE TABLE healthcare.patient_insurance ( patient_insurance_id text, patient_id text, plan_id text, policy_number text, group_number text, subscriber_name text, effective_date date, expiration_date date, is_primary boolean )\n", "conversations": [{"role": "user", "content": "I need to find patients who received prescriptions within 7 days after their latest appointment. Show patient_id, first and last name, appointment_time, prescription_date, and medication_name."}, {"role": "assistant", "content": "WITH latest_appt AS (\n SELECT patient_id, MAX(appointment_time) AS latest_time\n FROM healthcare.appointments\n GROUP BY patient_id\n)\nSELECT p.patient_id,\n p.first_name,\n p.last_name,\n la.latest_time AS appointment_time,\n pr.prescription_date,\n m.medication_name\nFROM latest_appt la\nJOIN healthcare.patients p\n ON p.patient_id = la.patient_id\nJOIN healthcare.prescriptions pr\n ON pr.patient_id = la.patient_id\n AND pr.prescription_date BETWEEN la.latest_time AND la.latest_time + INTERVAL '7 days'\nJOIN healthcare.medications m\n ON m.medication_id = pr.medication_id"}, {"role": "user", "content": "Actually, restrict it to prescriptions where dosage contains 'mg'."}, {"role": "assistant", "content": "WITH latest_appt AS (\n SELECT patient_id, MAX(appointment_time) AS latest_time\n FROM healthcare.appointments\n GROUP BY patient_id\n)\nSELECT p.patient_id,\n p.first_name,\n p.last_name,\n la.latest_time AS appointment_time,\n pr.prescription_date,\n m.medication_name\nFROM latest_appt la\nJOIN healthcare.patients p\n ON p.patient_id = la.patient_id\nJOIN healthcare.prescriptions pr\n ON pr.patient_id = la.patient_id\n AND pr.prescription_date BETWEEN la.latest_time AND la.latest_time + INTERVAL '7 days'\n AND pr.dosage LIKE '%mg%'\nJOIN healthcare.medications m\n ON m.medication_id = pr.medication_id"}, {"role": "user", "content": "Also, sort the results by prescription_date descending and limit to 5."}, {"role": "assistant", "content": "WITH latest_appt AS (\n SELECT patient_id, MAX(appointment_time) AS latest_time\n FROM healthcare.appointments\n GROUP BY patient_id\n)\nSELECT p.patient_id,\n p.first_name,\n p.last_name,\n la.latest_time AS appointment_time,\n pr.prescription_date,\n m.medication_name\nFROM latest_appt la\nJOIN healthcare.patients p\n ON p.patient_id = la.patient_id\nJOIN healthcare.prescriptions pr\n ON pr.patient_id = la.patient_id\n AND pr.prescription_date BETWEEN la.latest_time AND la.latest_time + INTERVAL '7 days'\n AND pr.dosage LIKE '%mg%'\nJOIN healthcare.medications m\n ON m.medication_id = pr.medication_id\nORDER BY pr.prescription_date DESC\nLIMIT 5"}]}
|
|
@@ -201,6 +200,7 @@
|
|
| 201 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE government_services.citizens (\n citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen\n national_id_number character varying(128) NOT NULL UNIQUE, -- official national identification number\n first_name character varying(100) NOT NULL,\n last_name character varying(100) NOT NULL,\n date_of_birth date NOT NULL,\n gender character varying(20),\n primary_address text NOT NULL, -- full primary residential address\n contact_email character varying(128) UNIQUE,\n contact_phone character varying(32),\n registration_date timestamp NOT NULL, -- when the citizen profile was created\n is_verified boolean DEFAULT false, -- whether identity has been officially verified\n PRIMARY KEY (citizen_id)\n)\nCREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, jurisdiction_level character varying(50) NOT NULL, primary_contact_email character varying(128), main_phone_number character varying(32), website_url character varying(255), established_date date, parent_agency_id character varying(64), PRIMARY KEY (agency_id) )\nCREATE TABLE government_services.documents ( document_id text, application_id text, citizen_id text, document_type text, file_reference text, upload_timestamp timestamp, expiry_date date, verification_status text, verified_by_employee_id text, verification_timestamp timestamp )\n", "conversations": [{"role": "user", "content": "List agency_id, agency_name, and main_phone_number for agencies that do not have a main phone number specified."}, {"role": "assistant", "content": "SELECT agency_id, agency_name, main_phone_number\nFROM government_services.agencies\nWHERE main_phone_number IS NULL;"}]}
|
| 202 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQUE, vin character varying(17) UNIQUE, make character varying(64) NOT NULL, model character varying(64) NOT NULL, year integer NOT NULL, type character varying(32) NOT NULL, capacity integer, fuel_type character varying(32) NOT NULL, status character varying(32) NOT NULL, depot_id character varying(64), acquisition_date date, PRIMARY KEY (vehicle_id) )\nCREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_location_id text, distance_km numeric, estimated_duration_minutes integer, type text )\nCREATE TABLE transportation.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, quantity.numeric, unit.text, cost_per_unit.numeric, total_cost.numeric, odometer_reading.integer, location_id.text )\nCREATE TABLE transportation.passengers ( passenger_id.text, first_name.text, last_name.text, email.text, phone_number.text, date_of_birth.date, loyalty_program_id.text, created_at.timestamp )\n", "conversations": [{"role": "user", "content": "Give me a list of all passengers with an email address on file, showing their first name, last name, and the date their record was created."}, {"role": "assistant", "content": "SELECT first_name, last_name, created_at\nFROM transportation.passengers\nWHERE email IS NOT NULL;"}, {"role": "user", "content": "Narrow the results to only include passengers who joined in 2022."}, {"role": "assistant", "content": "SELECT first_name, last_name, created_at\nFROM transportation.passengers\nWHERE email IS NOT NULL AND EXTRACT(YEAR FROM created_at) = 2022;"}]}
|
| 203 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE transportation.bookings ( booking_id.text, passenger_id.text, trip_id.text, seat_number.text, booking_time.timestamp, status.text, fare.numeric, payment_transaction_id.text, special_requests.text )\n", "conversations": [{"role": "user", "content": "What are the average and maximum fare amounts for each booking status?"}, {"role": "assistant", "content": "SELECT status, AVG(fare) AS avg_fare, MAX(fare) AS max_fare\nFROM transportation.bookings\nGROUP BY status;"}, {"role": "user", "content": "Only include statuses where the average fare is greater than 50."}, {"role": "assistant", "content": "SELECT status, AVG(fare) AS avg_fare, MAX(fare) AS max_fare\nFROM transportation.bookings\nGROUP BY status\nHAVING AVG(fare) > 50;"}]}
|
|
|
|
| 204 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE transportation.locations ( location_id text, name text, type text, address_line1 text, city text, state_province text, postal_code text, country text, latitude numeric, longitude numeric, timezone text )\nCREATE TABLE transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, quantity numeric, unit text, cost_per_unit numeric, total_cost numeric, odometer_reading integer, location_id text )\nCREATE TABLE transportation.passengers ( passenger_id text, first_name text, last_name text, email text, phone_number text, date_of_birth date, loyalty_program_id text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "Show me the log timestamp, fuel type, quantity, and the name of the location for all fuel logs recorded at locations with type 'Warehouse'."}, {"role": "assistant", "content": "SELECT f.log_timestamp, f.fuel_type, f.quantity, l.name FROM transportation.fuel_logs f JOIN transportation.locations l ON f.location_id = l.location_id WHERE l.type = 'Warehouse';"}, {"role": "user", "content": "Filter these fuel logs to only include entries from the year 2024 and also include the total cost for each entry."}, {"role": "assistant", "content": "SELECT f.log_timestamp, f.fuel_type, f.quantity, f.total_cost, l.name FROM transportation.fuel_logs f JOIN transportation.locations l ON f.location_id = l.location_id WHERE l.type = 'Warehouse' AND EXTRACT(YEAR FROM f.log_timestamp) = 2024;"}, {"role": "user", "content": "For these 'Warehouse' fuel logs from 2024, calculate the average quantity and average cost_per_unit for each fuel type."}, {"role": "assistant", "content": "SELECT f.fuel_type, AVG(f.quantity) AS average_quantity, AVG(f.cost_per_unit) AS average_cost_per_unit FROM transportation.fuel_logs f JOIN transportation.locations l ON f.location_id = l.location_id WHERE l.type = 'Warehouse' AND EXTRACT(YEAR FROM f.log_timestamp) = 2024 GROUP BY f.fuel_type;"}]}
|
| 205 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text, capacity.integer, fuel_type.text, status.text, depot_id.text, acquisition_date.date )\n", "conversations": [{"role": "user", "content": "For each vehicle, find the vehicle acquired immediately before it in the same depot. Show current vehicle_id, acquisition_date, previous_vehicle_id, and previous_acquisition_date."}, {"role": "assistant", "content": "SELECT v.vehicle_id,\n v.acquisition_date,\n prev.vehicle_id AS previous_vehicle_id,\n prev.acquisition_date AS previous_acquisition_date\nFROM transportation.vehicles v\nLEFT JOIN transportation.vehicles prev\n ON v.depot_id = prev.depot_id\n AND prev.acquisition_date = (\n SELECT MAX(acquisition_date)\n FROM transportation.vehicles\n WHERE depot_id = v.depot_id\n AND acquisition_date < v.acquisition_date\n );"}]}
|
| 206 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destination_location_id text, distance_km numeric, estimated_duration_minutes int, type text )\nCREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_province text, postal_code text, country text, latitude numeric, longitude numeric, timezone text )\nCREATE TABLE transportation.bookings ( booking_id character varying(64) NOT NULL, passenger_id character varying(64) NOT NULL, trip_id character varying(64) NOT NULL, seat_number character varying(16), booking_time timestamp with time zone NOT NULL, status character varying(32) NOT NULL, fare numeric(10, 2) NOT NULL, payment_transaction_id character varying(128), special_requests text, PRIMARY KEY (booking_id) )\n", "conversations": [{"role": "user", "content": "Show the booking ID and seat number for all bookings that have a fare equal to 50."}, {"role": "assistant", "content": "SELECT booking_id, seat_number\nFROM transportation.bookings\nWHERE fare = 50;"}, {"role": "user", "content": "Also include the booking status and order the results by booking time ascending."}, {"role": "assistant", "content": "SELECT booking_id, seat_number, status\nFROM transportation.bookings\nWHERE fare = 50\nORDER BY booking_time ASC;"}]}
|
|
@@ -247,4 +247,4 @@
|
|
| 247 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, date_of_birth date NOT NULL, gender character varying(10), address text, phone_number character varying(20), email character varying(128) UNIQUE, emergency_contact_name character varying(200), emergency_contact_phone character varying(20), created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (patient_id) )\nCREATE TABLE healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, specialty character varying(100) NOT NULL, license_number character varying(50) UNIQUE NOT NULL, phone_number character varying(20), email character varying(128) UNIQUE, hospital_affiliation_id character varying(64), created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (doctor_id) )\nCREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doctor_id character varying(64) NOT NULL, diagnosis_code character varying(20) NOT NULL, code_type character varying(10) NOT NULL DEFAULT 'ICD-10', description text, diagnosis_date date NOT NULL, status character varying(32) NOT NULL, is_chronic boolean DEFAULT false, PRIMARY KEY (diagnosis_id) )\nCREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL, generic_name character varying(255), manufacturer character varying(100), ndc_code character varying(20) UNIQUE, description text, PRIMARY KEY (medication_id) )\nCREATE TABLE healthcare.insurance_plans ( plan_id character varying(64) NOT NULL, plan_name character varying(200) NOT NULL, insurance_provider character varying(100) NOT NULL, plan_type character varying(50), contact_phone character varying(20), website character varying(255), PRIMARY KEY (plan_id) )\nCREATE TABLE healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, plan_id character varying(64) NOT NULL, policy_number character varying(100) NOT NULL, group_number character varying(100), subscriber_name character varying(200), effective_date date NOT NULL, expiration_date date, is_primary boolean NOT NULL DEFAULT true, PRIMARY KEY (patient_insurance_id), UNIQUE (patient_id, plan_id, policy_number) )\n", "conversations": [{"role": "user", "content": "Which patients have a primary insurance policy and are subscribed to a plan provided by 'Cigna'? List patient ID, full name, policy number, plan ID, and insurance provider."}, {"role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.policy_number, pi.plan_id, ip.insurance_provider\nFROM healthcare.patient_insurance pi\nJOIN healthcare.patients p ON pi.patient_id = p.patient_id\nJOIN healthcare.insurance_plans ip ON pi.plan_id = ip.plan_id\nWHERE pi.is_primary = true AND ip.insurance_provider = 'Cigna';"}, {"role": "user", "content": "Additionally, only show results where the policy has not expired yet."}, {"role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.policy_number, pi.plan_id, ip.insurance_provider\nFROM healthcare.patient_insurance pi\nJOIN healthcare.patients p ON pi.patient_id = p.patient_id\nJOIN healthcare.insurance_plans ip ON pi.plan_id = ip.plan_id\nWHERE pi.is_primary = true AND ip.insurance_provider = 'Cigna' AND (pi.expiration_date IS NULL OR pi.expiration_date >= CURRENT_DATE);"}]}
|
| 248 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, address text, date_registered timestamp, status text )\nCREATE TABLE legal_services.lawyers ( lawyer_id text, first_name text, last_name text, bar_number text, firm_id text, email text, phone text, specialization text, hire_date timestamp, is_partner boolean )\nCREATE TABLE legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, managing_partner_id text )\nCREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, uploaded_by_lawyer_id text, upload_timestamp timestamp, version integer, description text )\nCREATE TABLE legal_services.time_entries ( entry_id text, case_id text, lawyer_id text, date_worked date, hours_spent numeric, billing_rate numeric, description text, is_billable boolean, is_billed boolean, invoice_id text, created_at timestamp )\nCREATE TABLE legal_services.appointments ( appointment_id text, client_id text, lawyer_id text, case_id text, start_time timestamp, end_time timestamp, location text, subject text, notes text, status text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "I need a list showing the name of each law firm and the full name of every lawyer employed by that firm."}, {"role": "assistant", "content": "SELECT T1.firm_name, T2.first_name, T2.last_name FROM law_firms AS T1 JOIN lawyers AS T2 ON T1.firm_id = T2.firm_id;"}]}
|
| 249 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address text, city text, state text, zip_code text, country text, email text, phone_number text, created_at timestamp, status text, risk_profile text )\n", "conversations": [{"role": "user", "content": "Show me all customers (customer_id, first_name, last_name, email) who were born after 1985 (date_of_birth > '1985-12-31') and have an email address ending with '@yahoo.com', along with their city and state information."}, {"role": "assistant", "content": "SELECT customer_id, first_name, last_name, email, city, state FROM financial_services.customers WHERE date_of_birth > '1985-12-31' AND email LIKE '%@yahoo.com';"}]}
|
| 250 |
-
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE
|
|
|
|
| 102 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doctor_id character varying(64) NOT NULL, diagnosis_code character varying(20) NOT NULL, code_type character varying(10) NOT NULL DEFAULT 'ICD-10', description text, diagnosis_date date NOT NULL, status character varying(32) NOT NULL, is_chronic boolean DEFAULT false, PRIMARY KEY (diagnosis_id) )\nCREATE TABLE healthcare.prescriptions ( prescription_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doctor_id character varying(64) NOT NULL, medication_id character varying(64) NOT NULL, dosage character varying(100) NOT NULL, frequency character varying(100) NOT NULL, route character varying(50), start_date date NOT NULL, end_date date, quantity_dispensed numeric(10,2), refills_allowed integer NOT NULL DEFAULT 0, prescription_date timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (prescription_id) )\nCREATE TABLE healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, plan_id character varying(64) NOT NULL, policy_number character varying(100) NOT NULL, group_number character varying(100), subscriber_name character varying(200), effective_date date NOT NULL, expiration_date date, is_primary boolean NOT NULL DEFAULT true, PRIMARY KEY (patient_insurance_id), UNIQUE (patient_id, plan_id, policy_number) )\n", "conversations": [{"role": "user", "content": "Show each patient's policy number, the associated insurance plan ID, and any medications they have been prescribed, including the medication ID and prescription date."}, {"role": "assistant", "content": "SELECT pi.patient_id, pi.policy_number, pi.plan_id, pr.medication_id, pr.prescription_date\nFROM healthcare.patient_insurance pi\nJOIN healthcare.prescriptions pr ON pi.patient_id = pr.patient_id;"}, {"role": "user", "content": "Only include prescriptions that were made after the insurance policy's effective date."}, {"role": "assistant", "content": "SELECT pi.patient_id, pi.policy_number, pi.plan_id, pr.medication_id, pr.prescription_date\nFROM healthcare.patient_insurance pi\nJOIN healthcare.prescriptions pr ON pi.patient_id = pr.patient_id\nWHERE pr.prescription_date >= pi.effective_date;"}, {"role": "user", "content": "Add the expiration date of the insurance policy and only show records where the prescription was made before the policy expired."}, {"role": "assistant", "content": "SELECT pi.patient_id, pi.policy_number, pi.plan_id, pi.expiration_date, pr.medication_id, pr.prescription_date\nFROM healthcare.patient_insurance pi\nJOIN healthcare.prescriptions pr ON pi.patient_id = pr.patient_id\nWHERE pr.prescription_date >= pi.effective_date\n AND (pi.expiration_date IS NULL OR pr.prescription_date < pi.expiration_date);"}]}
|
| 103 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.medical_records ( record_id text PRIMARY KEY, patient_id text, appointment_id text, doctor_id text, record_date timestamp, chief_complaint text, present_illness_history text, past_medical_history text, physical_examination_notes text, assessment text, treatment_plan text, vitals text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "List all medical records along with the chief complaint and record date for patients who had their medical record created after March 1, 2023 and whose record was created by doctor with ID 'doctor_123'."}, {"role": "assistant", "content": "SELECT record_id, patient_id, chief_complaint, record_date FROM healthcare.medical_records WHERE doctor_id = 'doctor_123' AND record_date > '2023-03-01';"}, {"role": "user", "content": "Can you also include the treatment plan for each record in the result?"}, {"role": "assistant", "content": "SELECT record_id, patient_id, chief_complaint, record_date, treatment_plan FROM healthcare.medical_records WHERE doctor_id = 'doctor_123' AND record_date > '2023-03-01';"}, {"role": "user", "content": "Actually, I only want records where the assessment field is not null."}, {"role": "assistant", "content": "SELECT record_id, patient_id, chief_complaint, record_date, treatment_plan FROM healthcare.medical_records WHERE doctor_id = 'doctor_123' AND record_date > '2023-03-01' AND assessment IS NOT NULL;"}, {"role": "user", "content": "Now, restrict the results to records where the chief complaint contains the word 'cough'."}, {"role": "assistant", "content": "SELECT record_id, patient_id, chief_complaint, record_date, treatment_plan FROM healthcare.medical_records WHERE doctor_id = 'doctor_123' AND record_date > '2023-03-01' AND assessment IS NOT NULL AND chief_complaint ILIKE '%cough%';"}]}
|
| 104 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.patient_insurance ( patient_insurance_id text, patient_id text, plan_id text, policy_number text, group_number text, subscriber_name text, effective_date date, expiration_date date, is_primary boolean )\n", "conversations": [{"role": "user", "content": "Show me all primary insurance policies along with their policy numbers and effective dates for patient with ID 'patient_555'."}, {"role": "assistant", "content": "SELECT patient_insurance_id, policy_number, effective_date FROM healthcare.patient_insurance WHERE patient_id = 'patient_555' AND is_primary = TRUE;"}, {"role": "user", "content": "Can you also show the group number for each policy?"}, {"role": "assistant", "content": "SELECT patient_insurance_id, policy_number, effective_date, group_number FROM healthcare.patient_insurance WHERE patient_id = 'patient_555' AND is_primary = TRUE;"}, {"role": "user", "content": "I only want to see those policies that are still active."}, {"role": "assistant", "content": "SELECT patient_insurance_id, policy_number, effective_date, group_number FROM healthcare.patient_insurance WHERE patient_id = 'patient_555' AND is_primary = TRUE AND expiration_date > CURRENT_DATE;"}, {"role": "user", "content": "Actually, can you order the results by expiration_date, with the soonest expiration first?"}, {"role": "assistant", "content": "SELECT patient_insurance_id, policy_number, effective_date, group_number FROM healthcare.patient_insurance WHERE patient_id = 'patient_555' AND is_primary = TRUE AND expiration_date > CURRENT_DATE ORDER BY expiration_date ASC;"}]}
|
|
|
|
| 105 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.medical_records ( record_id text, patient_id text, appointment_id text, doctor_id text, record_date timestamp, chief_complaint text, present_illness_history text, past_medical_history text, physical_examination_notes text, assessment text, treatment_plan text, vitals text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "List all medical records created by doctor 'doctor_001' for patients who had their last medical record on or after '2024-01-01', including record_id, patient_id, record_date, chief_complaint, and doctor_id."}, {"role": "assistant", "content": "SELECT mr.record_id, mr.patient_id, mr.record_date, mr.chief_complaint, mr.doctor_id\nFROM healthcare.medical_records mr\nJOIN (\n SELECT patient_id, MAX(record_date) AS last_record_date\n FROM healthcare.medical_records\n GROUP BY patient_id\n) last_rec ON mr.patient_id = last_rec.patient_id\nWHERE mr.doctor_id = 'doctor_001' AND last_rec.last_record_date >= '2024-01-01';"}, {"role": "user", "content": "Please refine the results to only include records where the 'assessment' field is not null."}, {"role": "assistant", "content": "SELECT mr.record_id, mr.patient_id, mr.record_date, mr.chief_complaint, mr.doctor_id\nFROM healthcare.medical_records mr\nJOIN (\n SELECT patient_id, MAX(record_date) AS last_record_date\n FROM healthcare.medical_records\n GROUP BY patient_id\n) last_rec ON mr.patient_id = last_rec.patient_id\nWHERE mr.doctor_id = 'doctor_001' AND last_rec.last_record_date >= '2024-01-01' AND mr.assessment IS NOT NULL;"}, {"role": "user", "content": "I received too many results. Can you only show records where 'treatment_plan' is also not null?"}, {"role": "assistant", "content": "SELECT mr.record_id, mr.patient_id, mr.record_date, mr.chief_complaint, mr.doctor_id\nFROM healthcare.medical_records mr\nJOIN (\n SELECT patient_id, MAX(record_date) AS last_record_date\n FROM healthcare.medical_records\n GROUP BY patient_id\n) last_rec ON mr.patient_id = last_rec.patient_id\nWHERE mr.doctor_id = 'doctor_001' AND last_rec.last_record_date >= '2024-01-01' AND mr.assessment IS NOT NULL AND mr.treatment_plan IS NOT NULL;"}]}
|
| 106 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.medications ( medication_id text PRIMARY KEY, medication_name text, generic_name text, manufacturer text, ndc_code text, description text )\n", "conversations": [{"role": "user", "content": "List the medication IDs and names for all entries where the description is missing or empty."}, {"role": "assistant", "content": "SELECT medication_id, medication_name FROM healthcare.medications WHERE description IS NULL OR description = '';"}, {"role": "user", "content": "For those medications, please also show the manufacturer and sort the results by medication name in ascending order."}, {"role": "assistant", "content": "SELECT medication_id, medication_name, manufacturer FROM healthcare.medications WHERE description IS NULL OR description = '' ORDER BY medication_name ASC;"}]}
|
| 107 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, phone_number text, email text, emergency_contact_name text, emergency_contact_phone text, created_at timestamp, updated_at timestamp )\nCREATE TABLE healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_minutes integer, reason text, status text, location_id text, notes text, created_at timestamp )\nCREATE TABLE healthcare.medical_records ( record_id text, patient_id text, appointment_id text, doctor_id text, record_date timestamp, chief_complaint text, present_illness_history text, past_medical_history text, physical_examination_notes text, assessment text, treatment_plan text, vitals text, created_at timestamp )\nCREATE TABLE healthcare.diagnoses ( diagnosis_id text, record_id text, patient_id text, doctor_id text, diagnosis_code text, code_type text, description text, diagnosis_date date, status text, is_chronic boolean )\nCREATE TABLE healthcare.medications ( medication_id text, medication_name text, generic_name text, manufacturer text, ndc_code text, description text )\nCREATE TABLE healthcare.prescriptions ( prescription_id text, record_id text, patient_id text, doctor_id text, medication_id text, dosage text, frequency text, route text, start_date date, end_date date, quantity_dispensed numeric, refills_allowed integer, prescription_date timestamp )\nCREATE TABLE healthcare.insurance_plans ( plan_id text, plan_name text, insurance_provider text, plan_type text, contact_phone text, website text )\nCREATE TABLE healthcare.patient_insurance ( patient_insurance_id text, patient_id text, plan_id text, policy_number text, group_number text, subscriber_name text, effective_date date, expiration_date date, is_primary boolean )\n", "conversations": [{"role": "user", "content": "I need to find patients who received prescriptions within 7 days after their latest appointment. Show patient_id, first and last name, appointment_time, prescription_date, and medication_name."}, {"role": "assistant", "content": "WITH latest_appt AS (\n SELECT patient_id, MAX(appointment_time) AS latest_time\n FROM healthcare.appointments\n GROUP BY patient_id\n)\nSELECT p.patient_id,\n p.first_name,\n p.last_name,\n la.latest_time AS appointment_time,\n pr.prescription_date,\n m.medication_name\nFROM latest_appt la\nJOIN healthcare.patients p\n ON p.patient_id = la.patient_id\nJOIN healthcare.prescriptions pr\n ON pr.patient_id = la.patient_id\n AND pr.prescription_date BETWEEN la.latest_time AND la.latest_time + INTERVAL '7 days'\nJOIN healthcare.medications m\n ON m.medication_id = pr.medication_id"}, {"role": "user", "content": "Actually, restrict it to prescriptions where dosage contains 'mg'."}, {"role": "assistant", "content": "WITH latest_appt AS (\n SELECT patient_id, MAX(appointment_time) AS latest_time\n FROM healthcare.appointments\n GROUP BY patient_id\n)\nSELECT p.patient_id,\n p.first_name,\n p.last_name,\n la.latest_time AS appointment_time,\n pr.prescription_date,\n m.medication_name\nFROM latest_appt la\nJOIN healthcare.patients p\n ON p.patient_id = la.patient_id\nJOIN healthcare.prescriptions pr\n ON pr.patient_id = la.patient_id\n AND pr.prescription_date BETWEEN la.latest_time AND la.latest_time + INTERVAL '7 days'\n AND pr.dosage LIKE '%mg%'\nJOIN healthcare.medications m\n ON m.medication_id = pr.medication_id"}, {"role": "user", "content": "Also, sort the results by prescription_date descending and limit to 5."}, {"role": "assistant", "content": "WITH latest_appt AS (\n SELECT patient_id, MAX(appointment_time) AS latest_time\n FROM healthcare.appointments\n GROUP BY patient_id\n)\nSELECT p.patient_id,\n p.first_name,\n p.last_name,\n la.latest_time AS appointment_time,\n pr.prescription_date,\n m.medication_name\nFROM latest_appt la\nJOIN healthcare.patients p\n ON p.patient_id = la.patient_id\nJOIN healthcare.prescriptions pr\n ON pr.patient_id = la.patient_id\n AND pr.prescription_date BETWEEN la.latest_time AND la.latest_time + INTERVAL '7 days'\n AND pr.dosage LIKE '%mg%'\nJOIN healthcare.medications m\n ON m.medication_id = pr.medication_id\nORDER BY pr.prescription_date DESC\nLIMIT 5"}]}
|
|
|
|
| 200 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE government_services.citizens (\n citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen\n national_id_number character varying(128) NOT NULL UNIQUE, -- official national identification number\n first_name character varying(100) NOT NULL,\n last_name character varying(100) NOT NULL,\n date_of_birth date NOT NULL,\n gender character varying(20),\n primary_address text NOT NULL, -- full primary residential address\n contact_email character varying(128) UNIQUE,\n contact_phone character varying(32),\n registration_date timestamp NOT NULL, -- when the citizen profile was created\n is_verified boolean DEFAULT false, -- whether identity has been officially verified\n PRIMARY KEY (citizen_id)\n)\nCREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, jurisdiction_level character varying(50) NOT NULL, primary_contact_email character varying(128), main_phone_number character varying(32), website_url character varying(255), established_date date, parent_agency_id character varying(64), PRIMARY KEY (agency_id) )\nCREATE TABLE government_services.documents ( document_id text, application_id text, citizen_id text, document_type text, file_reference text, upload_timestamp timestamp, expiry_date date, verification_status text, verified_by_employee_id text, verification_timestamp timestamp )\n", "conversations": [{"role": "user", "content": "List agency_id, agency_name, and main_phone_number for agencies that do not have a main phone number specified."}, {"role": "assistant", "content": "SELECT agency_id, agency_name, main_phone_number\nFROM government_services.agencies\nWHERE main_phone_number IS NULL;"}]}
|
| 201 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQUE, vin character varying(17) UNIQUE, make character varying(64) NOT NULL, model character varying(64) NOT NULL, year integer NOT NULL, type character varying(32) NOT NULL, capacity integer, fuel_type character varying(32) NOT NULL, status character varying(32) NOT NULL, depot_id character varying(64), acquisition_date date, PRIMARY KEY (vehicle_id) )\nCREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_location_id text, distance_km numeric, estimated_duration_minutes integer, type text )\nCREATE TABLE transportation.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, quantity.numeric, unit.text, cost_per_unit.numeric, total_cost.numeric, odometer_reading.integer, location_id.text )\nCREATE TABLE transportation.passengers ( passenger_id.text, first_name.text, last_name.text, email.text, phone_number.text, date_of_birth.date, loyalty_program_id.text, created_at.timestamp )\n", "conversations": [{"role": "user", "content": "Give me a list of all passengers with an email address on file, showing their first name, last name, and the date their record was created."}, {"role": "assistant", "content": "SELECT first_name, last_name, created_at\nFROM transportation.passengers\nWHERE email IS NOT NULL;"}, {"role": "user", "content": "Narrow the results to only include passengers who joined in 2022."}, {"role": "assistant", "content": "SELECT first_name, last_name, created_at\nFROM transportation.passengers\nWHERE email IS NOT NULL AND EXTRACT(YEAR FROM created_at) = 2022;"}]}
|
| 202 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE transportation.bookings ( booking_id.text, passenger_id.text, trip_id.text, seat_number.text, booking_time.timestamp, status.text, fare.numeric, payment_transaction_id.text, special_requests.text )\n", "conversations": [{"role": "user", "content": "What are the average and maximum fare amounts for each booking status?"}, {"role": "assistant", "content": "SELECT status, AVG(fare) AS avg_fare, MAX(fare) AS max_fare\nFROM transportation.bookings\nGROUP BY status;"}, {"role": "user", "content": "Only include statuses where the average fare is greater than 50."}, {"role": "assistant", "content": "SELECT status, AVG(fare) AS avg_fare, MAX(fare) AS max_fare\nFROM transportation.bookings\nGROUP BY status\nHAVING AVG(fare) > 50;"}]}
|
| 203 |
+
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQUE, vin character varying(17) UNIQUE, make character varying(64) NOT NULL, model character varying(64) NOT NULL, year integer NOT NULL, type character varying(32) NOT NULL, capacity integer, fuel_type character varying(32) NOT NULL, status character varying(32) NOT NULL, depot_id character varying(64), acquisition_date date, PRIMARY KEY (vehicle_id) )\nCREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_location_id text, distance_km numeric, estimated_duration_minutes integer, type text )\nCREATE TABLE transportation.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, quantity.numeric, unit.text, cost_per_unit.numeric, total_cost.numeric, odometer_reading.integer, location_id.text )\nCREATE TABLE transportation.passengers ( passenger_id.text, first_name.text, last_name.text, email.text, phone_number.text, date_of_birth.date, loyalty_program_id.text, created_at.timestamp )\n", "conversations": [{"role": "user", "content": "Can you show the fuel_log_id, vehicle make, and quantity for all fuel logs where the quantity is greater than 100?"}, {"role": "assistant", "content": "SELECT f.fuel_log_id, v.make, f.quantity\nFROM transportation.fuel_logs f\nJOIN transportation.vehicles v ON f.vehicle_id = v.vehicle_id\nWHERE f.quantity > 100;"}, {"role": "user", "content": "Also display the fuel type and order the results by quantity in descending order."}, {"role": "assistant", "content": "SELECT f.fuel_log_id, v.make, f.quantity, f.fuel_type\nFROM transportation.fuel_logs f\nJOIN transportation.vehicles v ON f.vehicle_id = v.vehicle_id\nWHERE f.quantity > 100\nORDER BY f.quantity DESC;"}, {"role": "user", "content": "Only include records from fuel logs that happened in 2023."}, {"role": "assistant", "content": "SELECT f.fuel_log_id, v.make, f.quantity, f.fuel_type\nFROM transportation.fuel_logs f\nJOIN transportation.vehicles v ON f.vehicle_id = v.vehicle_id\nWHERE f.quantity > 100\n AND EXTRACT(YEAR FROM f.log_timestamp) = 2023\nORDER BY f.quantity DESC;"}]}
|
| 204 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE transportation.locations ( location_id text, name text, type text, address_line1 text, city text, state_province text, postal_code text, country text, latitude numeric, longitude numeric, timezone text )\nCREATE TABLE transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, quantity numeric, unit text, cost_per_unit numeric, total_cost numeric, odometer_reading integer, location_id text )\nCREATE TABLE transportation.passengers ( passenger_id text, first_name text, last_name text, email text, phone_number text, date_of_birth date, loyalty_program_id text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "Show me the log timestamp, fuel type, quantity, and the name of the location for all fuel logs recorded at locations with type 'Warehouse'."}, {"role": "assistant", "content": "SELECT f.log_timestamp, f.fuel_type, f.quantity, l.name FROM transportation.fuel_logs f JOIN transportation.locations l ON f.location_id = l.location_id WHERE l.type = 'Warehouse';"}, {"role": "user", "content": "Filter these fuel logs to only include entries from the year 2024 and also include the total cost for each entry."}, {"role": "assistant", "content": "SELECT f.log_timestamp, f.fuel_type, f.quantity, f.total_cost, l.name FROM transportation.fuel_logs f JOIN transportation.locations l ON f.location_id = l.location_id WHERE l.type = 'Warehouse' AND EXTRACT(YEAR FROM f.log_timestamp) = 2024;"}, {"role": "user", "content": "For these 'Warehouse' fuel logs from 2024, calculate the average quantity and average cost_per_unit for each fuel type."}, {"role": "assistant", "content": "SELECT f.fuel_type, AVG(f.quantity) AS average_quantity, AVG(f.cost_per_unit) AS average_cost_per_unit FROM transportation.fuel_logs f JOIN transportation.locations l ON f.location_id = l.location_id WHERE l.type = 'Warehouse' AND EXTRACT(YEAR FROM f.log_timestamp) = 2024 GROUP BY f.fuel_type;"}]}
|
| 205 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text, capacity.integer, fuel_type.text, status.text, depot_id.text, acquisition_date.date )\n", "conversations": [{"role": "user", "content": "For each vehicle, find the vehicle acquired immediately before it in the same depot. Show current vehicle_id, acquisition_date, previous_vehicle_id, and previous_acquisition_date."}, {"role": "assistant", "content": "SELECT v.vehicle_id,\n v.acquisition_date,\n prev.vehicle_id AS previous_vehicle_id,\n prev.acquisition_date AS previous_acquisition_date\nFROM transportation.vehicles v\nLEFT JOIN transportation.vehicles prev\n ON v.depot_id = prev.depot_id\n AND prev.acquisition_date = (\n SELECT MAX(acquisition_date)\n FROM transportation.vehicles\n WHERE depot_id = v.depot_id\n AND acquisition_date < v.acquisition_date\n );"}]}
|
| 206 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destination_location_id text, distance_km numeric, estimated_duration_minutes int, type text )\nCREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_province text, postal_code text, country text, latitude numeric, longitude numeric, timezone text )\nCREATE TABLE transportation.bookings ( booking_id character varying(64) NOT NULL, passenger_id character varying(64) NOT NULL, trip_id character varying(64) NOT NULL, seat_number character varying(16), booking_time timestamp with time zone NOT NULL, status character varying(32) NOT NULL, fare numeric(10, 2) NOT NULL, payment_transaction_id character varying(128), special_requests text, PRIMARY KEY (booking_id) )\n", "conversations": [{"role": "user", "content": "Show the booking ID and seat number for all bookings that have a fare equal to 50."}, {"role": "assistant", "content": "SELECT booking_id, seat_number\nFROM transportation.bookings\nWHERE fare = 50;"}, {"role": "user", "content": "Also include the booking status and order the results by booking time ascending."}, {"role": "assistant", "content": "SELECT booking_id, seat_number, status\nFROM transportation.bookings\nWHERE fare = 50\nORDER BY booking_time ASC;"}]}
|
|
|
|
| 247 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, date_of_birth date NOT NULL, gender character varying(10), address text, phone_number character varying(20), email character varying(128) UNIQUE, emergency_contact_name character varying(200), emergency_contact_phone character varying(20), created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (patient_id) )\nCREATE TABLE healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name character varying(100) NOT NULL, specialty character varying(100) NOT NULL, license_number character varying(50) UNIQUE NOT NULL, phone_number character varying(20), email character varying(128) UNIQUE, hospital_affiliation_id character varying(64), created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (doctor_id) )\nCREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doctor_id character varying(64) NOT NULL, diagnosis_code character varying(20) NOT NULL, code_type character varying(10) NOT NULL DEFAULT 'ICD-10', description text, diagnosis_date date NOT NULL, status character varying(32) NOT NULL, is_chronic boolean DEFAULT false, PRIMARY KEY (diagnosis_id) )\nCREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL, generic_name character varying(255), manufacturer character varying(100), ndc_code character varying(20) UNIQUE, description text, PRIMARY KEY (medication_id) )\nCREATE TABLE healthcare.insurance_plans ( plan_id character varying(64) NOT NULL, plan_name character varying(200) NOT NULL, insurance_provider character varying(100) NOT NULL, plan_type character varying(50), contact_phone character varying(20), website character varying(255), PRIMARY KEY (plan_id) )\nCREATE TABLE healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, plan_id character varying(64) NOT NULL, policy_number character varying(100) NOT NULL, group_number character varying(100), subscriber_name character varying(200), effective_date date NOT NULL, expiration_date date, is_primary boolean NOT NULL DEFAULT true, PRIMARY KEY (patient_insurance_id), UNIQUE (patient_id, plan_id, policy_number) )\n", "conversations": [{"role": "user", "content": "Which patients have a primary insurance policy and are subscribed to a plan provided by 'Cigna'? List patient ID, full name, policy number, plan ID, and insurance provider."}, {"role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.policy_number, pi.plan_id, ip.insurance_provider\nFROM healthcare.patient_insurance pi\nJOIN healthcare.patients p ON pi.patient_id = p.patient_id\nJOIN healthcare.insurance_plans ip ON pi.plan_id = ip.plan_id\nWHERE pi.is_primary = true AND ip.insurance_provider = 'Cigna';"}, {"role": "user", "content": "Additionally, only show results where the policy has not expired yet."}, {"role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, pi.policy_number, pi.plan_id, ip.insurance_provider\nFROM healthcare.patient_insurance pi\nJOIN healthcare.patients p ON pi.patient_id = p.patient_id\nJOIN healthcare.insurance_plans ip ON pi.plan_id = ip.plan_id\nWHERE pi.is_primary = true AND ip.insurance_provider = 'Cigna' AND (pi.expiration_date IS NULL OR pi.expiration_date >= CURRENT_DATE);"}]}
|
| 248 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, address text, date_registered timestamp, status text )\nCREATE TABLE legal_services.lawyers ( lawyer_id text, first_name text, last_name text, bar_number text, firm_id text, email text, phone text, specialization text, hire_date timestamp, is_partner boolean )\nCREATE TABLE legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, managing_partner_id text )\nCREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, uploaded_by_lawyer_id text, upload_timestamp timestamp, version integer, description text )\nCREATE TABLE legal_services.time_entries ( entry_id text, case_id text, lawyer_id text, date_worked date, hours_spent numeric, billing_rate numeric, description text, is_billable boolean, is_billed boolean, invoice_id text, created_at timestamp )\nCREATE TABLE legal_services.appointments ( appointment_id text, client_id text, lawyer_id text, case_id text, start_time timestamp, end_time timestamp, location text, subject text, notes text, status text, created_at timestamp )\n", "conversations": [{"role": "user", "content": "I need a list showing the name of each law firm and the full name of every lawyer employed by that firm."}, {"role": "assistant", "content": "SELECT T1.firm_name, T2.first_name, T2.last_name FROM law_firms AS T1 JOIN lawyers AS T2 ON T1.firm_id = T2.firm_id;"}]}
|
| 249 |
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address text, city text, state text, zip_code text, country text, email text, phone_number text, created_at timestamp, status text, risk_profile text )\n", "conversations": [{"role": "user", "content": "Show me all customers (customer_id, first_name, last_name, email) who were born after 1985 (date_of_birth > '1985-12-31') and have an email address ending with '@yahoo.com', along with their city and state information."}, {"role": "assistant", "content": "SELECT customer_id, first_name, last_name, email, city, state FROM financial_services.customers WHERE date_of_birth > '1985-12-31' AND email LIKE '%@yahoo.com';"}]}
|
| 250 |
+
{"system": "You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. \n##Table Structure\nCREATE TABLE gaming_technology.game_sessions ( session_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, game_id uuid NOT NULL, server_id uuid, start_time timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, end_time timestamp with time zone, duration_seconds integer, score integer, session_data jsonb, PRIMARY KEY (session_id) )\n", "conversations": [{"role": "user", "content": "I want to list all sessions for player with ID '123e4567-e89b-12d3-a456-426614174000' and display their session start time, end time, and score, along with the game_id and server_id."}, {"role": "assistant", "content": "SELECT session_id, game_id, server_id, start_time, end_time, score\nFROM gaming_technology.game_sessions\nWHERE player_id = '123e4567-e89b-12d3-a456-426614174000';"}, {"role": "user", "content": "Actually, only show sessions where the score is above 200 and order them by score in descending order."}, {"role": "assistant", "content": "SELECT session_id, game_id, server_id, start_time, end_time, score\nFROM gaming_technology.game_sessions\nWHERE player_id = '123e4567-e89b-12d3-a456-426614174000'\n AND score > 200\nORDER BY score DESC;"}]}
|