Dataset Viewer
Auto-converted to Parquet Duplicate
system
stringlengths
315
8.06k
conversations
listlengths
2
48
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. ##Table Structure CREATE TABLE hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, status.text, is_smoking.boolean, features.text, current_condition.text, last_cleaned_at.timestamp ) CREATE TABLE hospitality_technology.staff ( staff_id.text, property_id.text, first_name.text, last_name.text, position.text, work_email.text, work_phone.text, hire_date.date, termination_date.date, is_active.boolean, access_level.integer, manager_id.text, created_at.timestamp ) CREATE TABLE hospitality_technology.services ( service_id.text, property_id.text, service_name.text, description.text, category.text, price.numeric, unit.text, is_available.boolean, department.text ) CREATE TABLE hospitality_technology.reviews ( review_id.text, property_id.text, reservation_id.text, guest_id.text, rating_overall.integer, rating_cleanliness.integer, rating_service.integer, rating_location.integer, rating_value.integer, comment.text, review_source.text, review_date.timestamp, is_public.boolean, staff_response.text, response_staff_id.text, response_date.timestamp )
[ { "role": "user", "content": "How many available services are there per department for each property? Include property_id, department, and the service count.", "sql": null }, { "role": "assistant", "content": "SELECT\n property_id,\n department,\n COUNT(*) AS available_services_count\nFRO...
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. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction account_id character varying(64) NOT NULL, -- account involved in the transaction related_account_id character varying(64), -- counterpart account for transfers transaction_type character varying(50) NOT NULL, -- e.g., Deposit, Withdrawal, Transfer, Payment, Fee, Interest amount numeric(19, 4) NOT NULL, -- transaction amount currency character varying(3) NOT NULL, -- transaction currency transaction_date timestamp NOT NULL, -- exact time of the transaction effective_date date NOT NULL, -- date the transaction affects the balance description text, -- description or memo of the transaction status character varying(32) NOT NULL, -- e.g., Pending, Completed, Failed, Reversed reference_number character varying(128), -- external reference if applicable (e.g., check number) PRIMARY KEY (transaction_id), FOREIGN KEY (account_id) REFERENCES financial_services.accounts(account_id), FOREIGN KEY (related_account_id) REFERENCES financial_services.accounts(account_id) ) CREATE TABLE financial_services.trades ( trade_id.text, account_id.text, security_id.text, order_id.text, trade_type.text, quantity.numeric, price_per_unit.numeric, total_amount.numeric, commission.numeric, trade_timestamp.timestamp, settlement_date.date, status.text, execution_venue.text ) CREATE TABLE financial_services.employees ( employee_id text, first_name text, last_name text, job_title text, department text, branch_id text, email text, phone_extension text, hire_date date, termination_date date, manager_id text, status text )
[ { "role": "user", "content": "How many transactions are there for each status?", "sql": null }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS transaction_count FROM financial_services.transactions GROUP BY status;", "sql": null }, { "role": "user", "content": ...
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. ##Table Structure CREATE 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 )
[ { "role": "user", "content": "Can you show me the number of lawyers grouped by specialization?", "sql": null }, { "role": "assistant", "content": "SELECT specialization, COUNT(*) AS lawyer_count FROM lawyers GROUP BY specialization;", "sql": null }, { "role": "user", "content...
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. ##Table Structure CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNIQUE, phone text, address text, date_registered timestamp, status text )
[ { "role": "user", "content": "Please list the full name and status of clients who have not provided a company name.", "sql": null }, { "role": "assistant", "content": "SELECT first_name, last_name, status\nFROM legal_services.clients\nWHERE company_name IS NULL;", "sql": null }, { ...
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. ##Table Structure CREATE 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 )
[ { "role": "user", "content": "Find all pairs of appointments that are scheduled for the same case and overlap in time. Show the IDs of the two overlapping appointments and the shared case ID.", "sql": null }, { "role": "assistant", "content": "SELECT t1.appointment_id AS appointment1_id, t2....
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. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number text, email text, hospital_affiliation_id text, created_at timestamp, updated_at timestamp ) CREATE 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 ) CREATE 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 ) CREATE TABLE healthcare.medications ( medication_id text, medication_name text, generic_name text, manufacturer text, ndc_code text, description text ) CREATE 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 ) CREATE TABLE healthcare.insurance_plans ( plan_id text, plan_name text, insurance_provider text, plan_type text, contact_phone text, website text ) CREATE 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 )
[ { "role": "user", "content": "Retrieve all unique chief complaints from medical_records.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT chief_complaint\nFROM healthcare.medical_records;", "sql": null }, { "role": "user", "content": "Now show chief complai...
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. ##Table Structure CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text, address_line1 text, address_line2 text, city text, state text, zip_code text, country text, phone_number text, email text, created_at timestamp, updated_at timestamp, status text ) CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, start_date date, end_date date, premium_amount numeric, coverage_limit numeric, deductible numeric, status text, issued_at timestamp, cancellation_date date, cancellation_reason text ) CREATE TABLE insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, description text, estimated_loss numeric, status text, settlement_amount numeric, settlement_date date, claim_handler_id text, police_report_number text ) CREATE TABLE insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, product_type text, description text, base_premium numeric, coverage_details text, underwriting_rules text, is_active boolean, created_at timestamp, updated_at timestamp ) CREATE TABLE insurance.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, license_state text, contact_email text, contact_phone text, hire_date date, termination_date date, status text, commission_rate numeric, manager_id text ) CREATE TABLE insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path text, file_size_bytes int, mime_type text, uploaded_by text, uploaded_at timestamp, description text ) CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id text PRIMARY KEY, policy_id text, customer_id text, first_name text, last_name text, relationship text, percentage_share numeric, contact_info text, added_at timestamp )
[ { "role": "user", "content": "Find the average settlement_amount of closed claims for each claim handler. Return claim_handler_id and avg_settlement_amount.", "sql": null }, { "role": "assistant", "content": "SELECT c.claim_handler_id, AVG(c.settlement_amount) AS avg_settlement_amount\nFROM ...
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. ##Table Structure CREATE TABLE legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address text NOT NULL, phone character varying(32), website character varying(255), founded_date date, managing_partner_id character varying(64), PRIMARY KEY (firm_id) )
[ { "role": "user", "content": "Show me the names, founding dates, and websites of all law firms whose name contains the word 'Legal' and were founded after the year 2005. Sort the results by their founding date.", "sql": null }, { "role": "assistant", "content": "SELECT firm_name, founded_dat...
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. ##Table Structure Use Hashes. Key pattern: 'inv:<inventory_record_id>'. Example: HSET inv:INVREC500 component_id "component:WINGBOLT" quantity 5000 location_warehouse "WH3" batch_number "BCH778899" ... Consider Sorted Set by expiry date: ZADD component_expiry:<component_id> <expiry_timestamp> <inventory_record_id>.
[ { "role": "user", "content": "Can you help me fetch the inventory records for components stored in a specific warehouse, along with their expiry dates?", "sql": null }, { "role": "assistant", "content": "HGETALL inv:<inventory_record_id>\nZRANGE component_expiry:<component_id> 0 -1 WITHSCORE...
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. ##Table Structure CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character varying(64) NOT NULL, driver_id character varying(64) NOT NULL, scheduled_departure timestamp with time zone NOT NULL, actual_departure timestamp with time zone, scheduled_arrival timestamp with time zone NOT NULL, actual_arrival timestamp with time zone, origin_location_id character varying(64) NOT NULL, destination_location_id character varying(64) NOT NULL, status character varying(32) NOT NULL, passenger_count integer, cargo_manifest_id character varying(64), PRIMARY KEY (trip_id) )
[ { "role": "user", "content": "Show me pairs of trip IDs that used the same vehicle.", "sql": null }, { "role": "assistant", "content": "SELECT\n t1.trip_id AS trip1_id,\n t2.trip_id AS trip2_id\nFROM transportation.trips AS t1\nJOIN transportation.trips AS t2\n ON t1.vehicle_id = t2.vehic...
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. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id text PRIMARY KEY, account_id text, related_account_id text, transaction_type text, amount numeric, currency text, transaction_date timestamp, effective_date date, description text, status text, reference_number text )
[ { "role": "user", "content": "Show me all transactions along with the related account IDs where the transaction type is 'Transfer'.", "sql": null }, { "role": "assistant", "content": "SELECT transaction_id, account_id, related_account_id, transaction_type, amount, currency, transaction_date,...
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. ##Table Structure CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, description.text, estimated_loss.numeric, status.text, settlement_amount.numeric, settlement_date.date, claim_handler_id.text, police_report_number.text )
[ { "role": "user", "content": "List the claim ID, incident date, estimated loss, and the first and last name of the customer for all claims with an estimated loss greater than 5000.", "sql": null }, { "role": "assistant", "content": "SELECT T1.claim_id, T1.incident_date, T1.estimated_loss, T2...
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. ##Table Structure CREATE TABLE smart_money_token_performance ( token_address text, token_symbol text, pnl numeric, net_flow numeric, avg_cost numeric, price numeric, realized_ratio numeric, roi numeric, chain text )
[ { "role": "user", "content": "For each chain, which token symbol has the highest pnl and what are its roi and avg_cost?", "sql": null }, { "role": "assistant", "content": "SELECT t.chain, t.token_symbol, t.pnl, t.roi, t.avg_cost\nFROM smart_money_token_performance t\nINNER JOIN (\n SELECT c...
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. ##Table Structure CREATE TABLE manufacturing.components ( component_id character varying(64) NOT NULL, -- unique identifier for the component part_number character varying(100) NOT NULL UNIQUE, -- manufacturer-specific part number component_name character varying(255) NOT NULL, -- descriptive name (e.g., Landing Gear Strut, Wing Spar) description text, -- detailed description material_id character varying(64), -- FK linking to the material used supplier_id character varying(64), -- FK linking to the supplier weight_kg numeric(10,3), -- weight of the component in kg cost_usd numeric(12,2), -- cost of the component in USD criticality_level character varying(20), -- e.g., 'High', 'Medium', 'Low' PRIMARY KEY (component_id) ) CREATE TABLE manufacturing.materials ( material_id character varying(64) NOT NULL, -- unique identifier for the material material_name character varying(128) NOT NULL, -- common name (e.g., Titanium Alloy Grade 5, Carbon Fiber Prepreg) specification character varying(255), -- specification standard (e.g., AMS 4928) description text, -- detailed description of properties density_kg_m3 numeric(10, 4), -- density in kg per cubic meter tensile_strength_mpa integer, -- tensile strength in Megapascals PRIMARY KEY (material_id) ) CREATE TABLE manufacturing.assembly_lines ( line_id character varying(64) NOT NULL, -- unique identifier for the assembly line line_name character varying(128) NOT NULL, -- name of the line (e.g., Fuselage Assembly Line 1) location_building character varying(100), -- building where the line is located location_area character varying(100), -- specific area within the building aircraft_model_id character varying(64), -- FK to the primary aircraft model built on this line capacity_units_per_month integer, -- theoretical maximum output per month status character varying(50) NOT NULL, -- e.g., 'Active', 'Maintenance', 'Idle' PRIMARY KEY (line_id) ) CREATE TABLE manufacturing.component_inventory ( inventory_record_id character varying(64) NOT NULL, -- unique ID for this inventory record/batch component_id character varying(64) NOT NULL, -- FK to the component quantity integer NOT NULL, -- number of units of this component in stock for this batch location_warehouse character varying(100), -- warehouse identifier location_bin character varying(100), -- specific bin or shelf location received_date timestamp NOT NULL, -- when this batch was received expiry_date date, -- expiry date if applicable (e.g., for sealants, adhesives) batch_number character varying(100), -- supplier batch number last_updated timestamp NOT NULL, -- timestamp of the last update to this record PRIMARY KEY (inventory_record_id) )
[ { "role": "user", "content": "我想查询所有使用特定材料ID的组件信息,包括组件名称、零件编号和供应商ID,同时还需要获取该材料的名称和规格。", "sql": null }, { "role": "assistant", "content": "SELECT c.component_id, c.component_name, c.part_number, c.supplier_id, m.material_name, m.specification\nFROM manufacturing.components c\nJOIN manufacturi...
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. ##Table Structure CREATE TABLE insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state.text, contact_email.text, contact_phone.text, hire_date.date, termination_date.date, status.text, commission_rate.numeric, manager_id.text )
[ { "role": "user", "content": "I want to retrieve the agent ID, first and last name, along with their manager's contact email and phone number.", "sql": null }, { "role": "assistant", "content": "SELECT a.agent_id,\n a.first_name || ' ' || a.last_name AS agent_name,\n m.contact_em...
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. ##Table Structure CREATE TABLE trading_platform.assets ( asset_id character varying(64) NOT NULL, -- unique identifier for the asset name character varying(128) NOT NULL, -- name of the asset symbol character varying(32) NOT NULL, -- symbol of the asset type character varying(32) NOT NULL, -- type of the asset (e.g., cryptocurrency, stock) PRIMARY KEY (asset_id) ) CREATE TABLE trading_platform.dapps ( dapp_id.text, name.text, description.text, url.text )
[ { "role": "user", "content": "Give me the list of DApp names and URLs whose description contains any asset symbol from the assets table.", "sql": null }, { "role": "assistant", "content": "SELECT DISTINCT d.name, d.url\nFROM trading_platform.dapps d\nJOIN trading_platform.assets a ON d.descr...
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. ##Table Structure CREATE 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 )
[ { "role": "user", "content": "Show me the total fuel cost for each vehicle, grouped by fuel type.", "sql": null }, { "role": "assistant", "content": "SELECT vehicle_id, fuel_type, SUM(total_cost) AS total_fuel_cost FROM transportation.fuel_logs GROUP BY vehicle_id, fuel_type;", "sql": nu...
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. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth.date, gender.text, primary_address.text, contact_email.text, contact_phone.text, registration_date.timestamp, is_verified.boolean ) CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, main_phone_number.text, website_url.text, established_date.date, parent_agency_id.text ) CREATE TABLE government_services.applications ( application_id.text, citizen_id.text, service_id.text, submitted_at.timestamp, status.text, last_updated_at.timestamp, assigned_employee_id.text, decision_date.date, notes.text, reference_number.text ) CREATE 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 ) CREATE TABLE government_services.payments ( payment_id.text, application_id.text, citizen_id.text, service_id.text, amount.numeric, currency.text, payment_method.text, payment_provider_reference.text, payment_timestamp.timestamp, status.text, notes.text ) CREATE TABLE government_services.employees ( employee_id.text, agency_id.text, first_name.text, last_name.text, job_title.text, department.text, work_email.text, work_phone.text, hire_date.date, termination_date.date, access_level.text, manager_employee_id.text ) CREATE TABLE government_services.service_locations ( location_id.text, agency_id.text, location_name.text, address.text, city.text, state.text, postal_code.text, latitude.numeric, longitude.numeric, operating_hours.text, contact_phone.text, is_accessible.boolean ) CREATE TABLE government_services.notifications ( notification_id.text, citizen_id.text, application_id.text, message_subject.text, message_body.text, channel.text, sent_at.timestamp, status.text, related_entity_type.text, related_entity_id.text )
[ { "role": "user", "content": "List the citizen ID, full name, and registration date for all unverified citizens who registered in the year 2022.", "sql": null }, { "role": "assistant", "content": "SELECT citizen_id, first_name, last_name, registration_date FROM government_services.citizens W...
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. ##Table Structure CREATE TABLE legal_services.cases ( case_id character varying(64) NOT NULL, -- unique identifier for the case/matter case_number character varying(100) UNIQUE, -- official case number (court or internal) case_name text NOT NULL, -- descriptive name or title for the case client_id character varying(64) NOT NULL, -- FK to clients table lead_lawyer_id character varying(64) NOT NULL, -- FK to lawyers table (primary lawyer responsible) case_type character varying(100) NOT NULL, -- e.g., Litigation, Corporate, Family Law, IP status character varying(50) NOT NULL, -- e.g., Open, Closed, Pending, On Hold, Appealed date_opened timestamp NOT NULL, -- date the case was formally opened date_closed timestamp, -- date the case was closed (nullable) description text, -- detailed description of the case court_jurisdiction character varying(128), -- court or jurisdiction if applicable PRIMARY KEY (case_id) ) CREATE TABLE legal_services.time_entries ( entry_id text PRIMARY KEY, case_id text, lawyer_id text, date_worked date, hours_spent numeric, billing_rate numeric, description text, is_billable bool, is_billed bool, invoice_id text, created_at timestamp ) CREATE 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 )
[ { "role": "user", "content": "Show me the total hours spent by each lawyer for each case, along with the case number and lawyer ID.", "sql": null }, { "role": "assistant", "content": "SELECT t.case_id, c.case_number, t.lawyer_id, SUM(t.hours_spent) AS total_hours\nFROM legal_services.time_en...
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. ##Table Structure CREATE TABLE government_services.service_locations ( location_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, location_name character varying(200), address text NOT NULL, city character varying(100), state character varying(50), postal_code character varying(20), latitude numeric(9, 6), longitude numeric(9, 6), operating_hours text, contact_phone character varying(32), is_accessible boolean, PRIMARY KEY (location_id) ) CREATE TABLE government_services.appointments ( appointment_id character varying(64) NOT NULL, citizen_id character varying(64) NOT NULL, employee_id character varying(64), location_id character varying(64), service_id character varying(64), scheduled_start_time timestamp NOT NULL, scheduled_end_time timestamp, purpose text NOT NULL, status character varying(30) NOT NULL, booking_method character varying(50), created_at timestamp NOT NULL, notes text, PRIMARY KEY (appointment_id) )
[ { "role": "user", "content": "I want to know the total number of appointments per location along with the location name for appointments scheduled in March 2024.", "sql": null }, { "role": "assistant", "content": "SELECT\n sl.location_name,\n COUNT(a.appointment_id) AS appointment_count\nF...
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. ##Table Structure CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, achievement_id uuid NOT NULL, unlocked_at timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (player_achievement_id), UNIQUE (player_id, achievement_id) )
[ { "role": "user", "content": "Show me how many achievements each player has unlocked.", "sql": null }, { "role": "assistant", "content": "SELECT player_id,\n COUNT(*) AS total_unlocked\nFROM gaming_technology.player_achievements\nGROUP BY player_id;", "sql": null }, { "role...
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. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id text, invoice_number text, client_id text, case_id text, issue_date date, due_date date, total_amount numeric, amount_paid numeric, status text, payment_date timestamp, notes text, created_at timestamp )
[ { "role": "user", "content": "Which invoices were issued in March 2024, and what are their invoice numbers, total amounts, and due dates?", "sql": null }, { "role": "assistant", "content": "SELECT invoice_number, total_amount, due_date FROM legal_services.invoices WHERE issue_date >= '2024-0...
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. ##Table Structure CREATE TABLE transportation.trips ( trip_id text PRIMARY KEY, route_id text, vehicle_id text, driver_id text, scheduled_departure timestamp, actual_departure timestamp, scheduled_arrival timestamp, actual_arrival timestamp, origin_location_id text, destination_location_id text, status text, passenger_count int, cargo_manifest_id text )
[ { "role": "user", "content": "Give me all trips where the trip status is 'Completed' with their trip ID, vehicle ID, and number of passengers.", "sql": null }, { "role": "assistant", "content": "SELECT trip_id, vehicle_id, passenger_count FROM transportation.trips WHERE status = 'Completed';...
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. ##Table Structure CREATE TABLE government_services.notifications ( notification_id text PRIMARY KEY, citizen_id text, application_id text, message_subject text, message_body text, channel text, sent_at timestamp, status text, related_entity_type text, related_entity_id text )
[ { "role": "user", "content": "Find application IDs that have received notifications with both a 'Sent' status and a 'Failed' status.", "sql": null }, { "role": "assistant", "content": "SELECT application_id FROM government_services.notifications WHERE status IN ('Sent', 'Failed') GROUP BY ap...
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. ##Table Structure // Use Hashes for platform details. Key format: platform:<platform_id> // HSET platform:plat_123 platform_id "plat_123" station_id "station_xyz" platform_number "1A" track_number "T1" status "Operational" length_meters 250.50 accessible 1 // To link platforms to stations (optional): // SADD station:station_xyz:platforms platform:plat_123 platform:plat_456 // Use Hashes for train details. Key format: train:<train_id> // HSET train:train_789 train_id "train_789" train_number "Acela 2151" model "Siemens Velaro" ... status "Active" ... // To find train by train_number (optional index): // SET train_number:"Acela 2151" train:train_789 // Use Hashes for car details. Key format: car:<car_id> // HSET car:car_abc car_id "car_abc" train_id "train_789" car_number "C3" car_type "Passenger" class "Business" capacity 60 features "WiFi,Power Outlet" // To link cars to trains (optional): // SADD train:train_789:cars car:car_abc car:car_def // Use Hashes for details. Key format: route_station:<route_station_id> // HSET route_station:rs_ne_1 route_station_id "rs_ne_1" route_id "route_ne_corr" station_id "station_bos" sequence_order 1 ... // To find stops for a route, use a Sorted Set (score by sequence_order): // ZADD route:route_ne_corr:stops 1 route_station:rs_ne_1 // ZADD route:route_ne_corr:stops 2 route_station:rs_ne_2 // Use Hashes for schedule details. Key format: schedule:<schedule_id> // HSET schedule:sched_1122 schedule_id "sched_1122" train_id "train_789" route_id "route_ne_corr" departure_datetime "2024-05-10T08:00:00-04:00" ... status "Scheduled" // Use Hashes for details. Key format: schedule_stop:<stop_id> // HSET schedule_stop:stop_sched1122_1 stop_id "stop_sched1122_1" schedule_id "sched_1122" station_id "station_bos" ... // To find stops for a schedule, use a Sorted Set (score by sequence_order): // ZADD schedule:sched_1122:stops 1 schedule_stop:stop_sched1122_1 // ZADD schedule:sched_1122:stops 2 schedule_stop:stop_sched1122_2 // Use Hashes for passenger details. Key format: passenger:<passenger_id> // HSET passenger:pass_pqr passenger_id "pass_pqr" first_name "Alice" last_name "Smith" email "alice.smith@example.com" ... // To find passenger by email (optional index): // SET passenger_email:"alice.smith@example.com" passenger:pass_pqr // Use Hashes for booking details. Key format: booking:<booking_id> // HSET booking:book_zyx booking_id "book_zyx" passenger_id "pass_pqr" schedule_id "sched_1122" ... status "Confirmed" ... // To link bookings to passengers/schedules (optional): // SADD passenger:pass_pqr:bookings booking:book_zyx // SADD schedule:sched_1122:bookings booking:book_zyx // Use Hashes for ticket details. Key format: ticket:<ticket_id> // HSET ticket:tkt_1a2b ticket_id "tkt_1a2b" booking_id "book_zyx" car_id "car_abc" seat_number "12A" ... is_checked_in 0 ... // To link tickets to bookings (optional): // SADD booking:book_zyx:tickets ticket:tkt_1a2b // Use Hashes for staff details. Key format: staff:<staff_id> // HSET staff:staff_mno staff_id "staff_mno" first_name "Bob" ... employee_number "E12345" ... is_active 1 // To find staff by employee number (optional index): // SET staff_employee_number:"E12345" staff:staff_mno // Use Hashes for maintenance record details. Key format: maintenance_record:<record_id> // HSET maintenance_record:maint_rec_001 record_id "maint_rec_001" asset_id "train_789" asset_type "Train" ... status "Completed" // To link records to assets (optional): // SADD train:train_789:maintenance maintenance_record:maint_rec_001 // SADD platform:plat_123:maintenance maintenance_record:maint_rec_002
[ { "role": "user", "content": "Can you help me retrieve the details of all schedules for a specific train with train_id 'train_789', including the route and stops information?", "sql": null }, { "role": "assistant", "content": "HGETALL train:train_789\nSMEMBERS schedule:sched_*:train:train_78...
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. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NOT NULL, address_line1 character varying(255) NOT NULL, address_line2 character varying(255), city character varying(100) NOT NULL, state_province character varying(100), postal_code character varying(20) NOT NULL, country_code character varying(3) NOT NULL, phone_number character varying(30), email_address character varying(255), property_type character varying(50) NOT NULL, star_rating numeric(2,1), timezone character varying(64) NOT NULL, manager_staff_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 (property_id) ) CREATE TABLE hospitality_technology.reservations ( reservation_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, guest_id character varying(64) NOT NULL, room_id character varying(64), room_type_id character varying(64) NOT NULL, check_in_date date NOT NULL, check_out_date date NOT NULL, actual_check_in_ts timestamp with time zone, actual_check_out_ts timestamp with time zone, num_adults integer NOT NULL, num_children integer DEFAULT 0, status character varying(50) NOT NULL, booking_source character varying(100), rate_plan_id character varying(64), total_amount numeric(12, 2), amount_paid numeric(12, 2) DEFAULT 0.00, special_requests text, created_at timestamp with time zone NOT NULL DEFAULT current_timestamp, updated_at timestamp with time zone NOT NULL DEFAULT current_timestamp, PRIMARY KEY (reservation_id), FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id), FOREIGN KEY (guest_id) REFERENCES hospitality_technology.guests(guest_id), FOREIGN KEY (room_id) REFERENCES hospitality_technology.rooms(room_id), FOREIGN KEY (room_type_id) REFERENCES hospitality_technology.room_types(room_type_id) ) CREATE TABLE hospitality_technology.staff ( staff_id text PRIMARY KEY, property_id text, first_name text, last_name text, position text, work_email text, work_phone text, hire_date date, termination_date date, is_active boolean, access_level int, manager_id text, created_at timestamp ) CREATE TABLE hospitality_technology.services ( service_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, service_name character varying(150) NOT NULL, description text, category character varying(100), price numeric(10, 2) NOT NULL, unit character varying(30), is_available boolean NOT NULL DEFAULT true, department character varying(100), PRIMARY KEY (service_id), FOREIGN KEY (property_id) REFERENCES hospitality_technology.properties(property_id) ) CREATE TABLE hospitality_technology.service_orders ( order_id text PRIMARY KEY, reservation_id text, guest_id text, service_id text, staff_id_ordered text, staff_id_delivered text, order_timestamp timestamp, delivery_timestamp timestamp, quantity int, unit_price numeric, total_price numeric, status text, notes text, bill_id text )
[ { "role": "user", "content": "List all services along with the count of service orders for each service and the corresponding property name.", "sql": null }, { "role": "assistant", "content": "SELECT s.service_id, s.service_name, p.property_name, COUNT(so.order_id) AS order_count\nFROM hospi...
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. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer token_id character varying(64) NOT NULL, -- identifier of the token being transferred from_address character varying(128) NOT NULL, -- address of the sender to_address character varying(128) NOT NULL, -- address of the receiver value numeric(38,14) NOT NULL, -- amount of tokens transferred transaction_id character varying(64) NOT NULL, -- identifier of the transaction containing the transfer log_index integer NOT NULL, -- index of the transfer log in the transaction PRIMARY KEY (transfer_id) )
[ { "role": "user", "content": "Find cases where an address received tokens in one transfer and then sent tokens in another. List the receive transfer_id, the send transfer_id, the address, and both transfer values.", "sql": null }, { "role": "assistant", "content": "SELECT recv.transfer_id AS...
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
4