conversations listlengths 2 8 | system stringlengths 298 8.24k |
|---|---|
[
{
"content": "List all managers (employees who have other employees reporting to them) along with the count of their direct reports, showing only those with more than 5 reports.",
"role": "user"
},
{
"content": "SELECT e.employee_id, e.first_name, e.last_name, COUNT(r.employee_id) as direct_reports_... | You are an SQL statement expert. Given the table 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 text PRIMARY KEY, first_name text, last_name text, job_title text, departmen... |
[
{
"content": "List the first and last name of each citizen along with the city and state of the service location for their agency.",
"role": "user"
},
{
"content": "SELECT c.first_name, c.last_name, sl.city, sl.state\nFROM government_services.citizens c\nJOIN government_services.payments p ON c.citi... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "Show me all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address.",
"role": "user"
},
{
"content": "SELECT nh.wallet_address, nh.token_id, nh.contract_address FROM nft_holders nh WHERE nh.contract_type = 'ERC1155' AND CAST(nh.amou... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"content": "Find all pairs of different insurance records that share the same group_number, and show group_number, the patient_insurance_id of both records, and their corresponding patient_ids.",
"role": "user"
},
{
"content": "SELECT a.group_number,\n a.patient_insurance_id AS pi_id1,\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.patient_insurance ( patient_insurance_id text, patient_id text, plan_id text, policy_number text, group_numb... |
[
{
"content": "List all inactive insurance products along with their creation dates.",
"role": "user"
},
{
"content": "SELECT product_name, created_at FROM insurance.insurance_products WHERE is_active = false;",
"role": "assistant"
},
{
"content": "Now order them by the most recently crea... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "For each Avalanche token tick, calculate the total transfer volume and transaction count over the past 7 days using token_activities_avalanche. Include the token tick, total_volume, and tx_count.",
"role": "user"
},
{
"content": "SELECT\n tick,\n SUM(amt) AS total_volume,\n 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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"content": "Which citizens have made successful payments and also have had at least one appointment scheduled? I want to see their first name, last name, total payment amount, and number of appointments.",
"role": "user"
},
{
"content": "SELECT c.first_name, c.last_name, SUM(p.amount) AS total_pay... | You are an SQL statement expert. Given the table 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
... |
[
{
"content": "Show me asset IDs and DApp names for metadata entries linking assets to DApps where metadata.value matches a dapp_id.",
"role": "user"
},
{
"content": "SELECT m.asset_id, d.name AS dapp_name\nFROM trading_platform.metadata m\nJOIN trading_platform.dapps d\n ON m.value = d.dapp_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... |
[
{
"content": "Retrieve the top 5 most expensive active services along with their agency names.",
"role": "user"
},
{
"content": "SELECT s.service_name, a.agency_name, s.standard_fee FROM government_services.services s JOIN government_services.agencies a ON s.agency_id = a.agency_id WHERE s.is_active... | You are an SQL statement expert. Given the table 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
... |
[
{
"content": "List all group chats and the total count of messages sent in each one.",
"role": "user"
},
{
"content": "SELECT T1.group_name, count(T2.message_id) AS message_count FROM social_media.conversations AS T1 JOIN social_media.messages AS T2 ON T1.conversation_id = T2.conversation_id WHERE 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 social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"content": "For each employee, retrieve their full name and the number of appointments scheduled for them in the next 7 days, including employees with no appointments.",
"role": "user"
},
{
"content": "SELECT e.first_name || ' ' || e.last_name AS full_name,\n COUNT(a.appointment_id) AS appoi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_e... |
[
{
"content": "List all documents that have multiple versions, including document_name, case_id, and the count of versions.",
"role": "user"
},
{
"content": "SELECT document_name,\n case_id,\n COUNT(*) AS version_count\nFROM legal_services.documents\nGROUP BY document_name, case_id\nHAVIN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... |
[
{
"content": "What is the current location of train number Acela 2151?",
"role": "user"
},
{
"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 schedules. For current l... | 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... |
[
{
"content": "List all ERC20 tokens where the price is between $1 and $10, including their names, symbols, and contract addresses.",
"role": "user"
},
{
"content": "SELECT tm.name, tm.symbol, tm.contract_address FROM token_metas tm JOIN token_prices_latest tpl ON tm.contract_address = tpl.contract_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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"content": "What is the schedule of trains arriving at station with ID 'ST789' tomorrow?",
"role": "user"
},
{
"content": "I'm sorry, but I can't provide the train schedule for station ID 'ST789' as this information is not available in the current database. The table only contains details about st... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.s... |
[
{
"content": "Find any two claims made by the same customer on the same day. Return customer_id, the two claim IDs, and the incident date.",
"role": "user"
},
{
"content": "SELECT c1.customer_id,\n c1.claim_id AS claim1_id,\n c2.claim_id AS claim2_id,\n DATE(c1.incident_date) AS 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 insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d... |
[
{
"content": "Show a list of all wallet addresses along with the user_id who owns them, sorted by the wallet creation time.",
"role": "user"
},
{
"content": "SELECT user_id, address FROM web3.wallets ORDER BY created_at;",
"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 web3.wallets (
wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet
user_id character... |
[
{
"content": "Find all contracts where the deployer address is the same as the contract address, indicating self-deployed contracts, and show their network IDs and deployment timestamps.",
"role": "user"
},
{
"content": "SELECT address, network_id, deployed_at FROM web3.contracts WHERE address = dep... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"content": "List the first name, last name, prescription ID, diagnosis code, and diagnosis description for patients who have both an ongoing prescription and an active chronic diagnosis.",
"role": "user"
},
{
"content": "SELECT DISTINCT T1.first_name, T1.last_name, T2.prescription_id, T3.diagnosis... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"content": "What is the current operational status of the train car with car_id 'CAR123'?",
"role": "user"
},
{
"content": "I'm sorry, but I can't provide information on the current operational status of the train car with car_id 'CAR123'. The data in the train_cars table does not include real-tim... | 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... |
[
{
"content": "Show me all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address.",
"role": "user"
},
{
"content": "SELECT wallet_address, token_id, contract_address FROM nft_holders WHERE contract_type = 'ERC1155' AND CAST(amount AS decimal) > 1... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas (
block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded
... |
[
{
"content": "Which token symbols have the highest number of addresses buying them on the Ethereum chain? Show the top 3 symbols, their total address_amount, and narrative.",
"role": "user"
},
{
"content": "SELECT token_symbol, narrative, SUM(address_amount) AS total_buying_addresses\nFROM smart_mon... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the token's address token_symbol character... |
[
{
"content": "Show me the details of tokens in the token_info_avalanche table that have the tick 'AVAX'.",
"role": "user"
},
{
"content": "SELECT * FROM token_info_avalanche WHERE tick = 'AVAX';",
"role": "assistant"
},
{
"content": "Okay, now refine that. Just show me the tick, creator,... | 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... |
[
{
"content": "我想查询某个飞机构建的所有检查记录,包括检查类型、检查结果、检查时间以及被检查的组件名称。",
"role": "user"
},
{
"content": "MATCH (ab:AircraftBuild)-[:UNDERWENT]->(i:Inspection)-[:INSPECTED_COMPONENT]->(c:Component)\nWHERE ab.build_id = 'specific_build_id'\nRETURN i.inspection_type, i.result, i.inspection_timestamp, c.component_... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
Node Label ':AircraftModel'. Properties: { model_id: String (Constraint: UNIQUE), model_name: Str... |
[
{
"content": "特定のプラットフォームID 'plat_123' に関連するメンテナンス記録を取得するのを手伝っていただけますか?また、記録のステータスも含めてください。",
"role": "user"
},
{
"content": "SMEMBERS platform:plat_123:maintenance\nHGETALL maintenance_record:<record_id>",
"role": "assistant"
},
{
"content": "ステータスが 'Completed' の記録だけを表示するようにフィルタリングしていただ... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// Use Hashes for ticket details. Key format: ticket:<ticket_id>
// HSET ticket:tkt_1a2b ticket_i... |
[
{
"content": "Show me the total transaction amount and count for each account type. Please include the account type and the total amount and count from the transactions table.",
"role": "user"
},
{
"content": "SELECT\n a.account_type,\n SUM(t.amount) AS total_transaction_amount,\n COUNT(t.transac... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts (
account_id character varying(64) NOT NULL, -- unique identifier for the account
c... |
[
{
"content": "List the names of services and the total number of times each service has been ordered. Only include services that have been ordered at least once.",
"role": "user"
},
{
"content": "SELECT T1.service_name, count(T2.order_id) AS order_count FROM hospitality_technology.services AS T1 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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"content": "Could you provide the total number of game sessions and the number of distinct players for each game genre? Display the genre, session count, and player count.",
"role": "user"
},
{
"content": "SELECT g.genre, COUNT(gs.session_id) AS session_count, COUNT(DISTINCT gs.player_id) AS playe... | You are an SQL statement expert. Given the table 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
... |
[
{
"content": "For each wallet, find the next wallet created by the same user. Return the user_id, the earlier wallet_id, the later wallet_id, and the time difference in minutes between their creation times.",
"role": "user"
},
{
"content": "SELECT user_id,\n wallet_id AS first_wallet_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 web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"content": "What is the total revenue generated by ticket sales at the station with ID 'ST101' for the past month?",
"role": "user"
},
{
"content": "I'm sorry, but I can't provide information on the revenue generated by ticket sales as this data is not available in the current database table. The ... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.s... |
[
{
"content": "Show me the top 5 users by the total number of trades they participated in as buyers, along with their wallet addresses.",
"role": "user"
},
{
"content": "SELECT u.user_id, u.username, w.address, COUNT(t.trade_id) AS trade_count FROM trading_platform.users u JOIN trading_platform.trade... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"content": "Show me the top 5 narratives by market cap, along with their 24-hour trading volume and 7-day price change percentage.",
"role": "user"
},
{
"content": "SELECT narrative.text, volume_24h.numeric, price_change_percentage_7d.numeric FROM narrative_info ORDER BY market_cap.numeric DESC LI... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume... |
[
{
"content": "I need to find all components associated with a specific supplier. Can you help with that?",
"role": "user"
},
{
"content": "HGETALL component:<component_id>\nIF HGET component:<component_id> supplier_id = 'sup:ACME_AERO' THEN INCLUDE",
"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
Use Hashes. Key pattern: 'component:<component_id>'. Example: HSET component:LGSTRUT01 part_numbe... |
[
{
"content": "Get the average overall review rating for each property. Return property_name and avg_rating.",
"role": "user"
},
{
"content": "SELECT pr.property_name, AVG(r.rating_overall) AS avg_rating\nFROM hospitality_technology.reviews r\nJOIN hospitality_technology.properties pr ON r.property_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.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"content": "List all claim documents of type 'POLICE_REPORT' uploaded in June 2024. Show document_id, claim_id, and file_name.",
"role": "user"
},
{
"content": "SELECT document_id, claim_id, file_name\nFROM insurance.claim_documents\nWHERE document_type = 'POLICE_REPORT'\n AND uploaded_at >= '202... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d... |
[
{
"content": "Show the distribution of total supply for tokens, grouped into ranges like < 1 million, 1 million to 1 billion, and > 1 billion. Count how many tokens fall into each range.",
"role": "user"
},
{
"content": "SELECT CASE WHEN total_supply < 1000000 THEN '< 1 million' WHEN total_supply >=... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "List all address IDs with a balance under 50, along with the count of transactions they have received.",
"role": "user"
},
{
"content": "SELECT a.address_id, a.balance, COUNT(t.transaction_id) AS received_count\nFROM blockchain.addresses a\nLEFT JOIN blockchain.transactions t ON a.addr... | You are an SQL statement expert. Given the table 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.transactions ( transaction_id text, block_id text, sender_address text, receiver_address text, amount numeri... |
[
{
"content": "Find the total transfer volume for each Avalanche token over the past 7 days and include the token's creator.",
"role": "user"
},
{
"content": "SELECT a.tick,\n i.creator,\n SUM(a.amt) AS total_volume\nFROM token_activities_avalanche a\nJOIN token_info_avalanche i\n ON a.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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"content": "List all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and belong to the 'Healthcare' sector, along with their last_updated timestamp.",
"role": "user"
},
{
"content": "SELECT security_id, ticker_symbol, security_name, last_updated FROM f... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities ( security_id character varying(64) NOT NULL, ticker_symbol character varying(20) NOT NUL... |
[
{
"content": "List the top 5 oldest verified citizens. Show each citizen's full name and date of birth.",
"role": "user"
},
{
"content": "SELECT\n first_name || ' ' || last_name AS full_name,\n date_of_birth\nFROM government_services.citizens\nWHERE is_verified = TRUE\nORDER BY date_of_birth ASC\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"content": "Show the full names and contact emails of citizens who have made payments for services offered by agencies where the employee with the job title 'Director' works.",
"role": "user"
},
{
"content": "SELECT DISTINCT c.first_name || ' ' || c.last_name AS full_name, c.contact_email\nFROM go... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"content": "Show me the number of accounts and their average balance for each status and currency combination.",
"role": "user"
},
{
"content": "SELECT status, currency, COUNT(*) AS account_count, AVG(balance) AS average_balance\nFROM financial_services.accounts\nGROUP BY status, currency;",
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba... |
[
{
"content": "I want to find pairs of transactions where one transaction’s related_account_id matches the other’s account_id, indicating reciprocal transfers between accounts.",
"role": "user"
},
{
"content": "SELECT t1.transaction_id AS outgoing_txn, t2.transaction_id AS incoming_txn, t1.account_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 financial_services.transactions ( transaction_id text PRIMARY KEY, account_id text, related_account_id text, transactio... |
[
{
"content": "List all Bitcoin token ticks and their creators from token_info_bitcoin.",
"role": "user"
},
{
"content": "SELECT tick, creator\nFROM token_info_bitcoin;",
"role": "assistant"
},
{
"content": "Include the total amount held by all wallets for each tick from token_balances_bi... | You are an SQL statement expert. Given the table 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_... |
[
{
"content": "Show the top 5 properties by average overall review rating.",
"role": "user"
},
{
"content": "SELECT p.property_name, AVG(r.rating_overall) AS avg_rating\nFROM hospitality_technology.properties p\nJOIN hospitality_technology.reviews r\n ON p.property_id = r.property_id\nGROUP BY p.pro... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"content": "我想查看所有检查记录中检查员的ID和检查结果,同时统计每个检查员的检查次数。",
"role": "user"
},
{
"content": "db.inspections.aggregate([\n {\n $group: {\n _id: '$inspector_employee_id',\n total_inspections: { $count: {} },\n results: { $push: '$result' }\n }\n },\n {\n $project: {\n inspect... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
Collection 'inspections'. Document structure: { _id: <ObjectId (or inspection_id)>, inspection_id... |
[
{
"content": "List all cryptocurrency assets that have been traded at least 50 times, along with their average trade price.",
"role": "user"
},
{
"content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) AS trade_count, AVG(t.price) AS avg_price FROM trading_platform.assets a JOIN 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.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"content": "I need to get the most recent message each verified user has sent in any group chat, showing username, group_name, message_id, and sent_at.",
"role": "user"
},
{
"content": "WITH user_recent AS (\n SELECT m.sender_user_id, m.message_id, m.conversation_id, m.sent_at,\n ROW_NUMB... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"content": "Show me all trips that were delayed by more than 1 hour, including their vehicle and driver IDs, along with the origin and destination location IDs.",
"role": "user"
},
{
"content": "SELECT trip_id, vehicle_id, driver_id, origin_location_id, destination_location_id FROM transportation.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips (
trip_id character varying(64) NOT NULL, -- unique identifier for a specific trip instance
... |
[
{
"content": "Show all token transfers including the token symbol and the address of the contract that created each token. List the transfer id, token id, value, transaction id, the contract address, and the token symbol.",
"role": "user"
},
{
"content": "SELECT tt.transfer_id, tt.token_id, tt.value... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "Show me all smart contracts created by addresses that have created more than 5 contracts, along with the count of contracts each creator has made.",
"role": "user"
},
{
"content": "SELECT sc.contract_id, sc.creator_address, COUNT(*) OVER (PARTITION BY sc.creator_address) AS contract_co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.smart_contracts ( contract_id.text, creator_address.text, code.text, timestamp.timestamp )
|
[
{
"content": "Show the top 3 tokens on Polygon with the greatest positive price change over the last 6 hours, including their symbol, price, 6h change, and the number of smart money buy addresses in the last 24h.",
"role": "user"
},
{
"content": "SELECT tdi.token_symbol, tdi.price, tdi.price_change_... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "How many reviews does each staff member respond to, along with their full name and the average response time in hours?",
"role": "user"
},
{
"content": "SELECT st.staff_id,\n st.first_name || ' ' || st.last_name AS staff_full_name,\n COUNT(*) AS response_count,\n AVG(... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "Count the total number of chronic diagnoses for each code_type.",
"role": "user"
},
{
"content": "SELECT\n code_type,\n COUNT(*) AS chronic_diagnosis_count\nFROM healthcare.diagnoses\nWHERE is_chronic = TRUE\nGROUP BY code_type;",
"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 healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_ty... |
[
{
"content": "List all appointments that have a location specified and their status is not 'Cancelled'. Show the appointment ID, subject, and location.",
"role": "user"
},
{
"content": "SELECT appointment_id, subject, location FROM legal_services.appointments WHERE location IS NOT NULL AND status <>... | You are an SQL statement expert. Given the table 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.appointments ( appointment_id character varying(64) NOT NULL, client_id character varying(64) NOT NULL, ... |
[
{
"content": "How many policies are there for each status, and what is the average premium amount for policies in each status?",
"role": "user"
},
{
"content": "SELECT status, COUNT(policy_id), AVG(premium_amount) FROM insurance.policies GROUP BY status ORDER BY COUNT(policy_id) DESC;",
"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.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ... |
[
{
"content": "Retrieve the average base premium of insurance products for each product_type, including only types that have more than 5 products.",
"role": "user"
},
{
"content": "SELECT product_type, AVG(base_premium) AS avg_premium\nFROM insurance.insurance_products\nGROUP BY product_type\nHAVING ... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "What are the safety ratings or crash statistics for the Boeing 787 Dreamliner?",
"role": "user"
},
{
"content": "I'm sorry, but I don't have access to safety ratings or crash statistics for specific aircraft models like the Boeing 787 Dreamliner. My data is limited to the information i... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.aircraft_mod... |
[
{
"content": "List all assets mentioned in DApp descriptions along with the DApp name and URL.",
"role": "user"
},
{
"content": "SELECT a.name AS asset_name,\n a.symbol AS asset_symbol,\n d.name AS dapp_name,\n d.url\nFROM trading_platform.assets a\nJOIN trading_platform.dapps d\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 trading_platform.assets (
asset_id character varying(64) NOT NULL, -- unique identifier for the asset
name cha... |
[
{
"content": "Show me the total price and quantity for each service order, along with the guest's full name.",
"role": "user"
},
{
"content": "SELECT t1.order_id, t1.total_price, t1.quantity, t2.first_name, t2.last_name FROM hospitality_technology.service_orders AS t1 JOIN hospitality_technology.gue... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"content": "Show me all messages sent after July 1, 2024, including the sender_user_id, content, and sent_at.",
"role": "user"
},
{
"content": "SELECT message_id, sender_user_id, content, sent_at\nFROM social_media.messages\nWHERE sent_at > '2024-07-01';",
"role": "assistant"
},
{
"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 social_media.messages ( message_id text PRIMARY KEY, conversation_id text, sender_user_id text, content text, media_url... |
[
{
"content": "For each service location, find the nearest accessible service location. Show the location_id, location_name, nearest_location_id, and the distance.",
"role": "user"
},
{
"content": "SELECT l.location_id,\n l.location_name,\n nearest.location_id AS nearest_location_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 government_services.service_locations ( location_id text PRIMARY KEY, agency_id text, location_name text, address text,... |
[
{
"content": "List all cases where the client and the lead lawyer belong to companies or law firms with the same phone number. For each such case, please show the case name, client name, client company, lead lawyer name, and the shared phone number.",
"role": "user"
},
{
"content": "SELECT cases.cas... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"content": "Provide a count of notifications, separated by whether they have been read or not.",
"role": "user"
},
{
"content": "SELECT CASE WHEN T1.read_at IS NULL THEN 'Unread' ELSE 'Read' END, count(T1.notification_id) FROM trading_platform.notifications AS T1 GROUP BY CASE WHEN T1.read_at IS 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 trading_platform.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp... |
[
{
"content": "List all ERC20 tokens with their names and symbols where the price is greater than $100, sorted by price in descending order.",
"role": "user"
},
{
"content": "SELECT scm.name, scm.symbol, tpl.price FROM sui_coins_metadata scm JOIN token_prices_latest tpl ON scm.coin_type = tpl.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 nft_holder_historical ( block_number.bigint, contract_address.text, wallet_address.text, token_id.text, contract_type.t... |
[
{
"content": "List all lawyers who have never had a time entry that was billed, showing lawyer_id, first_name, and last_name.",
"role": "user"
},
{
"content": "SELECT l.lawyer_id, l.first_name, l.last_name \nFROM legal_services.lawyers l \nLEFT JOIN legal_services.time_entries te \n ON l.lawyer_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph... |
[
{
"content": "Show the first and last names of citizens along with the total amount of all payments associated with them.",
"role": "user"
},
{
"content": "SELECT T1.first_name , T1.last_name , SUM(T2.amount) FROM government_services.citizens AS T1 JOIN government_services.payments AS T2 ON T1.cit... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "Which customers have accounts in more than one state? Please show their customer_id, full name, and the list of states where they hold accounts.",
"role": "user"
},
{
"content": "SELECT c.customer_id, c.first_name || ' ' || c.last_name AS full_name, STRING_AGG(DISTINCT c.state, ', ') 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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad... |
[
{
"content": "Could you list all pairs of developers that are based in the same country and share the same website domain?",
"role": "user"
},
{
"content": "SELECT\n d1.name AS developer1_name,\n d2.name AS developer2_name,\n d1.country,\n d1.website\nFROM\n gaming_technology.developers AS d1\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 gaming_technology.developers (
developer_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the d... |
[
{
"content": "Tell me the count of hidden achievements and non-hidden achievements.",
"role": "user"
},
{
"content": "SELECT hidden, COUNT(*) FROM achievements GROUP BY hidden;",
"role": "assistant"
},
{
"content": "What's the average point value for hidden vs non-hidden achievements?",
... | You are an SQL statement expert. Given the table 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.achievements ( achievement_id.uuid, game_id.uuid, name.text, description.text, icon_url.text, points.... |
[
{
"content": "Calculate the monthly total quantity of fuel consumed and the average cost_per_unit for each fuel_type in 2023.",
"role": "user"
},
{
"content": "SELECT date_trunc('month', log_timestamp) AS month,\n fuel_type,\n SUM(quantity) AS total_quantity,\n AVG(cost_per_un... | You are an SQL statement expert. Given the table 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.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, qu... |
[
{
"content": "List each policy ID and its customer ID for which there are both premium payments recorded and beneficiaries listed. Include the total amount paid for that policy by that customer and the count of beneficiaries listed for that policy by that customer.",
"role": "user"
},
{
"content": "... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"content": "Provide each patient's most recent medical-record doctor's full name along with their primary insurance plan name. Return patient_id, first_name, last_name, primary_plan_name, doctor_first_name, doctor_last_name.",
"role": "user"
},
{
"content": "SELECT p.patient_id,\n p.first_na... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"content": "For each group chat, can you show me each participant's username and the date they joined the chat?",
"role": "user"
},
{
"content": "SELECT u.username, c.group_name, cp.joined_at\nFROM social_media.conversation_participants cp\nJOIN social_media.users u ON cp.user_id = u.user_id\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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"content": "Find the average time it takes for users to read notifications after they are sent.",
"role": "user"
},
{
"content": "SELECT AVG(EXTRACT(EPOCH FROM (read_at - sent_at))/3600) as avg_hours_to_read FROM trading_platform.notifications WHERE read_at IS NOT NULL;",
"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 trading_platform.notifications ( notification_id text PRIMARY KEY, user_id text, message text, sent_at timestamp, read_... |
[
{
"content": "What are the training programs or certifications completed by a staff member with the role of Platform Supervisor?",
"role": "user"
},
{
"content": "I'm sorry, but I don't have access to information about the training programs or certifications completed by staff members. The data avai... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.s... |
[
{
"content": "How many users registered on each weekday? Return the weekday name and registration count.",
"role": "user"
},
{
"content": "SELECT\n to_char(created_at, 'FMDay') AS weekday,\n COUNT(*) AS registration_count\nFROM web3.users\nGROUP BY 1\nORDER BY registration_count DESC;",
"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 web3.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
|
[
{
"content": "List the name and symbol for all assets that do not have a corresponding entry with the key 'website' in the metadata table.",
"role": "user"
},
{
"content": "SELECT T1.name , T1.symbol FROM trading_platform.assets AS T1 LEFT JOIN trading_platform.metadata AS T2 ON T1.asset_id = T2.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 trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"content": "Find acquisition event pairs for each player where they acquired two distinct items. Show player_id, the first inventory_id as inv1, the second inventory_id as inv2, and their corresponding item_ids.",
"role": "user"
},
{
"content": "SELECT p1.player_id,\n p1.inventory_id AS inv1... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid PRIMARY KEY, player_id uuid, item_id uuid, quantity int, acquire... |
[
{
"content": "Find patients who currently have both a primary and a secondary insurance policy. For each, show patient_id, full name, primary policy_number, and secondary policy_number.",
"role": "user"
},
{
"content": "SELECT p.patient_id,\n p.first_name || ' ' || p.last_name AS patient_name,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"content": "Show me the total market cap and the total smart money inflow USD value for each narrative. Join the `token_basic_info` and `smart_money_token_inflow` tables based on narrative.",
"role": "user"
},
{
"content": "WITH Narratives AS ( SELECT DISTINCT narrative FROM token_basic_info WHERE... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_basic_info ( coin_id text, token_name text, token_symbol text, token_address t... |
[
{
"content": "Show me all active agents who have handled claims with police reports, along with the count of such claims per agent.",
"role": "user"
},
{
"content": "SELECT a.agent_id, a.first_name, a.last_name, COUNT(c.claim_id) as police_report_claims FROM insurance.agents a JOIN 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.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c... |
[
{
"content": "List document names and versions for documents that share the same case_id, showing each pair of versions.",
"role": "user"
},
{
"content": "SELECT d1.case_id, d1.document_name AS doc_name_v1, d1.version AS version1, d2.document_name AS doc_name_v2, d2.version AS version2 FROM legal_se... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"content": "What is the ticket price for a journey on train number T4321?",
"role": "user"
},
{
"content": "I'm sorry, but I don't have access to information about ticket prices for specific trains. The data I have is limited to train details such as model, manufacturer, 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... |
[
{
"content": "For each player, list their username and the total number of unique servers they have played on, only including players who have played on two or more different servers. Also show the titles of all games they've played sessions on.",
"role": "user"
},
{
"content": "SELECT p.username, C... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"content": "Find the total balance per coin_type for active SUI coins, including coin_type, symbol, name, and SUM(balance) as total_balance. Sort by total_balance descending.",
"role": "user"
},
{
"content": "SELECT\n c.coin_type,\n m.symbol,\n m.name,\n SUM(CAST(c.balance AS BIGINT)) AS 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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"content": "For each user, show their user ID and the count of unique wallet addresses they own.",
"role": "user"
},
{
"content": "SELECT user_id, COUNT(DISTINCT address) FROM wallets GROUP BY user_id;",
"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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
|
[
{
"content": "List all NFT collections from the sui_nfts table where the owner is not null, including their name and collection_type.",
"role": "user"
},
{
"content": "SELECT name, collection_type FROM sui_nfts WHERE owner IS NOT NULL;",
"role": "assistant"
},
{
"content": "Can you also ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"content": "Show me the total billable hours per lawyer from the time_entries table.",
"role": "user"
},
{
"content": "SELECT lawyer_id, SUM(hours_spent) AS total_hours\nFROM legal_services.time_entries\nWHERE is_billable = TRUE\nGROUP BY lawyer_id;",
"role": "assistant"
},
{
"content"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients (
client_id character varying(64) NOT NULL, -- unique identifier for the client
first_n... |
[
{
"content": "I need to find every offline server alongside an online server in the same region.",
"role": "user"
},
{
"content": "SELECT s_off.server_id AS offline_id,\n s_on.server_id AS online_id\nFROM gaming_technology.servers s_off\nJOIN gaming_technology.servers s_on\n ON s_off.region =... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, game_id uuid, server_name text, region text, ip_address text, p... |
[
{
"content": "Show me all customers who have active policies with coverage limits over $1,000,000, along with their policy details and the product names.",
"role": "user"
},
{
"content": "SELECT c.customer_id, c.first_name, c.last_name, p.policy_id, p.policy_number, p.start_date, p.end_date, p.cover... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "For each developer, can you find the next developer in the same country using a self join, returning developer_ids and names?",
"role": "user"
},
{
"content": "SELECT d1.developer_id AS current_dev,\n d1.name AS current_name,\n d2.developer_id AS next_dev,\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 gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"content": "Could you list the name, type, and rarity for all in-game items that belong to games released on or after January 1st, 2022?",
"role": "user"
},
{
"content": "SELECT ii.item_name, ii.item_type, ii.rarity FROM gaming_technology.in_game_items AS ii JOIN gaming_technology.games AS g ON ii... | You are an SQL statement expert. Given the table 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
... |
[
{
"content": "Provide the total count of unique users who have created wallets.",
"role": "user"
},
{
"content": "SELECT COUNT(DISTINCT user_id) FROM web3.wallets;",
"role": "assistant"
},
{
"content": "Now, refine that to show the number of users who own *more than one* wallet.",
"r... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"content": "List all bookings with their passenger_id and fare, ordered by booking_time in descending order.",
"role": "user"
},
{
"content": "SELECT booking_id, passenger_id, fare, booking_time FROM transportation.bookings ORDER BY booking_time DESC;",
"role": "assistant"
},
{
"conten... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes (
route_id character varying(64) NOT NULL, -- unique identifier for the route
route_numb... |
[
{
"content": "What are the personal contact details of the staff member associated with staff_id 'STAFF789' who worked on a specific maintenance record?",
"role": "user"
},
{
"content": "I'm sorry, but I can't provide personal contact details of staff members as this information is not stored in the... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.m... |
[
{
"content": "Show user_id and post_id for users who have created posts and have a private profile.",
"role": "user"
},
{
"content": "SELECT p.user_id, p.post_id FROM social_media.posts AS p JOIN social_media.user_settings AS us ON p.user_id = us.user_id WHERE us.private_profile = true",
"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 social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u... |
[
{
"content": "Show me all insurance plans that have more than 5 patients enrolled, along with the provider name and count of patients, sorted by patient count in descending order.",
"role": "user"
},
{
"content": "SELECT i.plan_name, i.insurance_provider, COUNT(p.patient_id) AS patient_count 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.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"content": "Show me the top 5 NFT collections on Sui blockchain with the highest number of unique owners, along with their names and collection types.",
"role": "user"
},
{
"content": "SELECT name, collection_type, COUNT(DISTINCT owner) AS unique_owners FROM sui_nfts GROUP BY name, collection_type... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"content": "Get the number of agents grouped by status. Return status and agent_count.",
"role": "user"
},
{
"content": "SELECT status,\n COUNT(*) AS agent_count\n FROM insurance.agents\n GROUP BY status;",
"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 insurance.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.