conversations
listlengths
2
8
system
stringlengths
288
8.23k
[ { "role": "user", "content": "Show me a list of comments and the names of hashtags associated with the posts those comments are on." }, { "role": "assistant", "content": "SELECT T1.comment_id, T3.tag_name FROM comments AS T1 JOIN post_hashtags AS T2 ON T1.post_id = T2.post_id JOIN hashtags AS T3...
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.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t...
[ { "role": "user", "content": "Show me the count of service orders for each distinct status." }, { "role": "assistant", "content": "SELECT status, COUNT(order_id) FROM hospitality_technology.service_orders GROUP BY status;" }, { "role": "user", "content": "Also, include the total quan...
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 character varying(64) NOT NULL, property_id character varying(64) ...
[ { "role": "user", "content": "Can you list all replies along with their parent comment content for post_id 'P100'?" }, { "role": "assistant", "content": "SELECT reply.comment_id AS reply_id, parent.content AS parent_content, reply.content AS reply_content FROM comments AS reply JOIN comments AS ...
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.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t...
[ { "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": "List the full names and email addresses of staff members who have delivered at least one service order in the past 30 days, along with the count of orders they delivered. Sort by count descending." }, { "role": "assistant", "content": "SELECT st.staff_id,\n st...
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 text, property_id text, first_name text, last_name text, position text, work_em...
[ { "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": "Show all insurance plans where the plan name includes the word 'Care'." }, { "role": "assistant", "content": "SELECT plan_id, plan_name, insurance_provider, plan_type\nFROM healthcare.insurance_plans\nWHERE plan_name ILIKE '%Care%';" } ]
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.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_ty...
[ { "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 posts that have a media URL but no textual content." }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.posts AS T1 WHERE T1.media_url IS NOT NULL AND (T1.content IS NULL OR T1.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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "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": "Provide a report of each user with their username and the count of all log entries from the last 30 days." }, { "role": "assistant", "content": "SELECT u.user_id, u.username, COUNT(l.log_id) AS log_count\nFROM trading_platform.users u\nLEFT JOIN trading_platform.log...
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, -- unique identifier for the user username ch...
[ { "role": "user", "content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens where the price is greater than $0.10." }, { "role": "assistant", "content": "SELECT tm.name, tm.contract_address, tm.total_supply FR...
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, -- Timestamp of the block when token metadata was recorded ...
[ { "role": "user", "content": "Can you help me retrieve the details of all bookings for a specific route with route_id 'RT789', including the passenger names and the scheduled departure times?" }, { "role": "assistant", "content": "SELECT b.booking_id, p.first_name, p.last_name, s.departure_datet...
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 train_station_management.train_cars ( car_id character varying(64) NOT NULL, -- ...
[ { "role": "user", "content": "List users who have received notifications triggered by another user (non-system notifications). Show the recipient username, notification type, and the sender username." }, { "role": "assistant", "content": "SELECT T1.username AS recipient_username, T2.notification...
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": "Show me the name and type for all the locations." }, { "role": "assistant", "content": "SELECT name, type FROM transportation.locations" }, { "role": "user", "content": "Now, filter this list to only include locations whose type is either 'Distribution 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 transportation.locations ( location_id.text, name.text, type.text, address_line1.text, city.text, state_province.text, ...
[ { "role": "user", "content": "I need to find all bookings for a specific schedule with schedule_id 'sched_1122' and include the passenger and ticket details." }, { "role": "assistant", "content": "SMEMBERS schedule:sched_1122:bookings\nHGETALL booking:book_*\nHGETALL passenger:pass_*\nSMEMBERS b...
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 ...
[ { "role": "user", "content": "List all wallets holding the NFT with contract_address '0xabc123' and token_id '100' and the amount held." }, { "role": "assistant", "content": "SELECT wallet_address, amount\nFROM nft_holders\nWHERE contract_address = '0xabc123'\n AND token_id = '100';" }, { ...
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 erc1155_approval_for_all ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, transaction_index integ...
[ { "role": "user", "content": "List all claims, including the claim ID, incident date, estimated loss, and the name of the insurance product associated with the policy under which the claim was made." }, { "role": "assistant", "content": "SELECT\n c.claim_id,\n c.incident_date,\n c.estimated_l...
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": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens where the price is greater than $0.10." }, { "role": "assistant", "content": "SELECT tm.name, tm.contract_address, tm.total_supply FR...
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": "How many payments were made using the payment method 'Credit Card'?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS credit_card_payments\nFROM government_services.payments\nWHERE payment_method = 'Credit Card';" } ]
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 PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "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": "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": "Return the number of top-level comments and the number of replies in the comments table." }, { "role": "assistant", "content": "SELECT\n SUM(CASE WHEN parent_comment_id IS NULL THEN 1 ELSE 0 END) AS top_level_comments,\n SUM(CASE WHEN parent_comment_id IS NOT 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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "I need to retrieve asset IDs along with their category and website metadata values for assets that have both entries." }, { "role": "assistant", "content": "SELECT m_cat.asset_id,\n m_cat.value AS category,\n m_web.value AS website_url\nFROM trading_plat...
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.metadata ( metadata_id character varying(64) NOT NULL, asset_id character varying(64) NOT NULL, key ch...
[ { "role": "user", "content": "List all users whose password hash contains the substring 'abc'." }, { "role": "assistant", "content": "SELECT user_id, username, password_hash FROM blockchain.users WHERE password_hash LIKE '%abc%';" }, { "role": "user", "content": "Also include their 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 blockchain.wallets ( wallet_id.text, user_id.text, address_id.text, private_key.text ) CREATE TABLE blockchain.users ( ...
[ { "role": "user", "content": "List active policies where the premium amount is greater than the base premium of the linked insurance product. Show policy number, policy premium, product name, and product base premium." }, { "role": "assistant", "content": "SELECT T1.policy_number, T1.premium_amo...
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 all claims that were reported more than 30 days after the incident date." }, { "role": "assistant", "content": "SELECT claim_id, policy_id, customer_id, incident_date, reported_date FROM insurance.claims WHERE DATEDIFF(reported_date, incident_date) > 30;" }, ...
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": "List all medical records, showing the record ID, record date, and the full name of the doctor who created the record. Include the patient ID as well." }, { "role": "assistant", "content": "SELECT mr.record_id, mr.record_date, mr.patient_id, d.first_name, d.last_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 healthcare.medical_records ( record_id character varying(64) NOT NULL, -- unique identifier for the medical record...
[ { "role": "user", "content": "List the plan_id, plan_name, and plan_type for all insurance plans where the insurance_provider is 'Humana'." }, { "role": "assistant", "content": "SELECT\n plan_id,\n plan_name,\n plan_type\nFROM healthcare.insurance_plans\nWHERE\n insurance_provider = 'Humana'...
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 text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "Show me the top 5 users by the total number of trades they participated in as sellers, along with their wallet addresses." }, { "role": "assistant", "content": "SELECT t.seller_id, w.address, COUNT(t.trade_id) AS total_trades FROM trading_platform.trades t JOIN trad...
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, user_id character varying(64) NOT NULL, address ch...
[ { "role": "user", "content": "Show each wallet address that has received token transfers of more than one type of token, along with the count of token types received." }, { "role": "assistant", "content": "SELECT tt.to_address, COUNT(DISTINCT tt.token_id) AS token_type_count\nFROM web3.token_tra...
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 text PRIMARY KEY, address text, abi text, bytecode text, deployer_address text, deployed_a...
[ { "role": "user", "content": "Get a list of room types along with their property name and the count of rooms currently Available for each type." }, { "role": "assistant", "content": "SELECT rt.type_name, p.property_name, COUNT(r.room_id) AS available_rooms_count\nFROM hospitality_technology.room...
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, property_name character varying(255) NO...
[ { "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": "List user IDs of users who have private profiles and have liked any post or comment." }, { "role": "assistant", "content": "SELECT DISTINCT T1.user_id FROM social_media.user_settings AS T1 JOIN social_media.likes AS T2 ON T1.user_id = T2.user_id WHERE T1.private_pro...
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, user_id character varying(64) NOT NULL, post_id character ...
[ { "role": "user", "content": "List all beneficiaries added in the last 6 months, showing their full names and relationship to the policyholder." }, { "role": "assistant", "content": "SELECT first_name, last_name, relationship FROM insurance.policy_beneficiaries WHERE added_at >= NOW() - INTERVAL...
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.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text...
[ { "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": "List all medical record entries where the treatment_plan mentions a medication name. Return patient_id, record_id, and the matching medication_name." }, { "role": "assistant", "content": "SELECT mr.patient_id,\n mr.record_id,\n m.medication_name\nFROM he...
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": "특정 품질 등급 이상의 공급업체를 조회하고 싶습니다. 품질 등급, 공급업체 이름, 국가를 포함해 주세요." }, { "role": "assistant", "content": "GET suppliers/_search\n{\n \"query\": {\n \"range\": {\n \"quality_rating\": {\n \"gte\": 4.0\n }\n }\n },\n \"_source\": [\"supplier_name\", ...
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 Index 'suppliers'. Mapping: { properties: { supplier_id: { type: 'keyword' }, supplier_name: { ty...
[ { "role": "user", "content": "How many events were emitted on each date? List the date and the count of events." }, { "role": "assistant", "content": "SELECT DATE(emitted_at) AS emit_date,\n COUNT(*) AS event_count\nFROM web3.events\nGROUP BY DATE(emitted_at);" }, { "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 web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character...
[ { "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": "What are the top 5 tokens by 7-day price change percentage? Show token_symbol, token_name, narrative, and chain, ordered by price_change_percentage_7d descending." }, { "role": "assistant", "content": "```sql\nSELECT\n token_symbol,\n token_name,\n narrative,\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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name...
[ { "role": "user", "content": "For each route, list the route number, description, and the combined total maintenance cost for all vehicles that have ever operated on that route." }, { "role": "assistant", "content": "WITH VehicleTotalMaintenance AS ( SELECT vehicle_id, SUM(cost) AS total_cost FR...
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": "List all NFT collections where the floor price is greater than 0.5 ETH, including their names and contract addresses." }, { "role": "assistant", "content": "SELECT name, contract_address FROM nft_collections WHERE CAST(floor_price AS decimal) > 0.5 AND floor_price_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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add...
[ { "role": "user", "content": "List all invoices issued between '2024-01-01' and '2024-06-30', including the invoice_number, issue_date, total_amount, client's first and last name, and the case_name. Order the results by issue_date ascending." }, { "role": "assistant", "content": "SELECT i.invoic...
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 PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "List all vehicles and their last maintenance service date along with the odometer reading, including only those that have not had a fuel refill in the past 30 days." }, { "role": "assistant", "content": "SELECT m.vehicle_id,\n m.last_service_date,\n m.la...
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": "Now, sort the results by the date opened, oldest first, and show only the top 10." }, { "role": "assistant", "content": "SELECT case_name, case_number, date_opened FROM legal_services.cases WHERE lead_lawyer_id = 'lawyer_abc' AND status = 'Open' AND case_type = 'Cri...
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.cases ( case_id.text, case_number.text, case_name.text, client_id.text, lead_lawyer_id.text, case_type.t...
[ { "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": "How many documents are there for each document_type? Show document_type and count ordered by the count in descending order." }, { "role": "assistant", "content": "SELECT document_type,\n COUNT(*) AS count\nFROM legal_services.documents\nGROUP BY document_type\...
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": "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": "Show me all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and have a daily trading volume exceeding 1 million shares, along with the employee details (employee_id, first_name, last_name) who last updated these securities." }, ...
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.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba...
[ { "role": "user", "content": "Show me all customers who have missing contact information (either phone number or email is null), along with their state and city." }, { "role": "assistant", "content": "SELECT first_name, last_name, state, city FROM insurance.customers WHERE phone_number IS NULL O...
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, -- unique identifier for the customer first_...
[ { "role": "user", "content": "List all claims that are still pending (status = 'pending') and were reported more than 30 days ago." }, { "role": "assistant", "content": "SELECT claim_id, policy_id, customer_id, reported_date FROM insurance.claims WHERE status = 'pending' AND reported_date < CURR...
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 character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara...
[ { "role": "user", "content": "What is the average processing time in days for each service category?" }, { "role": "assistant", "content": "SELECT category, AVG(average_processing_time_days) AS avg_processing_time\nFROM government_services.services\nGROUP BY category;" }, { "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 government_services.services ( service_id text PRIMARY KEY, agency_id text, service_name text, description text, catego...
[ { "role": "user", "content": "Show me the number of unique achievements unlocked by each player." }, { "role": "assistant", "content": "SELECT player_id, COUNT(DISTINCT achievement_id) AS unique_achievements_unlocked\nFROM gaming_technology.player_achievements\nGROUP BY player_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 gaming_technology.player_achievements ( player_achievement_id uuid, player_id uuid, achievement_id uuid, unlocked_at ti...
[ { "role": "user", "content": "Show me all intercity routes with their origin and destination locations, including the city and country for each location." }, { "role": "assistant", "content": "SELECT r.route_id, r.route_number, r.type, orig.name AS origin_name, orig.city AS origin_city, orig.cou...
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, -- unique identifier for the route route_numb...
[ { "role": "user", "content": "Can you show, for each employee, the full name and job title of their direct manager, as well as the employee's department and branch_id?" }, { "role": "assistant", "content": "SELECT e.employee_id, e.first_name AS employee_first_name, e.last_name AS employee_last_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 financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri...
[ { "role": "user", "content": "For each claim, show the corresponding product_type of the insurance product for the related policy." }, { "role": "assistant", "content": "SELECT cl.claim_id, ip.product_type\nFROM insurance.claims cl\nJOIN insurance.policies p ON cl.policy_id = p.policy_id\nJOIN 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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "Show me all maintenance logs for 'Oil Change' services performed in the last 3 months, including the vehicle ID, service date, and cost." }, { "role": "assistant", "content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE service_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.maintenance_logs ( log_id character varying(64) NOT NULL, -- unique identifier for the maintenance ...
[ { "role": "user", "content": "List transactions where the description includes another transaction's reference_number, showing both transaction IDs and the referenced reference_number." }, { "role": "assistant", "content": "SELECT t1.transaction_id AS source_id, t2.transaction_id AS referenced_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 financial_services.transactions ( transaction_id text PRIMARY KEY, account_id text, related_account_id text, transactio...
[ { "role": "user", "content": "Show me the first name, last name, and email address for all passengers who are part of the loyalty program with ID 'Gold'." }, { "role": "assistant", "content": "SELECT first_name , last_name , email FROM transportation.passengers WHERE loyalty_program_id = 'Go...
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": "For projects that have completed more than one fundraising round, calculate the average investment value across all their recorded rounds. Display the project name and this average value." }, { "role": "assistant", "content": "SELECT project_name, AVG(investment_val...
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 character varying(...
[ { "role": "user", "content": "Show me asset IDs and DApp names for metadata entries linking assets to DApps where metadata.value matches a dapp_id." }, { "role": "assistant", "content": "SELECT m.asset_id, d.name AS dapp_name\nFROM trading_platform.metadata m\nJOIN trading_platform.dapps d\n 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 trading_platform.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address ch...
[ { "role": "user", "content": "For each patient, find the next appointment after each one. Return patient_id, appointment_id, next_appointment_id, and the waiting time in minutes between them." }, { "role": "assistant", "content": "SELECT A.patient_id,\n A.appointment_id AS current_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 healthcare.appointments ( appointment_id text PRIMARY KEY, patient_id text, doctor_id text, appointment_time timestamp,...
[ { "role": "user", "content": "Show the total number of customers in each state." }, { "role": "assistant", "content": "SELECT\n state,\n COUNT(customer_id)\nFROM insurance.customers\nGROUP BY\n state;" } ]
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 spa services (category = 'Wellness') with their names, prices, and units, ordered by price in descending order." }, { "role": "assistant", "content": "SELECT service_name, price, unit FROM hospitality_technology.services WHERE category = 'Wellness' ORDER BY...
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.guests ( guest_id character varying(64) NOT NULL, -- unique identifier for the guest profil...
[ { "role": "user", "content": "List all invoices that were paid within 7 days of their issue date. Show invoice number, issue date, payment date, and total amount." }, { "role": "assistant", "content": "SELECT invoice_number, issue_date, payment_date, total_amount FROM legal_services.invoices WHE...
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, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph...
[ { "role": "user", "content": "Count the number of staff members for each position." }, { "role": "assistant", "content": "SELECT\n position,\n COUNT(staff_id) AS staff_count\nFROM hospitality_technology.staff\nGROUP BY\n position;" }, { "role": "user", "content": "Only show positi...
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": "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": "I want to find the total number of ERC1155 \"approval-for-all\" events per contract. Show contract_address and the approval_count." }, { "role": "assistant", "content": "SELECT contract_address, COUNT(*) AS approval_count\nFROM erc1155_approval_for_all\nGROUP BY con...
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 varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "For each guest, list each review and its immediately following review, including guest_id, first_review_id, first_review_date, second_review_id, and second_review_date." }, { "role": "assistant", "content": "SELECT r1.guest_id, r1.review_id AS first_review_id, r1.re...
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.reviews ( review_id.text, property_id.text, reservation_id.text, guest_id.text, rating_overall.i...
[ { "role": "user", "content": "What is the average price of tokens held by Binance exchange across all chains in the cex_token_balance table?" }, { "role": "assistant", "content": "SELECT AVG(price) AS average_price FROM cex_token_balance WHERE exchange = 'Binance';" } ]
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 name of each agency and the total number of service locations it operates in New York State." }, { "role": "assistant", "content": "SELECT a.agency_name, COUNT(sl.location_id) AS location_count\nFROM government_services.agencies a\nLEFT JOIN 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.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_e...
[ { "role": "user", "content": "Show me all insurance plans that have more than 5 patients enrolled as their primary insurance, along with the provider name and count of patients." }, { "role": "assistant", "content": "SELECT ip.plan_id, ip.plan_name, ip.insurance_provider, COUNT(pi.patient_id) AS...
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.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch...
[ { "role": "user", "content": "Show me each doctor and the total number of unique patients they have prescribed medications to. Include the doctor's full name and the patient count." }, { "role": "assistant", "content": "SELECT d.doctor_id, d.first_name, d.last_name, COUNT(DISTINCT p.patient_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 healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad...
[ { "role": "user", "content": "List tokens that have a 24-hour trading volume greater than $10,000,000 and a negative price change percentage over the last 24 hours. Show the token symbol, chain, total volume, and the 24-hour price change percentage." }, { "role": "assistant", "content": "SELECT ...
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": "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": "能否帮我统计特定车站(station_id 为 'station_xyz')的所有工作人员数量?" }, { "role": "assistant", "content": "MATCH (s:Station {station_id: 'station_xyz'})<-[:BASED_AT]-(staff:Staff)\nRETURN COUNT(staff) AS total_staff" } ]
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 // Node Label: :Station // Properties: // station_id: String (Constraint: UNIQUE) // station_...
[ { "role": "user", "content": "What is the total USD value held by all centralized exchanges (CEX) for the token with the symbol 'BTC'?" }, { "role": "assistant", "content": "SELECT SUM(usd_value) AS total_btc_cex_value FROM cex_token_balance WHERE token_symbol = 'BTC';" }, { "role": "use...
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 character varying(...
[ { "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": "What is the total sum of amounts paid for all invoices?" }, { "role": "assistant", "content": "SELECT SUM(amount_paid) FROM invoices;" }, { "role": "user", "content": "Group this total by the status of the invoice." }, { "role": "assistant", ...
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.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, man...
[ { "role": "user", "content": "What is the maintenance schedule for platform 3 at station DEF for the next month?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to the maintenance schedule for platforms. The data I have only includes static information about platform de...
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": "Which exchanges on the Ethereum chain hold the highest total USD value of tokens, and what are their top 3 tokens by USD value?" }, { "role": "assistant", "content": "SELECT exchange, token_symbol, usd_value FROM cex_token_balance WHERE chain = 'Ethereum' ORDER BY u...
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.text, chain.text, address.text, exchange.text, token_address.text, token_symbol.text,...
[ { "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": "Show me the total market cap and the total smart money inflow USD value for each narrative. Join the `token_basic_info` and `smart_money_token_inflow` tables based on narrative." }, { "role": "assistant", "content": "WITH Narratives AS ( SELECT DISTINCT narrative FR...
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_basic_info ( coin_id text, token_name text, token_symbol text, token_address t...
[ { "role": "user", "content": "What is the performance review score for employee with ID 'EMP456' for the last quarter?" }, { "role": "assistant", "content": "I'm sorry, but I can't assist with information about performance review scores as this data is not included in the employees table." } ]
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.employees ( ...
[ { "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": "Provide a breakdown of the total number of conversations, showing how many are group chats and how many are not. Also, show the count of conversations that have a recorded last message time." }, { "role": "assistant", "content": "SELECT COUNT(*) AS total_conversatio...
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 character varying(64) NOT NULL, created_at timestamp NOT NULL DEFAULT CURR...
[ { "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": "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": "How many service locations do we have in each state?" }, { "role": "assistant", "content": "SELECT state, COUNT(*) AS location_count FROM government_services.service_locations GROUP BY state;" }, { "role": "user", "content": "Only show states where there...
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.service_locations ( location_id character varying(64) NOT NULL, -- unique identifier for the ph...
[ { "role": "user", "content": "How many unique patient records are there for each gender?" }, { "role": "assistant", "content": "SELECT gender, COUNT(DISTINCT patient_id) AS patient_count FROM healthcare.patients GROUP BY gender;" } ]
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.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "Show me properties that have more than 10 service orders delivered in the last month. Include the property_name and the number of delivered orders." }, { "role": "assistant", "content": "SELECT p.property_name,\n COUNT(o.order_id) AS delivered_orders\nFROM hos...
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": "Could you list the trip ID, scheduled and actual arrival times, and the associated vehicle's make and model for all trips where the actual arrival was more than 30 minutes later than scheduled?" }, { "role": "assistant", "content": "SELECT T1.trip_id, T1.scheduled_a...
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 a list of all doctors who have made at least one diagnosis along with the total number of diagnoses they have made." }, { "role": "assistant", "content": "SELECT d.doctor_id, d.first_name, d.last_name, COUNT(di.diagnosis_id) AS diagnosis_count\nFROM healthca...
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.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "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": "I need a summary of the number of cases by case_type. Please show the case_type and how many cases exist for each." }, { "role": "assistant", "content": "SELECT case_type, COUNT(*) AS case_count FROM legal_services.cases GROUP BY case_type;" }, { "role": "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 legal_services.cases ( case_id character varying(64) NOT NULL, case_number character varying(100) UNIQUE, case_name tex...
[ { "role": "user", "content": "Show me all SUI coins with a balance greater than 1000, including their symbol and name." }, { "role": "assistant", "content": "SELECT sc.object_id, sc.coin_type, sc.balance, scm.symbol, scm.name FROM sui_coins sc JOIN sui_coins_metadata scm ON sc.coin_type = scm.co...
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 erc20_balances ( block_number bigint, contract_address varchar, wallet_address varchar, amount varchar, pk varchar ) CR...
[ { "role": "user", "content": "List all premium payments for policy 'POL123'. Show payment ID, payment date, amount paid, and status." }, { "role": "assistant", "content": "SELECT payment_id, payment_date, amount_paid, status FROM insurance.premium_payments WHERE policy_id = 'POL123';" }, { ...
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.premium_payments ( payment_id character varying(64) NOT NULL, -- unique identifier for the payment po...
[ { "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": "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...