conversations
listlengths
2
8
system
stringlengths
288
8.08k
[ { "role": "user", "content": "Which claims have at least one document uploaded by an agent located in 'NY'? Show the claim_id, document_type, file_name, uploaded_by, and the agent's first and last name." }, { "role": "assistant", "content": "SELECT cd.claim_id, cd.document_type, cd.file_name, cd...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "List all clients along with their case_number and case_type for cases that are currently 'Open'." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, c.email, cs.case_number, cs.case_type\nFROM legal_services.clients AS c\nJOIN legal_services.cas...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "What are the specific tools or equipment used during the maintenance with record_id 'REC456'?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information about the specific tools or equipment used during a maintenance record. The data in the ma...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.m...
[ { "role": "user", "content": "Show the total number of reservations for each booking source." }, { "role": "assistant", "content": "SELECT booking_source, COUNT(*) FROM hospitality_technology.reservations GROUP BY booking_source" }, { "role": "user", "content": "Also include the tota...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "Show me all medical records where the chief complaint contains 'fever' and include the patient_id, record_date, and assessment details." }, { "role": "assistant", "content": "SELECT patient_id, record_date, assessment FROM healthcare.medical_records WHERE chief_comp...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id.text, patient_id.text, appointment_id.text, doctor_id.text, record_date.timestam...
[ { "role": "user", "content": "Show me all active customers created in the last 30 days." }, { "role": "assistant", "content": "SELECT *\nFROM financial_services.customers\nWHERE status = 'Active'\n AND created_at >= CURRENT_DATE - INTERVAL '30 days';" }, { "role": "user", "content":...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id character varying(64) NOT NULL, -- unique identifier for the customer ...
[ { "role": "user", "content": "Retrieve all public posts that have geolocation coordinates specified, showing post_id, user_id, location_lat, location_lon, ordered by created_at descending." }, { "role": "assistant", "content": "SELECT post_id, user_id, location_lat, location_lon\nFROM social_med...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "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." }, { "role": "assistant", "content": "SELECT recv.transfer_id AS receive_transfer...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer token...
[ { "role": "user", "content": "Which document_name has the highest number of versions? Return the document_name and the number of versions." }, { "role": "assistant", "content": "SELECT document_name,\n COUNT(*) AS version_count\nFROM legal_services.documents\nGROUP BY document_name\nORDER ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u...
[ { "role": "user", "content": "Which users have received both a comment notification and a like notification? List the recipient_user_id and the total number of such users." }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT recipient_user_id) AS user_count\nFROM (\n SELECT recipient_us...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.likes ( like_id character varying(64) NOT NULL, -- unique identifier for the like user_id characte...
[ { "role": "user", "content": "Find the total number of documents uploaded by each citizen along with their first and last names." }, { "role": "assistant", "content": "SELECT c.citizen_id, c.first_name, c.last_name, COUNT(d.document_id) AS document_count\nFROM government_services.citizens c\nLEF...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "For each patient, find the next appointment after each one. Return patient_id, appointment_id AS current_appointment, next_appointment_id, and waiting_time in minutes." }, { "role": "assistant", "content": "SELECT a.patient_id,\n a.appointment_id AS current_ap...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi...
[ { "role": "user", "content": "Show me the top 5 most recent medical records with a fever recorded. Return record_id, patient_id, record_date, and the temperature value from vitals." }, { "role": "assistant", "content": "SELECT record_id,\n patient_id,\n record_date,\n vitals->>...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "List all ERC20 tokens where the price is between $1 and $10, including their names, symbols, and contract addresses." }, { "role": "assistant", "content": "SELECT tm.name, tm.symbol, tm.contract_address FROM token_metas tm JOIN token_prices_latest tpl ON tm.contract...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "Show me the top 10 token transfers by value, including the token ID and the transaction ID, sorted in descending order." }, { "role": "assistant", "content": "SELECT token_id, transaction_id, value FROM web3.token_transfers ORDER BY value DESC LIMIT 10;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address text, to_address text, value numeric, ...
[ { "role": "user", "content": "Which managers supervise employees in more than one department? Show the manager's first and last name and the distinct departments." }, { "role": "assistant", "content": "SELECT m.first_name AS manager_first_name, m.last_name AS manager_last_name, COUNT(DISTINCT e....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.employees ( employee_id.text, agency_id.text, first_name.text, last_name.text, job_title.text, depa...
[ { "role": "user", "content": "Find all users who registered with a Yahoo email address, along with their registration dates." }, { "role": "assistant", "content": "SELECT user_id, username, email, password_hash FROM blockchain.users WHERE email LIKE '%@yahoo.com';" }, { "role": "user", ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic...
[ { "role": "user", "content": "List all CEX addresses on the BSC chain that hold more than $1 million USD value in total." }, { "role": "assistant", "content": "SELECT address, SUM(usd_value) AS total_usd_value FROM cex_token_balance WHERE chain = 'BSC' GROUP BY address HAVING SUM(usd_value) > 10...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure "CREATE TABLE cex_token_balance (", "snapshot_time character varying(32) NOT NULL, -- the snapshot time of record, converted ...
[ { "role": "user", "content": "What are the training programs or certifications completed by a staff member with the role of Platform Supervisor?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to information about the training programs or certifications completed by sta...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.s...
[ { "role": "user", "content": "Show me each service order along with the next order placed by the same guest, including both order IDs and the time difference in minutes between the two orders." }, { "role": "assistant", "content": "SELECT a.order_id,\n b.order_id AS next_order_id,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.service_orders ( order_id.text, reservation_id.text, guest_id.text, service_id.text, staff_id_or...
[ { "role": "user", "content": "List the first and last name of each citizen along with the city and state of the service location for their agency." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, sl.city, sl.state\nFROM government_services.citizens c\nJOIN government_serv...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "List all claim IDs that have both an 'Accident Report' and a 'Damage Assessment' document, and show the earliest upload timestamp for each type." }, { "role": "assistant", "content": "SELECT a.claim_id,\n MIN(a.uploaded_at) AS accident_report_date,\n MIN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id.text, claim_id.text, document_type.text, file_name.text, file_path.text, file_s...
[ { "role": "user", "content": "Show me each product_type along with the count of products for that type, but only include types where the average base_premium exceeds 500. Order the results by the product count in descending order." }, { "role": "assistant", "content": "SELECT product_type,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "Show me all active insurance products with a base premium less than $200, sorted by product type." }, { "role": "assistant", "content": "SELECT * FROM insurance.insurance_products WHERE is_active = true AND base_premium < 200 ORDER BY product_type;" }, { "ro...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "Identify all sender addresses that have transferred tokens in more than 3 distinct transactions. Return from_address and transfer_count, ordered by transfer_count descending." }, { "role": "assistant", "content": "SELECT\n from_address,\n COUNT(DISTINCT transactio...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.transactions ( transaction_id character varying(64) NOT NULL, from_address character varying(128) NOT NULL, to_add...
[ { "role": "user", "content": "Provide the route_number, description, origin location name, and destination location name for all routes of type 'Express'." }, { "role": "assistant", "content": "SELECT r.route_number,\n r.description,\n o.name AS origin_name,\n d.name AS destina...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f...
[ { "role": "user", "content": "Retrieve each agent's ID, full name, and the count of 'Pending' policies they have sold with a premium_amount greater than 2000. Order the results by the policy count descending." }, { "role": "assistant", "content": "SELECT a.agent_id,\n a.first_name || ' ' |...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d...
[ { "role": "user", "content": "List the usernames and user IDs of all users whose bio contains the word 'developer'." }, { "role": "assistant", "content": "SELECT user_id, username\nFROM social_media.users\nWHERE bio ILIKE '%developer%';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "List the first_name, last_name, and email of all clients whose email domain is 'gmail.com'." }, { "role": "assistant", "content": "SELECT first_name, last_name, email FROM legal_services.clients WHERE SUBSTRING(email FROM POSITION('@' IN email) + 1) = 'gmail.com';" ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad...
[ { "role": "user", "content": "List every diagnosis description paired with every insurance plan's website." }, { "role": "assistant", "content": "SELECT T1.description, T2.website FROM healthcare.diagnoses AS T1 CROSS JOIN healthcare.insurance_plans AS T2;" }, { "role": "user", "cont...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_i...
[ { "role": "user", "content": "Get the number of direct reports for each manager, showing manager_id and report_count." }, { "role": "assistant", "content": "SELECT manager_id,\n COUNT(*) AS report_count\nFROM hospitality_technology.staff\nWHERE manager_id IS NOT NULL\nGROUP BY manager_id;"...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, fir...
[ { "role": "user", "content": "What is the detailed repair history of the equipment used by the staff with staff_id 'STAFF123' during maintenance tasks?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the detailed repair history of equipment used by staff memb...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.m...
[ { "role": "user", "content": "Could you show me each employee's full name along with their manager's full name?" }, { "role": "assistant", "content": "SELECT e.employee_id,\n e.first_name || ' ' || e.last_name AS employee_name,\n m.employee_id AS manager_id,\n m.first_name || '...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.employees ( employee_id character varying(64) NOT NULL, -- unique identifier for the government...
[ { "role": "user", "content": "Show me the latest price and symbol for all tokens listed in the token_prices_latest table." }, { "role": "assistant", "content": "SELECT symbol, price FROM token_prices_latest;" }, { "role": "user", "content": "Filter that to only show tokens on the 'bi...
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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, t...
[ { "role": "user", "content": "Show me all room types with their property IDs and amenities where the description includes 'ocean view'." }, { "role": "assistant", "content": "SELECT room_type_id, property_id, amenities FROM hospitality_technology.room_types WHERE description LIKE '%ocean view%';...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, property_id character varying(64) NOT ...
[ { "role": "user", "content": "Find all pairs of lawyers from the same firm who have the same specialization." }, { "role": "assistant", "content": "SELECT a.lawyer_id AS lawyer_id_1, a.first_name AS first_name_1, a.last_name AS last_name_1, b.lawyer_id AS lawyer_id_2, b.first_name AS first_name_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t...
[ { "role": "user", "content": "List the product ID, name, and creation date for all insurance products created in 2024." }, { "role": "assistant", "content": "SELECT product_id, product_name, created_at\nFROM insurance.insurance_products\nWHERE created_at >= '2024-01-01' AND created_at < '2025-01...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, -- unique identifier for the insurance pr...
[ { "role": "user", "content": "Show all SUI coins with 'exists' status and more than 8 decimal places. Display coin_type, symbol, name, and decimals." }, { "role": "assistant", "content": "SELECT coin_type, symbol, name, decimals\nFROM sui_coins_metadata\nWHERE status = 'exists' AND decimals > 8;...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE nft_holders ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, token_i...
[ { "role": "user", "content": "List the full names and dates of birth for all patients who do not have a phone number on record." }, { "role": "assistant", "content": "SELECT first_name, last_name, date_of_birth FROM healthcare.patients WHERE phone_number IS NULL OR TRIM(phone_number) = '';" } ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "List the top 5 tokens by 24 hour trading volume on DEX pools." }, { "role": "assistant", "content": "SELECT token_name, token_symbol, volume_24h \nFROM token_dexpool_info \nORDER BY volume_24h DESC LIMIT 5;" }, { "role": "user", "content": "Show only the...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure "CREATE TABLE project_fundraising_record (", "id character varying(32) NOT NULL, -- fundraising record id", "project_id ch...
[ { "role": "user", "content": "List the ERC20 tokens (from token_metas) with exactly 6 decimals. Show their symbol, contract_address, and name." }, { "role": "assistant", "content": "SELECT symbol, contract_address, name FROM token_metas WHERE is_erc20 = 1 AND decimals = 6;" }, { "role": ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "Show me the total transaction amount sent by each sender address, along with their current balance from the addresses table." }, { "role": "assistant", "content": "SELECT t.sender_address, SUM(t.amount) AS total_sent, a.balance FROM blockchain.transactions t JOIN bl...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text...
[ { "role": "user", "content": "Show me the earliest unlock date for each achievement along with the player_id who unlocked it." }, { "role": "assistant", "content": "SELECT achievement_id, player_id, MIN(unlocked_at) AS earliest_unlock FROM gaming_technology.player_achievements GROUP BY achieveme...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.player_achievements ( player_achievement_id.uuid, player_id.uuid, achievement_id.uuid, unlocked_at.ti...
[ { "role": "user", "content": "For each vehicle, list its vehicle_id, license_plate, and any older vehicle of the same type (showing older_vehicle_id and older year)." }, { "role": "assistant", "content": "SELECT cur.vehicle_id,\n cur.license_plate,\n old.vehicle_id AS older_vehicle_i...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "For each asset, calculate the total quantity and average price of orders that have status 'filled'." }, { "role": "assistant", "content": "SELECT o.asset_id,\n SUM(o.quantity) AS total_quantity,\n AVG(o.price) AS average_price\nFROM trading_platform....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet user_...
[ { "role": "user", "content": "Show all rooms that are on floor 3." }, { "role": "assistant", "content": "SELECT room_id, property_id, room_number FROM hospitality_technology.rooms WHERE floor = 3;" }, { "role": "user", "content": "For these rooms, include the property name and room n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "Find all pairs of transactions that occurred in the same block and were sent to the same address. Show both transaction IDs, the shared recipient address, and the block number." }, { "role": "assistant", "content": "SELECT t1.transaction_id AS tx1,\n t2.transa...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price...
[ { "role": "user", "content": "Show me all wallet addresses that belong to user_id 'U1001', along with their private keys." }, { "role": "assistant", "content": "SELECT address_id, private_key FROM blockchain.wallets WHERE user_id = 'U1001';" }, { "role": "user", "content": "Now join ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.wallets ( wallet_id text, user_id text, address_id text, private_key text )
[ { "role": "user", "content": "Find all medical records where the vitals JSON field contains a blood pressure reading with systolic higher than 140, and show the patient_id, record_date, and vitals." }, { "role": "assistant", "content": "SELECT patient_id, record_date, vitals FROM healthcare.medi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "What are the safety ratings or crash statistics for the Boeing 787 Dreamliner?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to safety ratings or crash statistics for specific aircraft models like the Boeing 787 Dreamliner. My data is lim...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE manufacturing.aircraft_mod...
[ { "role": "user", "content": "Show smart money addresses with an ROI greater than 3 and a realized ratio greater than 0.7. Display the address, chain, ROI, realized ratio, and most profitable token." }, { "role": "assistant", "content": "SELECT address, chain, roi, realized_ratio, most_profit_to...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure "CREATE TABLE cex_token_balance (", "snapshot_time character varying(32) NOT NULL, -- the snapshot time of record, converted ...
[ { "role": "user", "content": "What is the schedule of trains arriving at platform 1A at station XYZ on December 25th, 2023?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information about train schedules or specific arrival times as this data is not included in the platfo...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.p...
[ { "role": "user", "content": "List all agencies that do not have a website URL specified. Return their agency_id, agency_name, and main_phone_number." }, { "role": "assistant", "content": "SELECT agency_id, agency_name, main_phone_number FROM government_services.agencies WHERE website_url IS NUL...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j...
[ { "role": "user", "content": "Could you produce a summary report listing each security's ticker_symbol, exchange, average close_price, and average volume based on market_data?" }, { "role": "assistant", "content": "SELECT s.ticker_symbol, s.exchange, AVG(m.close_price) AS avg_close_price, AVG(m....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id character varying(64) NOT NULL, account_id character varying(64) NOT N...
[ { "role": "user", "content": "Show the route number and description for routes that have bookings associated with them." }, { "role": "assistant", "content": "SELECT DISTINCT T1.route_number, T1.description FROM transportation.routes AS T1 JOIN transportation.bookings AS T2 ON T1.route_id = T2.t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "Show me the top 5 narratives by market cap, along with their 24-hour trading volume and 7-day price change percentage." }, { "role": "assistant", "content": "SELECT narrative.text, volume_24h.numeric, price_change_percentage_7d.numeric FROM narrative_info ORDER BY m...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume...
[ { "role": "user", "content": "I need a report showing each passenger's total number of bookings and the date of their most recent booking." }, { "role": "assistant", "content": "SELECT b.passenger_id,\n COUNT(*) AS total_bookings,\n MAX(b.booking_time) AS last_booking_date\nFROM tran...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id character varying(64) NOT NULL, route_number character varying(32) NOT NULL UNIQUE, de...
[ { "role": "user", "content": "Which route numbers connect locations with a distance less than 80 km and more than 5 words in their description? Include the route type in the results." }, { "role": "assistant", "content": "SELECT route_number, type FROM transportation.routes WHERE distance_km < 8...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati...
[ { "role": "user", "content": "Find the contract address and name for all NFT collections listed on the 'Ethereum' blockchain." }, { "role": "assistant", "content": "SELECT contract_address, name FROM nft_collections WHERE blockchain = 'Ethereum'" }, { "role": "user", "content": "For ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t...
[ { "role": "user", "content": "Find all pairs of overlapping reservations for the same room. Show the two reservation IDs, room_id, and both reservations' check-in and check-out dates." }, { "role": "assistant", "content": "SELECT r1.reservation_id AS reservation1_id, r2.reservation_id AS reserva...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ...
[ { "role": "user", "content": "Show me the usernames of all players who own at least one item with a quantity above 20, and for each player include the total number of such inventory records they have." }, { "role": "assistant", "content": "SELECT p.username, COUNT(pi.inventory_id) AS inventory_c...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "Find all wallets created by users in the last 7 days along with any tokens that have a total supply greater than 10 million, showing the wallet address and token details." }, { "role": "assistant", "content": "SELECT w.address AS wallet_address, t.token_name, t.toke...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.tokens ( token_id character varying(64) NOT NULL, contract_address character varying(128) NOT NULL, token_name cha...
[ { "role": "user", "content": "Count the number of logs for each action type." }, { "role": "assistant", "content": "SELECT action,\n COUNT(*) AS count\nFROM trading_platform.logs\nGROUP BY action;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp )
[ { "role": "user", "content": "Which users have sent messages containing media in group chats? List their usernames and the names of the group chats." }, { "role": "assistant", "content": "SELECT DISTINCT u.username, c.group_name\nFROM social_media.messages m\nJOIN social_media.users u ON m.sende...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "For each case, show the latest uploaded document's name, version number, and upload timestamp." }, { "role": "assistant", "content": "SELECT d.case_id, d.document_name, d.version, d.upload_timestamp\nFROM legal_services.documents d\nINNER JOIN (\n SELECT case_id, M...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u...
[ { "role": "user", "content": "What are the fuel consumption rates per hour for the Boeing 747-8 model?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the fuel consumption rates for the Boeing 747-8 model as this data is not included in the aircraft_models ta...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE manufacturing.aircraft_mod...
[ { "role": "user", "content": "Give me the total billed amount for each invoice in 2024." }, { "role": "assistant", "content": "SELECT invoice_id, SUM(hours_spent * billing_rate) AS total_billed_amount FROM legal_services.time_entries WHERE is_billed = TRUE AND EXTRACT(YEAR FROM date_worked) = 20...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.time_entries ( entry_id text PRIMARY KEY, case_id text, lawyer_id text, date_worked date, hours_spent nu...
[ { "role": "user", "content": "Get the total number of appointments grouped by status." }, { "role": "assistant", "content": "SELECT status,\n COUNT(*) AS appointment_count\nFROM healthcare.appointments\nGROUP BY status;" }, { "role": "user", "content": "Now filter to include on...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi...
[ { "role": "user", "content": "List the contract ID, address, and deployer address for all contracts deployed on the 'mainnet' network." }, { "role": "assistant", "content": "SELECT contract_id, address, deployer_address FROM web3.contracts WHERE network_id = 'mainnet';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "role": "user", "content": "List all user IDs and the number of posts each has made where the post includes a media file (media_url is not null), along with whether their profile is private." }, { "role": "assistant", "content": "SELECT p.user_id, COUNT(*) AS media_post_count, us.private_profi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ...
[ { "role": "user", "content": "List the names and types of all in-game items that have a rarity of 'Epic'." }, { "role": "assistant", "content": "SELECT item_name, item_type FROM gaming_technology.in_game_items WHERE rarity = 'Epic';" }, { "role": "user", "content": "Further restrict ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid, username text, email text, password_hash text, registration_date timestamp ...
[ { "role": "user", "content": "List the name and symbol for all assets that do not have a corresponding entry with the key 'website' in the metadata table." }, { "role": "assistant", "content": "SELECT T1.name , T1.symbol FROM trading_platform.assets AS T1 LEFT JOIN trading_platform.metadata AS T...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "Show me all trips that were delayed by more than 1 hour, including their vehicle and driver IDs, along with the origin and destination location IDs." }, { "role": "assistant", "content": "SELECT trip_id, vehicle_id, driver_id, origin_location_id, destination_locatio...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, -- unique identifier for a specific trip instance ...
[ { "role": "user", "content": "Find all medical records with a vital sign for temperature above 38°C. Show the record ID and record date." }, { "role": "assistant", "content": "SELECT record_id, record_date\nFROM healthcare.medical_records\nWHERE (vitals ->> 'temperature')::numeric > 38;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "For each guest, list reservation_id, guest_id, check_in_date, and the next reservation_id and its check_in_date." }, { "role": "assistant", "content": "SELECT r1.reservation_id,\n r1.guest_id,\n r1.check_in_date,\n r2.reservation_id AS next_reserva...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ...
[ { "role": "user", "content": "Find all pairs of users who registered at exactly the same timestamp, showing both user IDs, usernames, and the shared registration timestamp." }, { "role": "assistant", "content": "SELECT u1.user_id AS user_id_1, u1.username AS username_1, u2.user_id AS user_id_2, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
[ { "role": "user", "content": "Count the number of premium payments that have a null payment method." }, { "role": "assistant", "content": "SELECT COUNT(*) AS null_payment_method_count\nFROM insurance.premium_payments\nWHERE payment_method IS NULL;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name...
[ { "role": "user", "content": "For each citizen who has made at least one payment, show the citizen's full name, number of payments, and total amount paid, grouped by currency." }, { "role": "assistant", "content": "SELECT\n c.first_name || ' ' || c.last_name AS full_name,\n p.currency,\n COUN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT...
[ { "role": "user", "content": "Show me the top 5 narratives by market cap, along with their 24-hour trading volume and 7-day price change percentage." }, { "role": "assistant", "content": "SELECT narrative, market_cap, volume_24h, price_change_percentage_7d FROM narrative_info ORDER BY market_cap...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure "CREATE TABLE narrative_info (", "narrative character varying(512) NOT NULL, -- the id of narrative", "top_3_coins text, --...
[ { "role": "user", "content": "Can you help me get the total number of operational platforms across all stations?" }, { "role": "assistant", "content": "db.platforms.countDocuments({ status: 'Operational' });" } ]
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 // db.createCollection('platforms') // Optional: db.platforms.createIndex({ platform_id: 1 }, { u...
[ { "role": "user", "content": "List all prescriptions with medication details. Return prescription_id, patient full name, medication_name, and prescription_date." }, { "role": "assistant", "content": "SELECT pr.prescription_id,\n p.first_name || ' ' || p.last_name AS patient_name,\n m...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "For the 'DeFi' narrative, what is the average ROI and the total net inflow (usd_value where type=1) from smart money token inflow?" }, { "role": "assistant", "content": "SELECT AVG(sm.roi) AS avg_roi, SUM(smt.usd_value) AS total_net_inflow\nFROM smart_money_token_in...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri...
[ { "role": "user", "content": "Count the number of contracts per network and status." }, { "role": "assistant", "content": "SELECT\n network_id,\n status,\n COUNT(*) AS contract_count\nFROM web3.contracts\nGROUP BY network_id, status;" }, { "role": "user", "content": "Actually, ple...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, -- unique identifier for the contract address cha...
[ { "role": "user", "content": "For each prescription, find the next prescription for the same patient. Return current prescription_id, next_prescription_id, patient_id, and days between start dates." }, { "role": "assistant", "content": "SELECT p1.patient_id,\n p1.prescription_id AS current...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.prescriptions ( prescription_id.text, record_id.text, patient_id.text, doctor_id.text, medication_id.text, d...
[ { "role": "user", "content": "Could you list the name, type, and rarity for all in-game items that belong to games released on or after January 1st, 2022?" }, { "role": "assistant", "content": "SELECT ii.item_name, ii.item_type, ii.rarity FROM gaming_technology.in_game_items AS ii JOIN gaming_te...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player ...
[ { "role": "user", "content": "What is the total quantity and total cost of fuel consumed for each fuel type recorded in the fuel logs?" }, { "role": "assistant", "content": "SELECT fuel_type, SUM(quantity) AS total_quantity, SUM(total_cost) AS total_cost FROM transportation.fuel_logs GROUP BY fu...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destin...
[ { "role": "user", "content": "I want to see each server's name, region, and the number of game sessions that have been started on that server." }, { "role": "assistant", "content": "SELECT s.server_name, s.region, COUNT(gs.session_id) AS session_count\nFROM gaming_technology.servers s\nLEFT JOIN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id uuid NOT NULL DEFAULT gen_random_uuid(), name character varying(150) NOT NU...
[ { "role": "user", "content": "List all token symbols that have a positive ROI and a Realized Ratio greater than 0.7. Show their token symbol, chain, ROI, and Realized Ratio." }, { "role": "assistant", "content": "SELECT token_symbol, chain, roi, realized_ratio FROM smart_money_token_performance ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, token_symbol character varying(100), pnl...
[ { "role": "user", "content": "List the last 20 messages that have a media_url, showing message_id, sender_user_id, media_type, and sent_at, ordered by sent_at descending." }, { "role": "assistant", "content": "SELECT message_id,\n sender_user_id,\n media_type,\n sent_at\nFROM s...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.messages ( message_id character varying(64) NOT NULL, -- unique identifier for the message convers...
[ { "role": "user", "content": "Show me all home loans (loan_id, principal_amount, interest_rate) where the current principal balance is more than 75% of the original principal amount, along with the account_id and employee details (first_name, last_name) of the employee who processed the loan application." ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.transactions ( transaction_id.text, account_id.text, related_account_id.text, transaction_type.text,...
[ { "role": "user", "content": "Show a list of all DApps together with the total number of unique assets linked to each via the metadata table." }, { "role": "assistant", "content": "SELECT d.dapp_id, d.name, d.url, COUNT(DISTINCT m.asset_id) AS unique_asset_count\nFROM trading_platform.dapps d\nL...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan...
[ { "role": "user", "content": "I want to know, for each conversation participant, how many unread messages they have. Return participant_id, conversation_id, and unread_count." }, { "role": "assistant", "content": "SELECT cp.participant_id,\n cp.conversation_id,\n COUNT(m.message_id) ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.posts ( post_id character varying(64) NOT NULL, -- unique identifier for the post user_id characte...
[ { "role": "user", "content": "How many group conversations are there?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.conversations WHERE is_group_chat = TRUE;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_grou...
[ { "role": "user", "content": "Show me all drivers and the vehicles they are assigned for trips that have status 'Delayed'. Include driver first_name, driver last_name, vehicle license_plate, trip_id, and actual_departure." }, { "role": "assistant", "content": "SELECT d.first_name, d.last_name, v...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "Show me all patients who have both primary and non-primary insurance plans, along with their policy numbers and expiration dates." }, { "role": "assistant", "content": "SELECT p1.patient_id, p1.policy_number AS primary_policy, p1.expiration_date AS primary_expiry, p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.text, policy_number.text, group_numb...
[ { "role": "user", "content": "List all room types that have at least one service in the 'Spa' category, including the room type name, property name, and service name." }, { "role": "assistant", "content": "SELECT DISTINCT rt.type_name, p.property_name, s.service_name\nFROM hospitality_technology...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "I need the total traded value (quantity * price) for each buyer and asset symbol for trades after '2024-06-01'. List buyer_id, asset symbol, and total_value." }, { "role": "assistant", "content": "SELECT t.buyer_id, m.value AS asset_symbol, SUM(t.quantity * t.price)...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.orders ( order_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, wallet_id ch...
[ { "role": "user", "content": "Show all policy beneficiaries along with the total premium amount paid for the policy they are associated with." }, { "role": "assistant", "content": "SELECT T1.beneficiary_id, T1.first_name, T1.last_name, T1.policy_id, T1.percentage_share, SUM(T2.amount_paid) AS to...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d...
[ { "role": "user", "content": "Compute the total invoiced amount and average payment delay (in days) by status for invoices issued between 2024-01-01 and 2024-06-30." }, { "role": "assistant", "content": "SELECT status,\n SUM(total_amount) AS total_invoiced,\n AVG(EXTRACT(day FROM (pa...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_...
[ { "role": "user", "content": "What is the history of incidents or accidents that occurred on platform 5 at station GHI?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information about the history of incidents or accidents on platform 5 at station GHI. My data is limited t...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.p...