system
stringlengths
2.68k
8.8k
conversations
listlengths
4
34
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details t...
[ { "role": "user", "content": "Count the number of logs for each action type." }, { "role": "assistant", "content": "SELECT action,\n COUNT(*) AS count\nFROM trading_platform.logs\nGROUP BY action;" }, { "role": "user", "content": "What is the reason for the termination of emplo...
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. You are an expert in writing database language and you can refuse the user's question if the question is not related...
[ { "role": "user", "content": "What is the reason behind the cost variation for maintenance of asset_id 'ASSET456' over the past year?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the reasons behind cost variations for maintenance. The data in the maintenan...
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. You are an expert in writing database language and you can refuse the user's question if the question is not related...
[ { "role": "user", "content": "What is the average delay time for trains departing from platform 4 at station LMN during the past year?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on train delay times as this data is not stored in the platforms table. The tab...
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. You are an expert in writing database language and you can refuse the user's question if the question is not related...
[ { "role": "user", "content": "What are the environmental impact assessments for the production of the Airbus A350 model?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to data regarding the environmental impact assessments for the production of specific aircraft models...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text,...
[ { "role": "user", "content": "What are the top 5 product types by average base premium, showing the product_type and average base_premium, ordered by average base_premium descending?" }, { "role": "assistant", "content": "SELECT product_type, AVG(base_premium) AS avg_premium FROM insurance.insur...
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. You are an expert in writing database language and you can refuse the user's question if the question is not related...
[ { "role": "user", "content": "What is the manufacturing date of the train car with car_id 'CAR789'?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to information about the manufacturing date of train cars. The data available in the train_cars table only includes detail...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, produc...
[ { "role": "user", "content": "Retrieve the count of active insurance products for each product_type and order the results by the count descending." }, { "role": "assistant", "content": "SELECT product_type,\n COUNT(*) AS active_count\nFROM insurance.insurance_products\nWHERE is_active = TR...
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 social_media.conversations ( conversation_id character varying(64) NOT NULL, created_...
[ { "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 expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.users ( user_id.text, username.text, email.text, password_hash.text, created_at....
[ { "role": "user", "content": "For each user, show how many users registered after them. Return the user_id, username, and the count of later registrants." }, { "role": "assistant", "content": "SELECT u1.user_id, u1.username, COUNT(u2.user_id) AS later_user_count FROM web3.users u1 LEFT JOIN web3...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for ...
[ { "role": "user", "content": "List the token symbol and name for all tokens whose associated contract address has emitted at least one event. Also include the contract address." }, { "role": "assistant", "content": "SELECT T.token_symbol, T.token_name, T.contract_address FROM web3.tokens AS T JO...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number....
[ { "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 expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.patient_insurance ( patient_insurance_id text, patient_id text, plan_id te...
[ { "role": "user", "content": "How many insurance policies have 'Group' in their group_number?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM healthcare.patient_insurance WHERE group_number ILIKE '%Group%';" }, { "role": "user", "content": "List all pairs of wallets that ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for ...
[ { "role": "user", "content": "For each token, show its token_id, decimals, and the average total_supply of all tokens with the same decimals." }, { "role": "assistant", "content": "SELECT t.token_id,\n t.decimals,\n avg_data.avg_total_supply\nFROM web3.tokens t\nJOIN (\n SELECT deci...
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.smart_contracts ( contract_id.text, creator_address.text, code.text, times...
[ { "role": "user", "content": "Find all smart contracts where the contract code contains the keyword 'proxy'." }, { "role": "assistant", "content": "SELECT contract_id, creator_address, timestamp FROM blockchain.smart_contracts WHERE code LIKE '%proxy%';" }, { "role": "user", "content...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.routes ( route_id.text, route_number.text, description.text, origin_lo...
[ { "role": "user", "content": "List all pairs of routes where the origin location of one route is the destination location of the other, showing both route numbers and their types." }, { "role": "assistant", "content": "SELECT r1.route_number AS route_number_1, r1.type AS type_1,\n r2.route...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.insurance_plans ( plan_id text PRIMARY KEY, plan_name text, insurance_prov...
[ { "role": "user", "content": "Provide each pair of plans that share the same plan_type but are offered by different providers." }, { "role": "assistant", "content": "SELECT p1.plan_type,\n p1.plan_id AS plan1_id,\n p1.plan_name AS plan1_name,\n p1.insurance_provider AS provider...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address text...
[ { "role": "user", "content": "List all pairs of token transfers occurring within the same transaction where one transferred value is greater than the other, showing both transfer IDs, the transaction ID, and both values." }, { "role": "assistant", "content": "SELECT t1.transaction_id,\n t1...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, produc...
[ { "role": "user", "content": "List all insurance products along with their product types and the date they were last updated, but only include products where the base premium is greater than 2000." }, { "role": "assistant", "content": "SELECT product_id, product_name, product_type, updated_at\nF...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id.text, invoice_number.text, client_id.text, case_...
[ { "role": "user", "content": "Count the total number of invoices issued in each calendar year and month. Show the year, month, and the count, ordered chronologically." }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM issue_date) AS issue_year, EXTRACT(MONTH FROM issue_date) AS issu...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name characte...
[ { "role": "user", "content": "List all law firms founded in the year 2015. Show their names, phone numbers, and website." }, { "role": "assistant", "content": "SELECT firm_name, phone, website\nFROM legal_services.law_firms\nWHERE EXTRACT(YEAR FROM founded_date) = 2015;" }, { "role": "us...
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 social_media.hashtags ( hashtag_id.text, tag_name.text, created_at.timestamp ) CREATE...
[ { "role": "user", "content": "How many notifications are there for each distinct notification type?" }, { "role": "assistant", "content": "SELECT notification_type, COUNT(*) FROM social_media.notifications GROUP BY notification_type;" }, { "role": "user", "content": "What is the aver...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, as...
[ { "role": "user", "content": "List all unique peer ports that have been used at least once in the system." }, { "role": "assistant", "content": "SELECT DISTINCT port FROM trading_platform.peers ORDER BY port ASC;" }, { "role": "user", "content": "List pairs of smoking and non-smoking...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, t...
[ { "role": "user", "content": "List all wallet addresses holding NFTs for contract address '0xabcdef...'. Show the wallet address and amount held." }, { "role": "assistant", "content": "SELECT wallet_address, amount, token_id FROM nft_holders WHERE contract_address = '0xabcdef...';" }, { ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), userna...
[ { "role": "user", "content": "For each player, show the player_id and the count of inventory items they acquired with a quantity greater than 1." }, { "role": "assistant", "content": "SELECT player_id, COUNT(inventory_id) AS items_qty_gt_1_count FROM gaming_technology.player_inventory WHERE quan...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.payments ( payment_id character varying(64) NOT NULL, application...
[ { "role": "user", "content": "For each payment method, show the total number of completed payments and the total amount paid." }, { "role": "assistant", "content": "SELECT payment_method, COUNT(*) AS completed_count, SUM(amount) AS total_paid FROM government_services.payments WHERE status = 'Com...
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 social_media.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, ...
[ { "role": "user", "content": "How many unread notifications are there with the type 'mention'?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM social_media.notifications WHERE read_at IS NULL AND notification_type = 'mention';" }, { "role": "user", "content": "List all do...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birt...
[ { "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 expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.users ( user_id character varying(64) NOT NULL, username character varying(128) ...
[ { "role": "user", "content": "For each user, find the previous user by registration time. List current user_id and username, previous user_id and username, and the time difference in minutes between their registrations." }, { "role": "assistant", "content": "SELECT u.user_id AS current_user_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 CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, -- un...
[ { "role": "user", "content": "Count the number of documents for each unique document type." }, { "role": "assistant", "content": "SELECT document_type, COUNT(*) AS document_count FROM government_services.documents GROUP BY document_type ORDER BY document_count DESC;" }, { "role": "user",...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text,...
[ { "role": "user", "content": "List all active products with a base premium exceeding 1500 that were created after January 1, 2023, including their product name, type, and base premium. Order the results by creation date ascending." }, { "role": "assistant", "content": "SELECT product_name, produ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.te...
[ { "role": "user", "content": "Provide a list of all log entries recorded since the start of 2024, including the user ID, action, and the exact time the log occurred." }, { "role": "assistant", "content": "SELECT user_id, action, logged_at FROM logs WHERE logged_at >= '2024-01-01';" }, { ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, m...
[ { "role": "user", "content": "For each trip, can you show the trip_id, number of passengers, and the make and model of the assigned vehicle?" }, { "role": "assistant", "content": "SELECT b.trip_id, COUNT(b.passenger_id) AS passenger_count, v.make, v.model\nFROM transportation.bookings b\nJOIN tr...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character v...
[ { "role": "user", "content": "How many prescriptions are there for each refills_allowed value?" }, { "role": "assistant", "content": "SELECT refills_allowed,\n COUNT(*) AS prescription_count\nFROM healthcare.prescriptions\nGROUP BY refills_allowed;" }, { "role": "user", "conten...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.wallets ( wallet_id character varying(64) NOT NULL, -- unique identifier fo...
[ { "role": "user", "content": "Find all wallets that were created by users with IDs starting with 'user_' and show their addresses along with creation timestamps." }, { "role": "assistant", "content": "SELECT address, created_at FROM web3.wallets WHERE user_id LIKE 'user_%';" }, { "role":...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, -- uniq...
[ { "role": "user", "content": "Retrieve the product_id, product_name, base_premium, and created_at for all active insurance products with a base_premium greater than 1000, ordered by base_premium descending." }, { "role": "assistant", "content": "SELECT\n product_id,\n product_name,\n base_pre...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, patient_id cha...
[ { "role": "user", "content": "For each patient, count the total number of medical records they have in the system, and show patient_id along with record_count." }, { "role": "assistant", "content": "SELECT patient_id,\n COUNT(*) AS record_count\nFROM healthcare.medical_records\nGROUP BY pa...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birt...
[ { "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;" }, { "role": "user", "content": "List all users whose password hash contains th...
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 te...
[ { "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 expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.employees ( employee_id.text, agency_id.text, first_name.text, la...
[ { "role": "user", "content": "List the full names and hire dates of all employees who report directly to a manager with the job title 'Director'." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, e.hire_date\nFROM government_services.employees e\nJOIN government_services.e...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.notifications ( notification_id.text, citizen_id.text, applicatio...
[ { "role": "user", "content": "For each application that has at least one failed notification, provide the application ID, the total number of notifications received for that application, and the count of failed notifications." }, { "role": "assistant", "content": "SELECT application_id, COUNT(*)...
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_id...
[ { "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 CREATE TABLE smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the toke...
[ { "role": "user", "content": "For each chain, which token had the highest number of smart money addresses buying it this week? Show the token symbol and narrative too." }, { "role": "assistant", "content": "SELECT chain, token_symbol, narrative, MAX(address_amount) AS max_buyers FROM smart_money...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, -- unique identifier for ...
[ { "role": "user", "content": "Show the transaction ID, the transaction value from the transactions table, and the sum of the value from token_transfers for all transactions that have at least one associated token transfer. Name the sum column total_token_transfer_value." }, { "role": "assistant", ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.services ( service_id character varying(64) NOT NULL, agency_id c...
[ { "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 expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "Find all addresses that have both sent and received tokens. For each, show the address, the total value sent, and the total value received." }, { "role": "assistant", "content": "SELECT s.address, s.total_sent, r.total_received\nFROM (\n SELECT from_address AS addr...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE smart_money_profit ( address text, rank numeric, profit numeric, roi numeric, realize...
[ { "role": "user", "content": "How many addresses on the Ethereum chain have an ROI between 2 and 4?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS address_count FROM smart_money_profit WHERE chain = 'Ethereum' AND roi >= 2 AND roi <= 4;" }, { "role": "user", "content": "Co...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyin...
[ { "role": "user", "content": "For each contract that has received transactions, list its address and the total value of Ether received." }, { "role": "assistant", "content": "SELECT T1.address, SUM(T2.value) FROM web3.contracts AS T1 JOIN web3.transactions AS T2 ON T1.address = T2.to_address GRO...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, claim_id char...
[ { "role": "user", "content": "Find the claim ID and the total number of documents associated with each claim ID that has more than 10 documents." }, { "role": "assistant", "content": "SELECT claim_id, COUNT(*) FROM insurance.claim_documents GROUP BY claim_id HAVING COUNT(*) > 10;" }, { "...
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 social_media.users ( user_id character varying(64) NOT NULL, username character varyi...
[ { "role": "user", "content": "Find all users who have set their bio to a non-empty value, showing their username and email." }, { "role": "assistant", "content": "SELECT username, email\nFROM social_media.users\nWHERE bio IS NOT NULL AND TRIM(bio) != '';" }, { "role": "user", "conten...
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 p...
[ { "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" }, { "role": "user", "content": "Report the number of employees for each department, 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 gaming_technology.achievements ( achievement_id.uuid, game_id.uuid, name.text, descri...
[ { "role": "user", "content": "Could you list each game_id along with the count of hidden achievements and the count of visible achievements?" }, { "role": "assistant", "content": "SELECT game_id,\n SUM(CASE WHEN hidden THEN 1 ELSE 0 END) AS hidden_count,\n SUM(CASE WHEN NOT hidden TH...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.employees ( employee_id character varying(64) NOT NULL, -- un...
[ { "role": "user", "content": "Which department has the highest number of employees currently employed?" }, { "role": "assistant", "content": "SELECT department FROM government_services.employees WHERE termination_date IS NULL GROUP BY department ORDER BY COUNT(*) DESC LIMIT 1;" }, { "rol...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agency...
[ { "role": "user", "content": "List all agents and their managers' full names." }, { "role": "assistant", "content": "SELECT a.first_name, a.last_name, m.first_name AS manager_first_name, m.last_name AS manager_last_name FROM insurance.agents a LEFT JOIN insurance.agents m ON a.manager_id = m.age...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyin...
[ { "role": "user", "content": "List the usernames and registration dates for users who registered before the earliest deployed contract." }, { "role": "assistant", "content": "SELECT T1.username, T1.created_at FROM web3.users AS T1 JOIN (SELECT MIN(deployed_at) AS earliest_deploy FROM web3.contra...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE financial_services.trades ( trade_id character varying(64) NOT NULL, account_id chara...
[ { "role": "user", "content": "List each account number and the total quantity of shares traded through it." }, { "role": "assistant", "content": "SELECT T2.account_number, SUM(T1.quantity) FROM financial_services.trades AS T1 JOIN financial_services.accounts AS T2 ON T1.account_id = T2.account_i...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.t...
[ { "role": "user", "content": "Count the total number of employees who have a direct manager assigned." }, { "role": "assistant", "content": "SELECT COUNT(employee_id) FROM government_services.employees WHERE manager_employee_id IS NOT NULL;" }, { "role": "user", "content": "List the ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.services ( service_id text PRIMARY KEY, agency_id text, service_n...
[ { "role": "user", "content": "Which services have the longest average processing times? List the top 5 services by average processing time." }, { "role": "assistant", "content": "SELECT\n service_name,\n average_processing_time_days\nFROM\n government_services.services\nORDER BY\n average_pr...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id text, claim_id text, document_type text, file...
[ { "role": "user", "content": "For each claim, retrieve the document_id, file_name, and uploaded_at of the earliest and the latest uploaded document." }, { "role": "assistant", "content": "SELECT\n c1.claim_id,\n c1.document_id AS earliest_document_id,\n c1.file_name AS earliest_file_nam...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, -- unique ident...
[ { "role": "user", "content": "Show all wallet addresses that have ever received a UTXO." }, { "role": "assistant", "content": "SELECT DISTINCT address\nFROM trading_platform.utxos;" }, { "role": "user", "content": "Show me all invoice numbers and due dates where the amount paid is ex...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character...
[ { "role": "user", "content": "List all appointments that are currently scheduled and show their appointment time." }, { "role": "assistant", "content": "SELECT appointment_id, patient_id, doctor_id, appointment_time FROM healthcare.appointments WHERE status = 'Scheduled';" }, { "role": "...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_lo...
[ { "role": "user", "content": "List every booking together with the route number and description for the trip being booked." }, { "role": "assistant", "content": "SELECT b.booking_id, b.passenger_id, b.trip_id, r.route_number, r.description\nFROM transportation.bookings b\nJOIN transportation.rou...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyin...
[ { "role": "user", "content": "Show the wallet address, token symbol, and the total value received by each wallet for each token. Only include wallets that have received tokens." }, { "role": "assistant", "content": "SELECT w.address AS wallet_address, t.token_symbol, SUM(tt.value) AS total_recei...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, ...
[ { "role": "user", "content": "For each route, show the route number and the total number of trips associated with it." }, { "role": "assistant", "content": "SELECT T2.route_number, count(T1.trip_id) FROM transportation.trips AS T1 JOIN transportation.routes AS T2 ON T1.route_id = T2.route_id GRO...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, spe...
[ { "role": "user", "content": "Find all doctors who have a hospital affiliation and include their full names (concatenated), specialties, and affiliation IDs." }, { "role": "assistant", "content": "SELECT CONCAT(first_name, ' ', last_name) AS full_name, specialty, hospital_affiliation_id FROM hea...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE gaming_technology.game_sessions ( session_id uuid, player_id uuid, game_id uuid, serv...
[ { "role": "user", "content": "For each game, which server has hosted the most sessions?" }, { "role": "assistant", "content": "SELECT game_id, server_id, COUNT(*) AS session_count FROM gaming_technology.game_sessions GROUP BY game_id, server_id;" }, { "role": "user", "content": "I wa...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.reviews ( review_id text, property_id text, reservation_id tex...
[ { "role": "user", "content": "Show me each staff member by response_staff_id and the number of unique guests whose reviews they have responded to." }, { "role": "assistant", "content": "SELECT response_staff_id, COUNT(DISTINCT guest_id) AS unique_guest_count\nFROM hospitality_technology.reviews\...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, -- unique...
[ { "role": "user", "content": "For each document type, how many documents were uploaded by each user? Show the uploaded_by, document_type, and document count, ordered by document_type and count descending." }, { "role": "assistant", "content": "SELECT uploaded_by, document_type, COUNT(*) AS docum...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, addres...
[ { "role": "user", "content": "What is the average cost per unit for fuel at each location type? Show the location type and the average cost." }, { "role": "assistant", "content": "SELECT T2.type , AVG(T1.cost_per_unit) FROM transportation.fuel_logs AS T1 JOIN transportation.locations AS T2 ON T...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE hospitality_technology.payments ( payment_id text, reservation_id text, guest_id text...
[ { "role": "user", "content": "List all payments made using a credit card, including guest_id, amount, payment_method, and payment_timestamp." }, { "role": "assistant", "content": "SELECT guest_id, amount, payment_method, payment_timestamp FROM hospitality_technology.payments WHERE payment_method...
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_number...
[ { "role": "user", "content": "Can you help me get a list of components and their associated materials, including the supplier information for each component?" }, { "role": "assistant", "content": "SMEMBERS material_components:<material_id>\nHGETALL component:<component_id>\nHGET component:<compo...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.t...
[ { "role": "user", "content": "I would like to see a list of agencies and the names of their respective parent agencies." }, { "role": "assistant", "content": "SELECT a.agency_id, a.agency_name, p.agency_name AS parent_agency_name\nFROM government_services.agencies a\nLEFT JOIN government_service...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text...
[ { "role": "user", "content": "List all policies that expired in the last 30 days, along with their product IDs and premium amounts." }, { "role": "assistant", "content": "SELECT policy_id, product_id, premium_amount FROM insurance.policies WHERE end_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 3...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.time_entries ( entry_id text, case_id text, lawyer_id text, date_worke...
[ { "role": "user", "content": "Show me the total hours worked and total amount billed for each case that has associated invoices, along with the case ID and invoice number." }, { "role": "assistant", "content": "SELECT t.case_id, i.invoice_number, SUM(t.hours_spent) AS total_hours, SUM(t.hours_sp...
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 social_media.follows ( follow_id.text, follower_user_id.text, following_user_id.text,...
[ { "role": "user", "content": "For each user, count how many different conversations they have participated in. Show user_id and conversation_count." }, { "role": "assistant", "content": "SELECT user_id, COUNT(DISTINCT conversation_id) AS conversation_count\nFROM social_media.conversation_partici...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, ...
[ { "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';" }, { "role": "user", "content": ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, -- unique identifie...
[ { "role": "user", "content": "Show each contract address and the count of successful transactions sent to that contract." }, { "role": "assistant", "content": "SELECT c.address, COUNT(t.transaction_id) AS success_tx_count FROM web3.contracts c JOIN web3.transactions t ON t.to_address = c.address...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.time_entries ( entry_id character varying(64) NOT NULL, -- unique...
[ { "role": "user", "content": "List all time entries where the description includes the word 'email', showing the entry ID, date worked, hours spent, and description." }, { "role": "assistant", "content": "SELECT entry_id, date_worked, hours_spent, description FROM legal_services.time_entries WHE...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text,...
[ { "role": "user", "content": "Show me the full name of every lawyer, their specialization, and the number of cases they are the lead lawyer for." }, { "role": "assistant", "content": "SELECT CONCAT(l.first_name, ' ', l.last_name) AS lawyer_name, l.specialization, COUNT(c.case_id) AS lead_case_co...
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 social_media.comments ( comment_id character varying(64) NOT NULL, post_id character ...
[ { "role": "user", "content": "How many likes were given to comments in June 2024?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS comment_likes_count\nFROM social_media.likes\nWHERE comment_id IS NOT NULL \n AND DATE_TRUNC('month', created_at) = '2024-06-01';" }, { "role": "us...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character ...
[ { "role": "user", "content": "Find all customers who have at least two active policies with overlapping coverage periods. List the customer ID and the policy numbers of any two such overlapping active policies." }, { "role": "assistant", "content": "SELECT\n p1.customer_id,\n p1.policy_number ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for ...
[ { "role": "user", "content": "Count how many tokens exist for each contract_address." }, { "role": "assistant", "content": "SELECT contract_address,\n COUNT(*) AS token_count\nFROM web3.tokens\nGROUP BY contract_address;" }, { "role": "user", "content": "Now only include contra...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.premium_payments ( payment_id character varying(64) NOT NULL, -- unique...
[ { "role": "user", "content": "Find all pairs of overlapping payment periods for the same customer. Return customer_id, first payment_id as payment1_id, second payment_id as payment2_id, and both periods' start and end dates." }, { "role": "assistant", "content": "SELECT p1.customer_id,\n p...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.premium_payments ( payment_id character varying(64) NOT NULL, -- unique...
[ { "role": "user", "content": "How many premium payments are currently in 'Pending' status?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM insurance.premium_payments WHERE status = 'Pending';" }, { "role": "user", "content": "How many notifications have been sent by each ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.applications ( application_id text, citizen_id text, service_id t...
[ { "role": "user", "content": "For each citizen, show their citizen ID and the total number of applications and notifications they have." }, { "role": "assistant", "content": "SELECT c.citizen_id,\n COALESCE(a.application_count, 0) AS application_count,\n COALESCE(n.notification_count...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.services ( service_id text, agency_id text, service_name text, de...
[ { "role": "user", "content": "List the names of employees and the agency they work for who have scheduled at least one appointment. Show the employee's first name, last name, and agency_id." }, { "role": "assistant", "content": "SELECT DISTINCT e.first_name, e.last_name, e.agency_id\nFROM govern...
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 }, { un...
[ { "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' });" }, { "role": "user", "content": "Show me the top 5 users with the most KYC ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdic...
[ { "role": "user", "content": "Provide the message_subject and agency_name for all notifications that are related to agencies and have a status of 'Sent'." }, { "role": "assistant", "content": "SELECT n.message_subject, a.agency_name\nFROM government_services.notifications n\nJOIN government_serv...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.agencies ( agency_id text, agency_name text, jurisdiction_level t...
[ { "role": "user", "content": "Which service locations are not accessible and belong to agencies with a jurisdiction level of 'Local'? Show the location name and city." }, { "role": "assistant", "content": "SELECT sl.location_name, sl.city\nFROM government_services.service_locations sl\nINNER JOI...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(...
[ { "role": "user", "content": "List all pairs of transactions where the recipient of the first transaction became the sender in the second, showing the first transaction_id, the second transaction_id, the shared address, and the timestamps of both transactions." }, { "role": "assistant", "content...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, ...
[ { "role": "user", "content": "Retrieve each agency’s name along with the count of accessible service locations it has in California." }, { "role": "assistant", "content": "SELECT\n a.agency_name,\n COUNT(l.location_id) AS accessible_location_count\nFROM government_services.agencies a\nJOIN gov...
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.smart_contracts ( contract_id text PRIMARY KEY, creator_address text, code...
[ { "role": "user", "content": "Show me the earliest created smart contract for each creator address." }, { "role": "assistant", "content": "SELECT DISTINCT ON (creator_address) contract_id, creator_address, code, timestamp FROM blockchain.smart_contracts ORDER BY creator_address, timestamp ASC;" ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number....
[ { "role": "user", "content": "Show me the names of all law firms and the total number of lawyers associated with each firm." }, { "role": "assistant", "content": "SELECT T1.firm_name, count(T2.lawyer_id) FROM legal_services.law_firms AS T1 JOIN legal_services.lawyers AS T2 ON T1.firm_id = T2.fir...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id uuid NOT NULL DEFAULT gen_random_uuid...
[ { "role": "user", "content": "Show for each developer and inventory item combination the number of times that item appears in player inventories." }, { "role": "assistant", "content": "SELECT d.developer_id, d.name AS developer_name, pi.item_id, COUNT(pi.inventory_id) AS inventory_count FROM gam...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE legal_services.clients ( client_id text, first_name text, last_name text, company_nam...
[ { "role": "user", "content": "Find all clients and lawyers who share the same phone area code, and show each client's first and last name, each lawyer's first and last name, and the shared area code." }, { "role": "assistant", "content": "SELECT c.first_name AS client_first_name, c.last_name AS ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid, username text, email text, password_hash ...
[ { "role": "user", "content": "Can you list each developer's name along with the number of games they have published by joining developers and games?" }, { "role": "assistant", "content": "SELECT d.name AS developer_name,\n COUNT(g.game_id) AS games_published\nFROM gaming_technology.develop...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birt...
[ { "role": "user", "content": "Retrieve the first and last names and email addresses of all customers who registered after '2024-01-01'." }, { "role": "assistant", "content": "SELECT first_name, last_name, email FROM insurance.customers WHERE created_at > '2024-01-01';" }, { "role": "user...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "Show the plan name and insurance provider for all insurance plans along with the total number of unique patients enrolled in each plan." }, { "role": "assistant", "content": "SELECT ip.plan_name, ip.insurance_provider, COUNT(DISTINCT pi.patient_id) AS enrolled_patie...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE gaming_technology.servers ( server_id uuid, game_id uuid, server_name text, region te...
[ { "role": "user", "content": "List all server names and their statuses." }, { "role": "assistant", "content": "SELECT server_name, status FROM gaming_technology.servers;" }, { "role": "user", "content": "Can you also include the region and current_players for each server?" }, { ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id character varying(64) NOT NULL, -- unique ide...
[ { "role": "user", "content": "List all token transfers with a value greater than 1000000. Show transfer ID, token ID, from address, to address, and value." }, { "role": "assistant", "content": "SELECT\n transfer_id,\n token_id,\n from_address,\n to_address,\n value\nFROM web3.token_transfer...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name...
[ { "role": "user", "content": "How many drivers and passengers have email addresses ending with 'company.com'? Return the count for each group." }, { "role": "assistant", "content": "SELECT 'drivers' AS role, COUNT(*) AS count\nFROM transportation.drivers\nWHERE email LIKE '%@company.com'\nUNION ...