conversations
listlengths
2
8
system
stringlengths
284
7.86k
[ { "role": "user", "content": "Provide a count of citizens registered per calendar year." }, { "role": "assistant", "content": "SELECT CAST(EXTRACT(YEAR FROM registration_date) AS INTEGER) AS registration_year, COUNT(*) AS citizen_count FROM government_services.citizens GROUP BY 1 ORDER BY 1;" ...
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": "List the content and sent time for messages sent by user 'U101'." }, { "role": "assistant", "content": "SELECT content, sent_at FROM social_media.messages WHERE sender_user_id = 'U101';" }, { "role": "user", "content": "Could you also include the group 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 social_media.messages ( message_id character varying(64) NOT NULL, -- unique identifier for the message convers...
[ { "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": "List all pairs of achievements in the same game where the difference in their points is greater than 50." }, { "role": "assistant", "content": "SELECT a1.game_id,\n a1.name AS achv1,\n a2.name AS achv2,\n ABS(a1.points - a2.points) AS point_dif...
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(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "Show a list of all routes including their route number, type, distance in km, and estimated duration in minutes." }, { "role": "assistant", "content": "SELECT\n route_number,\n type,\n distance_km,\n estimated_duration_minutes\nFROM transportation.routes;" }, ...
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": "For each game, show the game_id, title, the number of servers currently online, and the total current_players on those servers." }, { "role": "assistant", "content": "SELECT g.game_id, g.title, COUNT(s.server_id) AS online_servers, SUM(s.current_players) AS total_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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player ...
[ { "role": "user", "content": "Show me the user ID, wallet ID, address ID, and the transaction ID for transactions where the sender address is linked to an address associated with a wallet." }, { "role": "assistant", "content": "SELECT DISTINCT w.user_id, w.wallet_id, w.address_id, t.transaction_...
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 blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp tim...
[ { "role": "user", "content": "特定のプラットフォームID 'plat_123' に関連するメンテナンス記録を取得するのを手伝っていただけますか?また、記録のステータスも含めてください。" }, { "role": "assistant", "content": "SMEMBERS platform:plat_123:maintenance\nHGETALL maintenance_record:<record_id>" }, { "role": "user", "content": "ステータスが 'Completed' の記録だけ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure // Use Hashes for ticket details. Key format: ticket:<ticket_id> // HSET ticket:tkt_1a2b ticket_i...
[ { "role": "user", "content": "Show me all reservations with their guest IDs and room IDs where the total amount is greater than $500 and the status is 'Confirmed', ordered by check-in date." }, { "role": "assistant", "content": "SELECT reservation_id, guest_id, room_id, check_in_date, total_amou...
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": "Find all wallets that were created on the same day and list their wallet IDs, addresses, and the creation date." }, { "role": "assistant", "content": "SELECT w1.wallet_id, w1.address, w1.created_at::date AS creation_date FROM web3.wallets w1 JOIN (SELECT created_at:...
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.wallets ( wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet user_id character...
[ { "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": "List the total value and count of transactions for each status, ordered by total value descending." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS transaction_count, SUM(value) AS total_value\nFROM web3.transactions\nGROUP BY status\nORDER BY total...
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 all routes where the estimated duration is at least 120 minutes including their route number, type, and origin and destination location IDs." }, { "role": "assistant", "content": "SELECT route_number, type, origin_location_id, destination_location_id\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 text PRIMARY KEY, route_number text, description text, origin_location_id text, destin...
[ { "role": "user", "content": "Find all patients who have both an email address and an emergency contact listed, and show their names, email, and emergency contact phone numbers." }, { "role": "assistant", "content": "SELECT first_name, last_name, email, emergency_contact_phone FROM healthcare.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 healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad...
[ { "role": "user", "content": "Show the full name of each manager and the average commission rate of the agents who report directly to them. Only include managers who have at least one reporting agent." }, { "role": "assistant", "content": "SELECT T2.first_name AS manager_first_name, T2.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 insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state...
[ { "role": "user", "content": "Show the tokens with a negative net flow this month on all chains." }, { "role": "assistant", "content": "SELECT token_symbol, chain, net_flow FROM smart_money_token_performance WHERE net_flow < 0 AND date_trunc('month', CURRENT_DATE) = date_trunc('month', now());" ...
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": "Provide a list of all vehicles and the total quantity of fuel refueled for each vehicle." }, { "role": "assistant", "content": "SELECT T1.license_plate, sum(T2.quantity) FROM transportation.vehicles AS T1 JOIN transportation.fuel_logs AS T2 ON T1.vehicle_id = T2.veh...
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 text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "Show me all reservations with more than 2 adults, along with their property names and room types." }, { "role": "assistant", "content": "SELECT r.reservation_id, p.property_name, r.room_type_id, r.num_adults FROM hospitality_technology.reservations r JOIN hospitalit...
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 all documents that have multiple versions, including document_name, case_id, and the count of versions." }, { "role": "assistant", "content": "SELECT document_name,\n case_id,\n COUNT(*) AS version_count\nFROM legal_services.documents\nGROUP BY docu...
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": "I need to check the inventory status of components, including their batch details and warehouse location." }, { "role": "assistant", "content": "MATCH (i:InventoryBatch)-[:IS_INSTANCE_OF]->(c:Component)\nRETURN c.component_id, c.component_name, i.inventory_record_id...
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 ':Component'. Properties: { component_id: String (Constraint: UNIQUE), part_number: St...
[ { "role": "user", "content": "List all fuel refueling events with the refueled vehicle's make and model, the fuel type used, and the fueling location ID." }, { "role": "assistant", "content": "SELECT fl.fuel_log_id, fl.log_timestamp, v.make, v.model, fl.fuel_type, fl.quantity, fl.unit, fl.total_...
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 text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "Show me all transactions (transaction_id, amount, transaction_type) where the status is 'Completed' and the transaction_date is within the last 30 days, along with the security details (ticker_symbol, security_name) for securities traded on the same day as the transaction." }...
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": "List all cryptocurrency assets that have been traded at least 50 times, along with their average trade price." }, { "role": "assistant", "content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) AS trade_count, AVG(t.price) AS avg_price FROM trading_platfor...
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": "List all SUI NFT objects with the status 'exists', showing the object_id, name, and owner." }, { "role": "assistant", "content": "SELECT object_id, name, owner\nFROM sui_nfts\nWHERE status = 'exists';" }, { "role": "user", "content": "Can you also add th...
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": "Can you provide the total number of cars associated with a specific train with train_id 'train_789'?" }, { "role": "assistant", "content": "SCARD train:train_789:cars" } ]
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": "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": "List each payment method, the total amount paid, and the number of payments for each method for services in the 'Education' category." }, { "role": "assistant", "content": "SELECT p.payment_method, SUM(p.amount) AS total_amount, COUNT(p.payment_id) AS payment_count\...
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, agency_name.text, jurisdiction_level.text, primary_contact_email.text, m...
[ { "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": "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": "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": "List all applications that have at least one document with a verification status of 'Verified'. Show the application reference number and the name of the service associated with the application." }, { "role": "assistant", "content": "SELECT\n T1.reference_number,\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 government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "Show me the top 5 ERC20 tokens with the highest total supply on Ethereum, including their names, symbols, and contract addresses." }, { "role": "assistant", "content": "SELECT name, symbol, contract_address FROM token_metas WHERE is_erc20 = 1 ORDER BY CAST(total_sup...
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": "Can you list the top 5 addresses by total profit in the smart_money_profit table for the Polygon chain, along with their ROI, rank, and the most profitable token?" }, { "role": "assistant", "content": "SELECT address, profit, roi, rank, most_profit_token\nFROM smart...
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 text, project_id text, project_name text, rounds_name text, investment_value numeric, i...
[ { "role": "user", "content": "List all Sui NFT collections where the owner is not null, including their name and collection_type." }, { "role": "assistant", "content": "SELECT name, collection_type FROM sui_nfts WHERE owner IS NOT NULL;" }, { "role": "user", "content": "Can you also ...
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": "What is the current salary of employee with ID 'EMP123'?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information about an employee's salary as it is not included in the data available 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": "Find all medical records where the treatment plan includes 'physical therapy' and the patient has an active primary insurance plan, showing the patient ID, record date, and insurance provider details." }, { "role": "assistant", "content": "SELECT mr.patient_id, mr.r...
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 who have interacted with DApps, along with the count of distinct DApps they interacted with and their wallet addresses." }, { "role": "assistant", "content": "SELECT w.user_id, COUNT(DISTINCT d.dapp_id) AS dapp_count, w.address FROM trading_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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE ...
[ { "role": "user", "content": "Show me the average market cap and average 24-hour price change percentage for tokens on each chain." }, { "role": "assistant", "content": "SELECT chain, AVG(market_cap) AS average_market_cap, AVG(price_change_percentage_24h) AS average_price_change_24h FROM token_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 CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character var...
[ { "role": "user", "content": "For each vehicle, find pairs of maintenance logs where one log is immediately followed by another by service_date. List vehicle_id, previous log_id, next log_id, and the odometer increase." }, { "role": "assistant", "content": "SELECT\n vehicle_id,\n log_id AS pre...
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 text, vehicle_id text, service_date date, odometer_reading integer, service_ty...
[ { "role": "user", "content": "How many employees work in each department? List the department name and the count." }, { "role": "assistant", "content": "SELECT department, COUNT(*) FROM government_services.employees GROUP BY department" }, { "role": "user", "content": "Only show depa...
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": "Calculate the total quantity traded for each day in the dataset." }, { "role": "assistant", "content": "SELECT DATE_TRUNC('day', traded_at) AS trade_day, SUM(quantity) AS total_daily_quantity FROM trading_platform.trades GROUP BY DATE_TRUNC('day', traded_at) ORDER B...
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.trades ( trade_id character varying(64) NOT NULL, order_id character varying(64) NOT NULL, buyer_id ch...
[ { "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": "我想查看所有检查记录中检查员的ID和检查结果,同时统计每个检查员的检查次数。" }, { "role": "assistant", "content": "db.inspections.aggregate([\n {\n $group: {\n _id: '$inspector_employee_id',\n total_inspections: { $count: {} },\n results: { $push: '$result' }\n }\n },\n {\n $...
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 Collection 'inspections'. Document structure: { _id: <ObjectId (or inspection_id)>, inspection_id...
[ { "role": "user", "content": "For each user, show their user ID and the count of unique wallet addresses they own." }, { "role": "assistant", "content": "SELECT user_id, COUNT(DISTINCT address) FROM wallets GROUP BY user_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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
[ { "role": "user", "content": "I need to compare consecutive daily close_prices for each security to find when the close_price increased compared to the previous day." }, { "role": "assistant", "content": "SELECT a.security_id, b.data_timestamp AS prev_date, b.close_price AS prev_close, a.data_ti...
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.market_data ( data_point_id bigint, security_id text, data_timestamp timestamp, open_price numeric, ...
[ { "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": "List all events and any token transfers that occurred in the same transaction, showing event_id, event_name, transfer_id, and token_symbol." }, { "role": "assistant", "content": "SELECT\n e.event_id,\n e.event_name,\n tt.transfer_id,\n tk.token_symbol\nFROM web3...
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": "For each ERC1155 NFT contract on Ethereum, show the `contract_address`, `token_id`, total amount held across all wallets, and number of unique holders." }, { "role": "assistant", "content": "SELECT nh.contract_address,\n nh.token_id,\n SUM(CAST(nh.amount...
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": "Calculate the average length of stay in days for completed reservations for each property." }, { "role": "assistant", "content": "SELECT p.property_id,\n p.property_name,\n AVG(res.check_out_date - res.check_in_date) AS avg_stay_days\nFROM hospitality_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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "Which is the token with the largest difference between its highest and lowest price in the last 24h on each chain, and what is the token's symbol and current price?" }, { "role": "assistant", "content": "SELECT chain, token_symbol, price, (highest_price_24h - lowest...
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 character varying(100) NOT NULL, -- the id of the token", "token_name character...
[ { "role": "user", "content": "For each claim, show the claim ID, incident date, and the number of documents attached to it. Only include claims that have at least 2 documents." }, { "role": "assistant", "content": "SELECT c.claim_id, c.incident_date, COUNT(d.document_id) AS document_count\nFROM ...
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": "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 the average maintenance cost for each service type per vehicle." }, { "role": "assistant", "content": "SELECT vehicle_id,\n service_type,\n AVG(cost) AS avg_cost\nFROM transportation.maintenance_logs\nGROUP BY vehicle_id, service_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 transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "Show me all rooms that are currently available (status = 'available') and have a non-smoking policy, along with their room type details including base rate and max occupancy." }, { "role": "assistant", "content": "SELECT r.room_id, r.room_number, r.floor, rt.type_na...
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.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room...
[ { "role": "user", "content": "Show prescriptions with their corresponding chief complaint from the medical record. Return prescription_id, record_id, and chief_complaint." }, { "role": "assistant", "content": "SELECT p.prescription_id, p.record_id, mr.chief_complaint\nFROM healthcare.prescriptio...
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 text, first_name text, last_name text, specialty text, license_number text, phone_number...
[ { "role": "user", "content": "I need to find all components associated with a specific supplier. Can you help with that?" }, { "role": "assistant", "content": "HGETALL component:<component_id>\nIF HGET component:<component_id> supplier_id = 'sup:ACME_AERO' THEN INCLUDE" }, { "role": "use...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure Use Hashes. Key pattern: 'component:<component_id>'. Example: HSET component:LGSTRUT01 part_numbe...
[ { "role": "user", "content": "For each transaction, list the total value transferred and the number of different addresses involved (either as sender or receiver)." }, { "role": "assistant", "content": "SELECT transaction_id, SUM(value) AS total_value_transferred, COUNT(DISTINCT addr) AS num_add...
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, token_id text, from_address text, to_address text, value numeric, transaction_...
[ { "role": "user", "content": "Which SUI coins have a supply greater than 10,000 and include their symbol and name?" }, { "role": "assistant", "content": "SELECT scm.symbol, scm.name, sc.coin_type, SUM(CAST(sc.balance AS DECIMAL)) AS total_supply FROM sui_coins sc JOIN sui_coins_metadata scm ON 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": "Show me the top 5 projects by valuation that have completed fundraising rounds in the last 12 months, along with their token symbol and price from the token_basic_info table." }, { "role": "assistant", "content": "SELECT pfr.project_name, pfr.valuation, tbi.token_sy...
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.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "For each player, calculate the total quantity of items they have acquired. Return player_id and total_quantity." }, { "role": "assistant", "content": "SELECT player_id,\n SUM(quantity) AS total_quantity\nFROM gaming_technology.player_inventory\nGROUP BY player...
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_inventory ( inventory_id uuid PRIMARY KEY, player_id uuid, item_id uuid, quantity int, acquire...
[ { "role": "user", "content": "Retrieve all pairs of distinct contract IDs that were created by the same creator within an hour of each other. Include the creator address and the timestamps of both contracts." }, { "role": "assistant", "content": "SELECT sc1.creator_address, sc1.contract_id AS 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 blockchain.smart_contracts ( contract_id.text, creator_address.text, code.text, timestamp.timestamp )
[ { "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": "I need to get the most recent message each verified user has sent in any group chat, showing username, group_name, message_id, and sent_at." }, { "role": "assistant", "content": "WITH user_recent AS (\n SELECT m.sender_user_id, m.message_id, m.conversation_id, m.se...
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 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": "Show me the total payment amounts grouped by currency_code and payment_method for payments with status 'Succeeded'. Include currency_code, payment_method, and total_amount." }, { "role": "assistant", "content": "SELECT currency_code, payment_method, SUM(amount) 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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Show me the top 5 NFT collections with the highest floor price on Ethereum, along with their names and contract addresses, but only include collections with more than 5000 tokens." }, { "role": "assistant", "content": "SELECT nc.name, nc.contract_address, nc.floor_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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t...
[ { "role": "user", "content": "Show me all active managers along with their property IDs and the number of staff members they supervise, ordered by the number of supervised staff in descending order." }, { "role": "assistant", "content": "SELECT s.staff_id, s.property_id, s.first_name, s.last_nam...
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, -- unique identifier for the staff member ...
[ { "role": "user", "content": "Show me the usernames and email addresses of users who commented on any post tagged with the hashtag 'H777'." }, { "role": "assistant", "content": "SELECT DISTINCT u.username, u.email\nFROM social_media.comments c\nJOIN social_media.users u ON c.user_id = u.user_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.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "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": "List all contracts with status 'active' and include the number of events they've emitted in the last 30 days." }, { "role": "assistant", "content": "SELECT c.contract_id, c.address, COUNT(e.event_id) AS recent_event_count FROM web3.contracts c LEFT JOIN web3.events ...
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 player, show how many achievements they have unlocked in games with items of type 'Consumable'." }, { "role": "assistant", "content": "SELECT pa.player_id, COUNT(DISTINCT pa.achievement_id) AS achievements_unlocked\nFROM gaming_technology.player_achievement...
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 PRIMARY KEY, name text, country text, founded_year int, website text, ...
[ { "role": "user", "content": "I need a list of claim_ids that have at least one document of type 'Photo' and at least one of type 'Invoice'." }, { "role": "assistant", "content": "SELECT DISTINCT cd.claim_id\nFROM insurance.claim_documents cd\nWHERE cd.document_type IN ('Photo', 'Invoice');" }...
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": "What is the total market cap for all tokens listed on the 'Polygon' chain?" }, { "role": "assistant", "content": "SELECT SUM(market_cap) FROM token_dexpool_info WHERE chain = 'Polygon';" }, { "role": "user", "content": "Only sum the market cap for tokens...
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_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexpool token_name character varying(10...
[ { "role": "user", "content": "List the medical record ID and record date for all medical records that are linked to an appointment whose duration was longer than the average duration of all appointments." }, { "role": "assistant", "content": "SELECT T1.record_id, T1.record_date FROM healthcare.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.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number...
[ { "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": "Count the number of trips for each route type." }, { "role": "assistant", "content": "SELECT R.type, COUNT(T.trip_id) FROM transportation.trips AS T JOIN transportation.routes AS R ON T.route_id = R.route_id GROUP BY R.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 transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati...
[ { "role": "user", "content": "Can you narrow this down to only show cases where the case type is 'Criminal'?" }, { "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 = 'Crimin...
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": "Show me the object ID, coin type, and balance for all SUI coins where the status is 'active'." }, { "role": "assistant", "content": "SELECT object_id, coin_type, balance FROM sui_coins WHERE status = 'active'" }, { "role": "user", "content": "Also, inclu...
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": "Can you show me the total number of passengers registered in the database?" }, { "role": "assistant", "content": "db.passengers.countDocuments({})" } ]
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('passengers') // Optional: db.passengers.createIndex({ passenger_id: 1 }, ...
[ { "role": "user", "content": "Show all SUI coins that are marked as 'exists' in both sui_coins and sui_coins_metadata, displaying their coin_type, symbol, name, and balance." }, { "role": "assistant", "content": "SELECT sc.coin_type, scm.symbol, scm.name, sc.balance FROM sui_coins sc JOIN sui_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 erc1155_approval_for_all ( block_number bigint NOT NULL, -- Block number containing the transaction block_times...
[ { "role": "user", "content": "List all services with an average processing time greater than the overall average processing time for all services. Show the service name, average processing time, and the overall average processing time." }, { "role": "assistant", "content": "SELECT service_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.services ( service_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, ser...
[ { "role": "user", "content": "For all NFT collections on the Ethereum blockchain, show me the collection name and the current floor price. Sort by floor price descending." }, { "role": "assistant", "content": "SELECT name, floor_price FROM nft_collections WHERE blockchain = 'Ethereum' ORDER BY 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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t...
[ { "role": "user", "content": "List all maintenance services performed on vehicle 'VHCL789', showing the service date and type." }, { "role": "assistant", "content": "SELECT service_date, service_type FROM transportation.maintenance_logs WHERE vehicle_id = 'VHCL789';" }, { "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 transportation.maintenance_logs ( log_id text, vehicle_id text, service_date date, odometer_reading integer, service_ty...
[ { "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 is the average age of verified citizens as of today?" }, { "role": "assistant", "content": "SELECT AVG(EXTRACT(YEAR FROM AGE(NOW(), date_of_birth))) AS average_age_verified\nFROM government_services.citizens\nWHERE is_verified = 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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "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": "I’d like to find all pairs of securities that belong to the same sector." }, { "role": "assistant", "content": "SELECT a.security_id, a.ticker_symbol, b.security_id AS pair_security_id, b.ticker_symbol AS pair_ticker_symbol, a.sector\nFROM financial_services.securit...
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.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu...
[ { "role": "user", "content": "List all premium payments made after April 1, 2024, including the payment_id, policy_id, customer_id, and amount_paid." }, { "role": "assistant", "content": "SELECT payment_id, policy_id, customer_id, amount_paid\nFROM insurance.premium_payments\nWHERE payment_date ...
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, policy_id character varying(64) NOT NULL, custo...
[ { "role": "user", "content": "For each developer, can you find the next developer in the same country using a self join, returning developer_ids and names?" }, { "role": "assistant", "content": "SELECT d1.developer_id AS current_dev,\n d1.name AS current_name,\n d2.develo...
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 PRIMARY KEY, name text, country text, founded_year int, website text, ...
[ { "role": "user", "content": "What is the total commission earned from all trades executed in the 'NYSE' venue by employees in the 'Trading' department?" }, { "role": "assistant", "content": "SELECT SUM(t.commission) AS total_commission FROM financial_services.trades t JOIN financial_services.em...
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.trades ( trade_id.text, account_id.text, security_id.text, order_id.text, trade_type.text, quantity....
[ { "role": "user", "content": "How many likes has post 'P789' received in total?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS total_likes\nFROM social_media.likes\nWHERE post_id = 'P789';" } ]
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 first name, last name, and email for all clients registered in January 2023." }, { "role": "assistant", "content": "SELECT first_name, last_name, email FROM legal_services.clients WHERE EXTRACT(YEAR FROM date_registered) = 2023 AND EXTRACT(MONTH FROM dat...
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, -- unique identifier for the client first_n...
[ { "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": "Which states have the highest number of customers? Provide the top 5 states along with their customer counts, ordered by count descending." }, { "role": "assistant", "content": "SELECT\n state,\n COUNT(*) AS customer_count\nFROM insurance.customers\nGROUP BY 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 character varying(64) NOT NULL, -- unique identifier for the customer first_...
[ { "role": "user", "content": "List document names and versions for documents that share the same case_id, showing each pair of versions." }, { "role": "assistant", "content": "SELECT d1.case_id, d1.document_name AS doc_name_v1, d1.version AS version1, d2.document_name AS doc_name_v2, d2.version ...
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 character varying(64) NOT NULL, -- unique identifier for the document c...
[ { "role": "user", "content": "Show me all transactions (transaction_id, amount, transaction_type) where the transaction_type is 'Transfer' and the status is 'Completed', along with the account_id and related_account_id." }, { "role": "assistant", "content": "SELECT transaction_id, amount, 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 financial_services.transactions ( transaction_id character varying(64) NOT NULL, -- unique identifier for the trans...
[ { "role": "user", "content": "Show me the top 3 tokens with the highest 7-day price change percentage. Display their symbol, chain, and 7d price change." }, { "role": "assistant", "content": "SELECT token_symbol, chain, price_change_percentage_7d\nFROM token_basic_info\nORDER BY price_change_per...
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.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "I want to see each active agent and the total premium_amount of the policies they sold in 2024." }, { "role": "assistant", "content": "SELECT a.agent_id, a.first_name, a.last_name, SUM(p.premium_amount) AS total_premium\nFROM insurance.agents a\nJOIN insurance.polic...
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": "Can you show me the user IDs and their theme settings for all users who have enabled email notifications and have updated their settings in 2024?" }, { "role": "assistant", "content": "SELECT user_id, theme FROM social_media.user_settings WHERE email_notifications_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 social_media.user_settings ( setting_id text PRIMARY KEY, user_id text, theme text, email_notifications_enabled bool, p...
[ { "role": "user", "content": "What is the schedule of trains arriving at station with ID 'ST789' tomorrow?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide the train schedule for station ID 'ST789' as this information is not available in the current database. The table only ...
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...