conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Can you write a query that retrieves each server's name, its region, and the highest current player count observed in that region?"
},
{
"role": "assistant",
"content": "SELECT s.server_name, s.region, m.max_current_players\nFROM gaming_technology.servers s\nJOIN (\... | You are an SQL statement expert. Given the table 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.servers ( server_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, server_name chara... |
[
{
"role": "user",
"content": "List the token symbol, token name, and contract address for all tokens that have no recorded transfers in the token_transfers table."
},
{
"role": "assistant",
"content": "SELECT T.token_symbol, T.token_name, T.contract_address FROM web3.tokens AS T LEFT JOIN token_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.tokens (
token_id character varying(64) NOT NULL, -- unique identifier for the token
contract_address cha... |
[
{
"role": "user",
"content": "For each department, what is the earliest and latest employee hire date?"
},
{
"role": "assistant",
"content": "SELECT department, MIN(hire_date) AS earliest_hire_date, MAX(hire_date) AS latest_hire_date FROM financial_services.employees GROUP BY department;"
},
... | You are an SQL statement expert. Given the table 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.employees ( employee_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ... |
[
{
"role": "user",
"content": "List clients whose status is 'active' and registered in the year 2024."
},
{
"role": "assistant",
"content": "SELECT * FROM legal_services.clients WHERE status = 'active' AND EXTRACT(YEAR FROM date_registered) = 2024;"
},
{
"role": "user",
"content": "Al... | You are an SQL statement expert. Given the table 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": "List all insurance plans that have more than 100 distinct patients enrolled. Return plan_id, plan_name, and patient_count."
},
{
"role": "assistant",
"content": "SELECT ip.plan_id,\n ip.plan_name,\n COUNT(DISTINCT pi.patient_id) AS patient_count\nFROM he... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.prescriptions ( prescription_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, pa... |
[
{
"role": "user",
"content": "Show properties and the names of their room types."
},
{
"role": "assistant",
"content": "SELECT T1.property_name , T2.type_name FROM hospitality_technology.properties AS T1 JOIN hospitality_technology.room_types AS T2 ON T1.property_id = T2.property_id"
},
{... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types (
room_type_id character varying(64) NOT NULL, -- unique identifier for the room ... |
[
{
"role": "user",
"content": "I want to find the top 5 wallets by USD value of their ERC20 holdings. Show wallet_address, token symbol, and USD value based on the latest price."
},
{
"role": "assistant",
"content": "SELECT b.wallet_address, p.symbol, SUM(CAST(b.amount AS numeric) * p.price) AS u... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "List all SUI NFT objects with status 'exists' and show their object ID, name, and owner."
},
{
"role": "assistant",
"content": "SELECT object_id, name, owner FROM sui_nfts WHERE status = 'exists';"
},
{
"role": "user",
"content": "Add their collection_ty... | You are an SQL statement expert. Given the table 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, block_timestamp.timestamp, transaction_index.integer, transaction_hash.... |
[
{
"role": "user",
"content": "Count the number of active services provided by each agency. Show the agency name and the count."
},
{
"role": "assistant",
"content": "SELECT a.agency_name, COUNT(s.service_id) AS active_service_count FROM government_services.agencies AS a JOIN government_services.... | You are an SQL statement expert. Given the table 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 each contract along with the deployer address, and status for contracts deployed on network_id 'mainnet'."
},
{
"role": "assistant",
"content": "SELECT contract_id, address, deployer_address, status FROM web3.contracts WHERE network_id = 'mainnet';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,... |
[
{
"role": "user",
"content": "List all wallet addresses that hold any NFT currently. Show the wallet address and the count of distinct token IDs they hold."
},
{
"role": "assistant",
"content": "SELECT wallet_address, COUNT(DISTINCT token_id) FROM nft_holders GROUP BY wallet_address;"
},
{
... | You are an SQL statement expert. Given the table 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": "For each group conversation, show its name and the creation time of the earliest notification associated with it."
},
{
"role": "assistant",
"content": "SELECT c.group_name, MIN(n.created_at) AS earliest_notification_time FROM social_media.conversations AS c JOIN so... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_grou... |
[
{
"role": "user",
"content": "Show the product name, type, and creation date for products created before January 1st, 2023."
},
{
"role": "assistant",
"content": "SELECT product_name, product_type, created_at FROM insurance.insurance_products WHERE created_at < '2023-01-01';"
},
{
"role"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id text, product_name text, product_type text, description text, base_premium nu... |
[
{
"role": "user",
"content": "List all users who have pending orders for cryptocurrency assets, along with the asset_id and order quantity."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, o.asset_id, o.quantity FROM trading_platform.users u JOIN trading_platform.orders o ON u.u... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Calculate the total value of unspent UTXOs for each user whose KYC status has been 'approved'."
},
{
"role": "assistant",
"content": "SELECT kyc.user_id, SUM(u.amount) FROM trading_platform.kyc_audit kyc JOIN trading_platform.utxos u ON kyc.user_id = u.user_id WHERE... | You are an SQL statement expert. Given the table 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.utxos ( utxo_id.text, transaction_id.text, output_index.integer, address.text, amount.numeric, spent.b... |
[
{
"role": "user",
"content": "How many hashtags are associated with each post? Return post_id and alias it as hashtag_count, but only show posts with more than one hashtag."
},
{
"role": "assistant",
"content": "SELECT post_id, COUNT(*) AS hashtag_count\nFROM social_media.post_hashtags\nGROUP BY... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.post_hashtags ( post_hashtag_id.text, post_id.text, hashtag_id.text )
CREATE TABLE social_media.conversati... |
[
{
"role": "user",
"content": "Show me all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address, from the nft_holders table."
},
{
"role": "assistant",
"content": "SELECT nh.wallet_address, nh.token_id, nh.contract_address FROM nft_holders 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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "How many posts have a media file attached?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM social_media.posts WHERE media_url IS NOT NULL;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "Show the total number of reservations for each booking source."
},
{
"role": "assistant",
"content": "SELECT booking_source, COUNT(*) FROM hospitality_technology.reservations GROUP BY booking_source"
},
{
"role": "user",
"content": "Also include the tota... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Show me the full name and email of each client along with the subject and location of all appointments they have, and include the name of the lawyer for each appointment."
},
{
"role": "assistant",
"content": "SELECT c.first_name || ' ' || c.last_name AS client_full... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id.text, first_name.text, last_name.text, company_name.text, email.text, phone.text, ad... |
[
{
"role": "user",
"content": "List all active staff members who are managers, along with their hire dates and email addresses."
},
{
"role": "assistant",
"content": "SELECT staff_id, first_name, last_name, hire_date, work_email FROM hospitality_technology.staff WHERE is_active = true AND positio... | You are an SQL statement expert. Given the table 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": "I need to find pairs of players who share the same email domain. For each pair, return player1_id, player2_id, and the shared domain."
},
{
"role": "assistant",
"content": "SELECT p1.player_id AS player1_id,\n p2.player_id AS player2_id,\n LOWER(SPLIT_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 gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "How many users does each user follow? Show the follower user ID and the count."
},
{
"role": "assistant",
"content": "SELECT follower_user_id, count(*) FROM social_media.follows GROUP BY follower_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.follows ( follow_id text, follower_user_id text, following_user_id text, created_at timestamp )
|
[
{
"role": "user",
"content": "Please list the full name and status of clients who have not provided a company name."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, status\nFROM legal_services.clients\nWHERE company_name IS NULL;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Find all nodes that share the same IP address but have different node_ids."
},
{
"role": "assistant",
"content": "SELECT n1.ip_address, n1.node_id as node_id1, n2.node_id as node_id2 FROM blockchain.nodes n1 JOIN blockchain.nodes n2 ON n1.ip_address = n2.ip_address ... | You are an SQL statement expert. Given the table 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.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen timestamp )
|
[
{
"role": "user",
"content": "What are the top 5 tokens by net_flow in smart_money_token_performance along with their chain and ROI?"
},
{
"role": "assistant",
"content": "SELECT token_symbol, chain, net_flow, roi FROM smart_money_token_performance ORDER BY net_flow DESC LIMIT 5;"
},
{
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "For each vehicle, find the vehicle in the same depot that was acquired immediately before it. Display the current vehicle_id, acquisition_date, previous vehicle_id, and its acquisition_date."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id, v.acquisition_d... | You are an SQL statement expert. Given the table 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": "List smart money addresses, their chain, and profit for those who have incurred a loss. Order the results by the magnitude of the loss (smallest profit value first)."
},
{
"role": "assistant",
"content": "SELECT address, chain, profit FROM smart_money_profit WHERE 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 smart_money_profit ( address character varying(100) NOT NULL, rank INT, profit numer... |
[
{
"role": "user",
"content": "Get total quantity_dispensed and average refills_allowed for each medication_id, plan_id, and policy_number for patients with active primary insurance (expiration_date is null or in the future)."
},
{
"role": "assistant",
"content": "SELECT p.medication_id,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.prescriptions ( prescription_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, pa... |
[
{
"role": "user",
"content": "Find all ERC20 tokens with a total supply greater than 1 billion, including their names, symbols, and contract addresses."
},
{
"role": "assistant",
"content": "SELECT name, symbol, contract_address FROM token_metas WHERE is_erc20 = 1 AND CAST(total_supply AS decima... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "Show me the name and founding date of every law firm."
},
{
"role": "assistant",
"content": "SELECT firm_name, founded_date\nFROM law_firms;"
},
{
"role": "user",
"content": "Also include the firm's phone number."
},
{
"role": "assistant",
"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 legal_services.law_firms (
firm_id character varying(64) NOT NULL, -- unique identifier for the law firm
firm_... |
[
{
"role": "user",
"content": "List all properties in the USA that have a phone number but no email address listed."
},
{
"role": "assistant",
"content": "SELECT property_name, city, state_province FROM hospitality_technology.properties WHERE country_code = 'US' AND phone_number IS NOT NULL AND 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 hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "Show me all invoices for cases with status 'Closed'."
},
{
"role": "assistant",
"content": "SELECT T1.* FROM legal_services.invoices AS T1 JOIN legal_services.cases AS T2 ON T1.case_id = T2.case_id WHERE T2.status = 'Closed';"
},
{
"role": "user",
"conte... | You are an SQL statement expert. Given the table 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 each room's number and the total amount of payments processed for that room."
},
{
"role": "assistant",
"content": "SELECT r.room_number, SUM(p.amount) AS total_payments\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology.payments p ON r.room_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 hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "List each user's username, email, and the total count of log entries they have recorded."
},
{
"role": "assistant",
"content": "SELECT T1.username, T1.email, count(T2.log_id) FROM users AS T1 LEFT JOIN logs AS T2 ON T1.user_id = T2.user_id GROUP BY T1.user_id, T1.us... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Which games have the highest number of different in-game items of type 'Weapon'? Show the game title and the count."
},
{
"role": "assistant",
"content": "SELECT g.title AS game_title, COUNT(*) AS weapon_count\nFROM gaming_technology.in_game_items i\nJOIN gaming_tec... | You are an SQL statement expert. Given the table 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": "Find pairs of time entries for the same invoice where one entry is billed and the other is not."
},
{
"role": "assistant",
"content": "SELECT a.invoice_id,\n a.entry_id AS billed_entry,\n b.entry_id AS unbilled_entry\nFROM legal_services.time_entries a\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 legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billi... |
[
{
"role": "user",
"content": "Find all token transfers where the value is greater than 1000, including the token name and symbol, along with the transaction details like from_address and gas_used."
},
{
"role": "assistant",
"content": "SELECT t.token_name, t.token_symbol, tr.from_address, tr.to_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"role": "user",
"content": "Could you list each developer along with the next developer founded after them in the same country? Return columns current_developer, next_developer, and years_difference."
},
{
"role": "assistant",
"content": "SELECT d1.name AS current_developer,\n d2.name AS... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_... |
[
{
"role": "user",
"content": "Count the number of metadata entries for each asset."
},
{
"role": "assistant",
"content": "SELECT asset_id, COUNT(*) AS metadata_count\nFROM trading_platform.metadata\nGROUP BY asset_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 character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address ch... |
[
{
"role": "user",
"content": "Could you list the trip ID, scheduled and actual arrival times, and the associated vehicle's make and model for all trips where the actual arrival was more than 30 minutes later than scheduled?"
},
{
"role": "assistant",
"content": "SELECT T1.trip_id, T1.scheduled_a... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ... |
[
{
"role": "user",
"content": "What are the average liquidity and price of tokens on the BSC chain?"
},
{
"role": "assistant",
"content": "SELECT AVG(liquidity) AS avg_liquidity, AVG(price) AS avg_price FROM token_dexpool_info WHERE chain = 'BSC';"
},
{
"role": "user",
"content": "Can... | You are an SQL statement expert. Given the table 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": "Retrieve pairs of law firms that share the same managing_partner_id, showing the firm names and the managing_partner_id."
},
{
"role": "assistant",
"content": "SELECT lf1.firm_name AS firm1, lf2.firm_name AS firm2, lf1.managing_partner_id FROM legal_services.law_fir... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms (
firm_id character varying(64) NOT NULL, -- unique identifier for the law firm
firm_... |
[
{
"role": "user",
"content": "Show the details of all UTXOs with an amount greater than 5, ordered by amount descending."
},
{
"role": "assistant",
"content": "SELECT utxo_id, transaction_id, output_index, address, amount, spent\nFROM trading_platform.utxos\nWHERE amount > 5\nORDER BY amount DES... | You are an SQL statement expert. Given the table 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 text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "List all invoices with a total_amount greater than 5000, and show the associated case name and client_id."
},
{
"role": "assistant",
"content": "SELECT i.invoice_id, i.invoice_number, i.total_amount, i.client_id, c.case_name\nFROM legal_services.invoices i\nLEFT JOI... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases ( case_id character varying(64) NOT NULL, case_number character varying(100) UNIQUE, case_name tex... |
[
{
"role": "user",
"content": "Show me wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address."
},
{
"role": "assistant",
"content": "SELECT wallet_address, token_id, contract_address FROM erc20_balances WHERE CAST(amount AS decimal) > 1000;"
... | You are an SQL statement expert. Given the table 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": "For all currently active policies, show the policy number, the customer's first and last name, and the total amount paid for that policy across all premium payments."
},
{
"role": "assistant",
"content": "SELECT T1.policy_number, T2.first_name, T2.last_name, SUM(T3.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "Show me all reservations made by guests whose last name starts with 'S', along with the first and last name of the guest, and the property ID."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, g.first_name, g.last_name, r.property_id FROM hospitality_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.guests ( guest_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, la... |
[
{
"role": "user",
"content": "List all reservations that have made multiple payment transactions. Return reservation_id and payment_id for each occurrence."
},
{
"role": "assistant",
"content": "SELECT DISTINCT p1.reservation_id, p1.payment_id\nFROM hospitality_technology.payments p1\nJOIN hospi... | You are an SQL statement expert. Given the table 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.payments (
payment_id character varying(64) NOT NULL, -- unique identifier for the payment ... |
[
{
"role": "user",
"content": "Find all patients who have both a primary insurance plan and at least one completed appointment, along with their insurance policy numbers and the count of appointments."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, pi.policy_number, 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 healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "What is the current location of train number Acela 2151?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to real-time location data for trains. The database only contains static information such as train ID, model, capacity, and maintenance... | 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.t... |
[
{
"role": "user",
"content": "List all patients who have a chronic diagnosis, showing their patient ID, first and last name, and the description of the diagnosis."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, d.description FROM healthcare.diagnoses d JOIN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses ( diagnosis_id text, record_id text, patient_id text, doctor_id text, diagnosis_code text, code_ty... |
[
{
"role": "user",
"content": "Show me all properties in California with a star rating above 3.5, along with their room types and base rates."
},
{
"role": "assistant",
"content": "SELECT p.property_name, p.city, p.star_rating, rt.type_name, rt.base_rate FROM hospitality_technology.properties p J... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Find all pairs of lawyers who share the same specialization."
},
{
"role": "assistant",
"content": "SELECT l1.lawyer_id AS lawyer1_id,\n l2.lawyer_id AS lawyer2_id,\n l1.specialization\nFROM legal_services.lawyers l1\nJOIN legal_services.lawyers l2\n ON... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers (
lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer
first_n... |
[
{
"role": "user",
"content": "Show me claim_id, incident_date, policy_number, and customer full name for all claims where settlement_amount is null."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.incident_date, p.policy_number, cu.first_name || ' ' || cu.last_name AS customer_full_n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "Get the count of insurance policies for each patient. Return patient_id and policy_count."
},
{
"role": "assistant",
"content": "SELECT patient_id, COUNT(*) AS policy_count FROM healthcare.patient_insurance GROUP BY patient_id;"
},
{
"role": "user",
"con... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Show me all nodes that were last seen in the last 7 days, along with their IP addresses and ports."
},
{
"role": "assistant",
"content": "SELECT node_id, ip_address, port, last_seen FROM blockchain.nodes WHERE last_seen >= CURRENT_DATE - INTERVAL '7 days';"
},
{... | You are an SQL statement expert. Given the table 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.nodes ( node_id text, ip_address text, port integer, last_seen timestamp )
CREATE TABLE blockchain.users (
... |
[
{
"role": "user",
"content": "How many posts has user 'U150' made so far?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS post_count\nFROM social_media.posts\nWHERE user_id = 'U150';"
}
] | You are an SQL statement expert. Given the table 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": "Count the total number of public posts."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.posts WHERE visibility = 'public';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts (
post_id character varying(64) NOT NULL, -- unique identifier for the post
user_id characte... |
[
{
"role": "user",
"content": "Can you show me the full name, date of birth, and policy number for all patients who have insurance policies that will expire in the next 60 days, including the insurance plan ID?"
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, p.date_of_bir... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "For the 'DeFi' narrative, what is the average ROI and the total net inflow (usd_value where type=1) from smart money token inflow?"
},
{
"role": "assistant",
"content": "SELECT AVG(sm.roi) AS avg_roi, SUM(smt.usd_value) AS total_net_inflow\nFROM smart_money_token_in... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri... |
[
{
"role": "user",
"content": "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 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 SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t... |
[
{
"role": "user",
"content": "For each user, list their user_id, username, the count of log entries in the last 30 days, and the count of unread notifications."
},
{
"role": "assistant",
"content": "SELECT u.user_id,\n u.username,\n COUNT(l.log_id) FILTER (WHERE l.logged_at >= 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 trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens with decimals equal to 18."
},
{
"role": "assistant",
"content": "SELECT name, contract_address, total_supply FROM token_metas WHERE ... | You are an SQL statement expert. Given the table 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 post_id, content, author's username, and the number of comments for each post where media_type is 'video'."
},
{
"role": "assistant",
"content": "SELECT p.post_id, p.content, u.username, COUNT(c.comment_id) AS comment_count\nFROM social_media.posts p\nJO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "How many open cases does each client have? Display the client ID, first name, last name, and the count."
},
{
"role": "assistant",
"content": "SELECT T1.client_id, T1.first_name, T1.last_name, COUNT(T2.case_id) AS open_case_count FROM clients AS T1 JOIN cases AS T2 ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id.text, first_name.text, last_name.text, company_name.text, email.text, phone.text, ad... |
[
{
"role": "user",
"content": "Can you show me the average session duration and total score for each server and game combination?"
},
{
"role": "assistant",
"content": "SELECT server_id, game_id, AVG(duration_seconds) AS avg_duration, SUM(score) AS total_score FROM gaming_technology.game_sessions... | You are an SQL statement expert. Given the table 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.game_sessions ( session_id uuid, player_id uuid, game_id uuid, server_id uuid, start_time timestamp w... |
[
{
"role": "user",
"content": "List pairs of smoking and non-smoking rooms on the same floor for each property, showing the property_id, floor, smoking room_number, and non_smoking room_number."
},
{
"role": "assistant",
"content": "SELECT r1.property_id,\n r1.floor,\n r1.room_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 hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat... |
[
{
"role": "user",
"content": "List the names and symbols of all assets that are mentioned in the description of any DApp."
},
{
"role": "assistant",
"content": "SELECT DISTINCT a.name, a.symbol\nFROM trading_platform.assets a\nJOIN trading_platform.dapps d ON d.description ILIKE '%' || a.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 trading_platform.assets (
asset_id character varying(64) NOT NULL, -- unique identifier for the asset
name cha... |
[
{
"role": "user",
"content": "Give me a count of all notifications sent to each user."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(*) AS notification_count\nFROM trading_platform.notifications\nGROUP BY user_id;"
},
{
"role": "user",
"content": "Now, only show users w... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address ch... |
[
{
"role": "user",
"content": "For each fundraising round, what is the average valuation of the participating projects? Show the round name and the average valuation."
},
{
"role": "assistant",
"content": "SELECT rounds_name, AVG(valuation) AS avg_valuation FROM project_fundraising_record WHERE v... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "How many documents are set to expire in the year 2025?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS document_count\nFROM government_services.documents\nWHERE expiry_date >= '2025-01-01' AND expiry_date < '2026-01-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies (
agency_id character varying(64) NOT NULL, -- unique identifier for the agency
ag... |
[
{
"role": "user",
"content": "Show the total billed hours and total billed amount for each case that has at least one billed and billable time entry."
},
{
"role": "assistant",
"content": "SELECT t.case_id, c.case_number, SUM(t.hours_spent) AS total_billed_hours, SUM(t.hours_spent * t.billing_ra... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases (
case_id character varying(64) NOT NULL, -- unique identifier for the case/matter
case_n... |
[
{
"role": "user",
"content": "List all rooms that include 'Kitchenette' in their features, showing the room number, property ID, and floor."
},
{
"role": "assistant",
"content": "SELECT room_number, property_id, floor\nFROM hospitality_technology.rooms\nWHERE features LIKE '%Kitchenette%';"
},... | You are an SQL statement expert. Given the table 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 text, property_id text, room_number text, room_type_id text, floor integer, stat... |
[
{
"role": "user",
"content": "List all upcoming appointments within the next 7 days along with each client's full name, email, appointment subject, and start_time."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, \n c.first_name || ' ' || c.last_name AS client_full_name, \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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Show me the top 10 token transfers by value, including the token ID and the transaction ID, sorted in descending order."
},
{
"role": "assistant",
"content": "SELECT token_id, transaction_id, value FROM web3.token_transfers ORDER BY value DESC LIMIT 10;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address text, to_address text, value numeric, ... |
[
{
"role": "user",
"content": "Show me all conversation IDs (whether group chat or not) that have at least one hashtag used in posts linked to them."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.conversation_id\nFROM social_media.conversations c\nJOIN social_media.post_hashtags ph ON 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 social_media.post_hashtags (
post_hashtag_id character varying(64) NOT NULL, -- unique identifier for the post-hash... |
[
{
"role": "user",
"content": "Show me the top 5 users who have the highest total order quantity, along with their order type and the average price they paid."
},
{
"role": "assistant",
"content": "SELECT user_id, order_type, SUM(quantity) as total_quantity, AVG(price) as avg_price 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.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan... |
[
{
"role": "user",
"content": "Retrieve the names of all properties that have listed room types, along with the name of each room type available at that property."
},
{
"role": "assistant",
"content": "SELECT t1.property_name, t2.type_name FROM hospitality_technology.properties AS t1 INNER JOIN h... | You are an SQL statement expert. Given the table 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 properties that have at least one room type with 'Queen' beds and at least one service in the 'Wellness' category."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.property_id FROM hospitality_technology.room_types AS T1 JOIN hospitality_technology.ser... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types ( room_type_id text, property_id text, type_name text, description text, base_rate nu... |
[
{
"role": "user",
"content": "List the usernames and status of all players who have 'de' as their country_code."
},
{
"role": "assistant",
"content": "SELECT username, status FROM gaming_technology.players WHERE country_code = 'DE';"
},
{
"role": "user",
"content": "Can you also 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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "List all case numbers, names, and types."
},
{
"role": "assistant",
"content": "SELECT case_number, case_name, case_type FROM legal_services.cases;"
},
{
"role": "user",
"content": "Only include cases opened after 2023."
},
{
"role": "assistant",... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.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 all claims with police reports that were filed in the last 3 months, along with the policy details and customer information."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.policy_id, c.customer_id, c.incident_date, c.reported_date, c.description... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara... |
[
{
"role": "user",
"content": "List the first and last name of every citizen and the city of the service location where they have had an appointment scheduled."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, sl.city\nFROM government_services.appointments a\nINNER JOIN gov... | You are an SQL statement expert. Given the table 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": "Find the average settlement_amount of closed claims for each claim handler. Return claim_handler_id and avg_settlement_amount."
},
{
"role": "assistant",
"content": "SELECT c.claim_handler_id, AVG(c.settlement_amount) AS avg_settlement_amount\nFROM insurance.claims ... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "How many players are registered for each country? Return the country_code and the player count."
},
{
"role": "assistant",
"content": "SELECT country_code, COUNT(*) AS player_count FROM gaming_technology.players GROUP BY country_code;"
},
{
"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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "能否帮我查询特定路线(route_id 为 'RT001')的所有行程信息,并关联到乘客的联系方式?"
},
{
"role": "assistant",
"content": "SELECT s.schedule_id, s.train_id, s.route_id, s.departure_datetime, s.arrival_datetime, s.status, p.passenger_id, p.first_name, p.last_name, p.phone_number, p.email\nFROM sched... | 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
// PUT /schedules
{
"mappings": {
"properties": {
"schedule_id": { "type": "keyword" ... |
[
{
"role": "user",
"content": "List the name, type, and city for all properties located in 'Canada'."
},
{
"role": "assistant",
"content": "SELECT property_name, property_type, city FROM hospitality_technology.properties WHERE country_code = 'CAN';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Find all events that occurred in transactions involving token transfers from a specific address '0x1234', showing the event name and token transfer value."
},
{
"role": "assistant",
"content": "SELECT e.event_name, tt.value FROM web3.events e JOIN web3.token_transfe... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events ( event_id text PRIMARY KEY, contract_id text, event_name text, data text, emitted_at timestamp, transactio... |
[
{
"role": "user",
"content": "Show me all asset types along with the count of distinct assets and the count of log actions for each type."
},
{
"role": "assistant",
"content": "SELECT a.type, COUNT(DISTINCT a.asset_id) AS asset_count, COUNT(l.log_id) AS action_count FROM trading_platform.assets ... | You are an SQL statement expert. Given the table 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.assets ( asset_id text, name text, symbol text, type text )
CREATE TABLE trading_platform.logs ( log_i... |
[
{
"role": "user",
"content": "List all distinct medication IDs that have been prescribed with more than 5 refills allowed."
},
{
"role": "assistant",
"content": "SELECT DISTINCT medication_id FROM healthcare.prescriptions WHERE refills_allowed > 5;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.prescriptions ( prescription_id text PRIMARY KEY, record_id text, patient_id text, doctor_id text, medicatio... |
[
{
"role": "user",
"content": "Show all diagnoses, including the diagnosis ID, description, diagnosis date, and the full name of the doctor who made the diagnosis."
},
{
"role": "assistant",
"content": "SELECT T1.diagnosis_id, T1.description, T1.diagnosis_date, T2.first_name, T2.last_name FROM he... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch... |
[
{
"role": "user",
"content": "List all reservations that have at least one service order, showing the reservation ID, the check-in date, and the total number of service orders placed for that reservation."
},
{
"role": "assistant",
"content": "SELECT T1.reservation_id, T1.check_in_date, COUNT(T2... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.reservations ( reservation_id character varying(64) NOT NULL, property_id character varying(64) ... |
[
{
"role": "user",
"content": "Which agencies have at least one accessible service location and how many active services does each of those agencies offer? Provide agency_id, agency_name, location_count, and active_service_count."
},
{
"role": "assistant",
"content": "SELECT a.agency_id, a.agency... | You are an SQL statement expert. Given the table 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": "Show me the top 5 tokens by market cap on the Ethereum chain, along with their 24-hour trading volume and price from the token_basic_info table."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, market_cap, total_volume, price FROM token_basic_... | You are an SQL statement expert. Given the table 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, token_name character varying(100) NOT NULL, token_symbol ch... |
[
{
"role": "user",
"content": "List all comments made by user with ID 'user456', including their content and creation time."
},
{
"role": "assistant",
"content": "SELECT content, created_at FROM social_media.comments WHERE user_id = 'user456';"
},
{
"role": "user",
"content": "From 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 social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ... |
[
{
"role": "user",
"content": "Show me all drivers who have completed more than 5 trips in the last month, along with their contact information and the average passenger count per trip."
},
{
"role": "assistant",
"content": "SELECT d.driver_id, d.first_name, d.last_name, d.contact_number, d.email... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ... |
[
{
"role": "user",
"content": "Show me a list of all achievements with their name, point value, and the title of the game they are part of."
},
{
"role": "assistant",
"content": "SELECT\n T1.name,\n T1.points,\n T2.title\nFROM gaming_technology.achievements AS T1\nJOIN gaming_technology.games ... | You are an SQL statement expert. Given the table 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": "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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.