conversations listlengths 2 8 | system stringlengths 288 8.08k |
|---|---|
[
{
"content": "Find the top 5 transactions with the highest gas prices, including the from_address, to_address, and block_number, sorted by gas_price in descending order.",
"role": "user"
},
{
"content": "SELECT transaction_id, from_address, to_address, block_number, gas_price FROM web3.transactions ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction
fr... |
[
{
"content": "Find all medical records where the vitals JSON field contains a blood pressure reading with systolic higher than 140, and show the patient_id, record_date, and vitals.",
"role": "user"
},
{
"content": "SELECT patient_id, record_date, vitals FROM healthcare.medical_records WHERE (vitals... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"content": "Give me a list of all unpaid invoices along with the first and last names of the clients and the issue date of each invoice.",
"role": "user"
},
{
"content": "SELECT i.invoice_number, i.issue_date, c.first_name, c.last_name\nFROM legal_services.invoices i\nJOIN legal_services.clients 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.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"content": "Can you give me the count of players grouped by their status?",
"role": "user"
},
{
"content": "SELECT status,\n COUNT(*) AS player_count\nFROM gaming_technology.players\nGROUP BY status;",
"role": "assistant"
},
{
"content": "Actually, include the percentage of 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 gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"content": "For each driver, find the other driver whose license_expiry_date is the next one after theirs. Show both IDs, names and their expiry dates.",
"role": "user"
},
{
"content": "SELECT\n d1.driver_id AS driver_id,\n d1.first_name || ' ' || d1.last_name AS driver_name,\n 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.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens... |
[
{
"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... |
[
{
"content": "What is the maintenance schedule for the platforms at the station with ID 'ST234' for the next month?",
"role": "user"
},
{
"content": "I'm sorry, but I don't have access to the maintenance schedule for the platforms at any station. The data I have only includes basic station informati... | 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 all room types that have 'sofa' mentioned in their amenities.",
"role": "user"
},
{
"content": "SELECT * FROM hospitality_technology.room_types WHERE amenities LIKE '%sofa%'",
"role": "assistant"
},
{
"content": "Also include the max_occupancy and filter to only show 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.room_types (
room_type_id character varying(64) NOT NULL, -- unique identifier for the room ... |
[
{
"content": "List all insurance plans along with their provider, plan type, and the contact phone number. Also, for each plan, show how many doctors have their hospital affiliation ID matching the plan ID.",
"role": "user"
},
{
"content": "SELECT ip.plan_id, ip.plan_name, ip.insurance_provider, ip.... | You are an SQL statement expert. Given the table 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": "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": "For each patient, show the total number of diagnoses they have received, along with their patient ID and the ID of their latest diagnosis. Join with the diagnoses table.",
"role": "user"
},
{
"content": "SELECT patient_id, COUNT(diagnosis_id) AS diagnosis_count, MAX(diagnosis_id) AS la... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi... |
[
{
"content": "Show me all wallets holding SUI coins with a balance greater than 2,000,000. Include the coin_type, balance, and owner address.",
"role": "user"
},
{
"content": "SELECT coin_type, balance, owner FROM sui_coins WHERE status = 'exists' AND CAST(balance AS bigint) > 2000000;",
"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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"content": "What is the history of incidents or accidents that occurred on platform 5 at station GHI?",
"role": "user"
},
{
"content": "I'm sorry, but I can't provide information about the history of incidents or accidents on platform 5 at station GHI. My data is limited to the structural and oper... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.p... |
[
{
"content": "List the usernames and user IDs of all users whose bio contains the word 'developer'.",
"role": "user"
},
{
"content": "SELECT user_id, username\nFROM social_media.users\nWHERE bio ILIKE '%developer%';",
"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 social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"content": "Show the names and types of all assets whose symbol is exactly 3 characters long.",
"role": "user"
},
{
"content": "SELECT name, type, symbol FROM trading_platform.assets WHERE LENGTH(symbol) = 3;",
"role": "assistant"
},
{
"content": "Also, I want to order the results alph... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, name text, symbol text, type text )
|
[
{
"content": "Count the number of medications provided by the manufacturer 'Novartis'.",
"role": "user"
},
{
"content": "SELECT count(*) FROM healthcare.medications WHERE manufacturer = 'Novartis'",
"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.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"content": "I want to list all pairs of customers living in the same city with different risk profiles.",
"role": "user"
},
{
"content": "SELECT a.customer_id AS customer_a,\n b.customer_id AS customer_b,\n a.city,\n a.risk_profile AS risk_a,\n b.risk_profile AS risk_b\nFRO... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"content": "Which narrative and chain combination saw the highest total USD buy value in the first half of 2023? Also list the total token amount bought for each.",
"role": "user"
},
{
"content": "SELECT narrative, chain, SUM(usd_value) AS total_usd_bought, SUM(token_amount) AS total_token_bought\... | You are an SQL statement expert. Given the table 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": "How many 'ApprovalForAll' events are recorded for each ERC1155 contract address in the `erc1155_approval_for_all` table?",
"role": "user"
},
{
"content": "SELECT contract_address, COUNT(*) AS approval_count FROM erc1155_approval_for_all GROUP BY contract_address;",
"role": "assista... | You are an SQL statement expert. Given the table 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 ... |
[
{
"content": "Find all medical records where the vitals field indicates a heart rate over 100 bpm, along with the associated appointment details and diagnosis description if available.",
"role": "user"
},
{
"content": "SELECT mr.record_id, mr.patient_id, a.appointment_time, a.doctor_id, a.reason, 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 healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi... |
[
{
"content": "Show all claim documents (document_id, file_name, and document_type) for claims that have a settlement amount greater than 5000.",
"role": "user"
},
{
"content": "SELECT cd.document_id, cd.file_name, cd.document_type\nFROM insurance.claim_documents cd\nJOIN insurance.claims c ON cd.cla... | You are an SQL statement expert. Given the table 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": "What is the total market cap for all tokens listed on the 'Polygon' chain?",
"role": "user"
},
{
"content": "SELECT SUM(market_cap) FROM token_dexpool_info WHERE chain = 'Polygon';",
"role": "assistant"
},
{
"content": "Only sum the market cap for tokens on 'Polygon' that 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 token_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexpool token_name character varying(10... |
[
{
"content": "For each trip, show the trip_id, vehicle's license plate, total fuel quantity, and number of fueling events.",
"role": "user"
},
{
"content": "SELECT t.trip_id, v.license_plate, SUM(f.quantity) AS total_fuel, COUNT(f.fuel_log_id) AS fueling_events FROM transportation.trips t JOIN trans... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"content": "Which doctors do not have an email address listed? Please show their doctor ID, first name, last name, and the hospital they are affiliated with.",
"role": "user"
},
{
"content": "SELECT doctor_id, first_name, last_name, hospital_affiliation_id FROM healthcare.doctors WHERE email IS NU... | You are an SQL statement expert. Given the table 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": "Show me all wallets holding at least 3 different ERC1155 NFTs on Ethereum, along with the number of distinct tokens held by each wallet.",
"role": "user"
},
{
"content": "SELECT wallet_address, COUNT(DISTINCT token_id) as distinct_tokens\nFROM nft_holders\nWHERE contract_type = 'ERC115... | You are an SQL statement expert. Given the table 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": "How many employees work in each department? List the department name and the count.",
"role": "user"
},
{
"content": "SELECT department, COUNT(*) FROM government_services.employees GROUP BY department",
"role": "assistant"
},
{
"content": "Only show departments with more 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 government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth... |
[
{
"content": "What is the average number of wallets each user owns?",
"role": "user"
},
{
"content": "SELECT\n AVG(wallet_count) AS avg_wallets_per_user\nFROM (\n SELECT user_id, COUNT(*) AS wallet_count\n FROM web3.wallets\n GROUP BY user_id\n) AS sub;",
"role": "assistant"
},
{
"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 web3.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"content": "How many posts have a media file attached?",
"role": "user"
},
{
"content": "SELECT count(*) FROM social_media.posts WHERE media_url 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 social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"content": "List all patients who have been prescribed medications with dosage greater than 50mg, along with their medication details and prescribing doctor's name.",
"role": "user"
},
{
"content": "SELECT p.first_name, p.last_name, pr.dosage, pr.medication_id, pr.frequency, d.first_name AS doctor... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"content": "Retrieve all reservations with status 'Cancelled' and show the reservation_id, property_name, and room_type_name.",
"role": "user"
},
{
"content": "SELECT res.reservation_id,\n p.property_name,\n rt.type_name AS room_type_name\nFROM hospitality_technology.reservations res\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"content": "Show all messages that include a media attachment, along with the sender's user ID and the conversation ID.",
"role": "user"
},
{
"content": "SELECT message_id, sender_user_id, conversation_id, media_url, media_type, sent_at FROM social_media.messages WHERE media_url IS NOT NULL AND me... | You are an SQL statement expert. Given the table 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": "Show me the top 5 smart money addresses by profit in the last month, along with their most profitable token.",
"role": "user"
},
{
"content": "SELECT address, profit, most_profit_token FROM smart_money_profit ORDER BY profit DESC LIMIT 5;",
"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 token_basic_info (",
"coin_id character varying(100) NOT NULL, -- the id of the token",
"token_name character... |
[
{
"content": "Which pairs of tokens on the same chain have the greatest difference in 24h trading volume? List the two token symbols, their volumes, the absolute difference, and the chain. Limit to the top 3 pairs.",
"role": "user"
},
{
"content": "SELECT a.chain,\n a.token_symbol AS token_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_dexpool_info (",
"pair_address character varying(512) NOT NULL, -- the id of dexpool",
"token_name cha... |
[
{
"content": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 3 months, along with their narrative information if available.",
"role": "user"
},
{
"content": "SELECT pfr.project_name, pfr.valuation, pfr.rounds_name, pfr.investment_date, ni.narrative, ni.trend_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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"content": "Can you list the names of agencies that do not have a parent agency assigned, ordered by their established date?",
"role": "user"
},
{
"content": "SELECT agency_id, agency_name, established_date\nFROM government_services.agencies\nWHERE parent_agency_id IS NULL\nORDER BY established_da... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "Find the most recent verified document for each application, showing application_id, document_id, and verification_timestamp.",
"role": "user"
},
{
"content": "SELECT d.document_id, d.application_id, d.verification_timestamp\nFROM government_services.documents d\nJOIN (\n SELECT appli... | You are an SQL statement expert. Given the table 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.documents ( document_id text PRIMARY KEY, application_id text, citizen_id text, document_type text,... |
[
{
"content": "Count the number of law firms founded in each decade. Show the decade (e.g., 1990s, 2000s) and the count.",
"role": "user"
},
{
"content": "SELECT CONCAT(FLOOR(EXTRACT(YEAR FROM founded_date) / 10) * 10, 's') AS decade, COUNT(*) AS firm_count FROM law_firms WHERE founded_date IS NOT NU... | You are an SQL statement expert. Given the table 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": "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": "Show me all claims filed in the last 6 months with their associated policy details and customer information.",
"role": "user"
},
{
"content": "SELECT cl.claim_id, cl.incident_date, cl.status, cl.settlement_amount, p.policy_number, p.product_id, p.coverage_limit, c.first_name, c.last_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 insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"content": "Show me the wallet addresses that hold more than 1000 of any ERC20 token, along with the token symbol and amount, from the erc20_balances table.",
"role": "user"
},
{
"content": "SELECT e.wallet_address, t.symbol, e.amount FROM erc20_balances e JOIN token_prices_latest t ON e.contract_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, transaction_index integ... |
[
{
"content": "List each property along with the count of available rooms grouped by bed type.",
"role": "user"
},
{
"content": "SELECT rt.property_id, p.property_name, rt.bed_type, COUNT(r.room_id) AS available_count\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology.room_types rt 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 hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"content": "Get the total balance of each SUI coin per coin_type, including symbol and name from metadata.",
"role": "user"
},
{
"content": "SELECT sc.coin_type,\n scm.symbol,\n scm.name,\n SUM(CAST(sc.balance AS NUMERIC)) AS total_balance\nFROM sui_coins AS sc\nJOIN sui_coins_me... | You are an SQL statement expert. Given the table 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": "Find the average percentage share among all beneficiaries for each distinct relationship type.",
"role": "user"
},
{
"content": "SELECT relationship, AVG(percentage_share) FROM insurance.policy_beneficiaries GROUP BY relationship ORDER BY relationship;",
"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.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"content": "List all customers who have two policies with overlapping coverage periods and show both policy numbers along with the overlap start and end dates.",
"role": "user"
},
{
"content": "SELECT p1.customer_id, p1.policy_number AS policy_number1, p2.policy_number AS policy_number2, GREATEST(... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"content": "Show me all active agents who have a commission rate above 0.08, along with their agency names and the count of claims they've handled.",
"role": "user"
},
{
"content": "SELECT a.agent_id, a.first_name, a.last_name, a.agency_name, a.commission_rate, COUNT(cl.claim_id) AS claims_handled... | You are an SQL statement expert. Given the table 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 asset, I want to know how many orders have the status 'filled', showing the asset symbol.",
"role": "user"
},
{
"content": "SELECT m.value AS asset_symbol,\n COUNT(*) AS filled_order_count\nFROM trading_platform.orders o\nJOIN trading_platform.metadata m\n ON o.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.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"content": "How many hashtags have been created in March 2024?",
"role": "user"
},
{
"content": "```sql\nSELECT COUNT(*) AS march_2024_hashtag_count\nFROM social_media.hashtags\nWHERE created_at >= '2024-03-01'\n AND created_at < '2024-04-01';\n```",
"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 social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"content": "Show me all properties in California with a star rating above 4.0, along with the names of their managers and the count of active staff members at each property.",
"role": "user"
},
{
"content": "SELECT p.property_name, p.star_rating, s.first_name || ' ' || s.last_name AS manager_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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"content": "Show me the usernames of all players who own at least one item with a quantity above 20, and for each player include the total number of such inventory records they have.",
"role": "user"
},
{
"content": "SELECT p.username, COUNT(pi.inventory_id) AS inventory_count\nFROM gaming_technol... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"content": "Show me all notifications that are related to posts created by users who have a verified profile. Include the notification type, the recipient username, and the post ID.",
"role": "user"
},
{
"content": "SELECT\n n.notification_type,\n u_recipient.username AS recipient_username,\n n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"content": "List all notifications related to messages. Please show notification_id, recipient_user_id, conversation_id, and the creation time.",
"role": "user"
},
{
"content": "SELECT notification_id, recipient_user_id, target_entity_id AS conversation_id, created_at\nFROM social_media.notificati... | You are an SQL statement expert. Given the table 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": "What is the current address of the employee with ID 'EMP234'?",
"role": "user"
},
{
"content": "I'm sorry, but I can't provide the current address of an employee as this information is not stored in the database table.",
"role": "assistant"
}
] | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.employees ( ... |
[
{
"content": "List pairs of distinct routes that originate from the same location but go to different destinations. Show the route ID and route number for both routes and the common origin location ID.",
"role": "user"
},
{
"content": "SELECT\n r1.route_id AS route1_id,\n r1.route_number AS route1... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"content": "Show each service's name along with the total number of appointments scheduled and the number of unique locations these appointments are scheduled at.",
"role": "user"
},
{
"content": "SELECT s.service_name, COUNT(a.application_id) AS appointment_count, COUNT(DISTINCT ap.location_id) 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 government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"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": "I want to see, for each guest, the total number of payments they have made and the timestamp of their latest payment.",
"role": "user"
},
{
"content": "SELECT p.guest_id,\n COUNT(p.payment_id) AS payment_count,\n t.last_ts\nFROM hospitality_technology.payments p\nJOIN (\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.payments ( payment_id character varying(64) NOT NULL, reservation_id character varying(64), gues... |
[
{
"content": "How many verified users are there?",
"role": "user"
},
{
"content": "SELECT COUNT(user_id) FROM social_media.users WHERE is_verified = TRUE;",
"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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"content": "List all maintenance service records for vehicles that have successfully completed any trip.",
"role": "user"
},
{
"content": "SELECT DISTINCT ml.* FROM transportation.maintenance_logs AS ml JOIN transportation.trips AS t ON ml.vehicle_id = t.vehicle_id WHERE t.status = 'Completed';",
... | You are an SQL statement expert. Given the table 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, employee_id.text, first_name.text, last_name.text, license_number.text, licens... |
[
{
"content": "Show me 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 erc20_balances WHERE CAST(amount AS decimal) > 1000;",
"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 erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"content": "List all reservations with their guest IDs and room IDs where the total amount is greater than $300, ordered by check-in date.",
"role": "user"
},
{
"content": "SELECT reservation_id, guest_id, room_id, check_in_date FROM hospitality_technology.reservations WHERE total_amount > 300 ORD... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.reservations ( reservation_id text PRIMARY KEY, property_id text, guest_id text, room_id text, r... |
[
{
"content": "Show me all reservations with more than 2 adults, along with their property names and room types.",
"role": "user"
},
{
"content": "SELECT r.reservation_id, p.property_name, rt.room_type_name, r.check_in_date, r.check_out_date, r.num_adults FROM hospitality_technology.reservations r JO... | You are an SQL statement expert. Given the table 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": "I want to see pairs of medications that share the same manufacturer. Show each medication's name and its peer's medication_name along with the manufacturer.",
"role": "user"
},
{
"content": "SELECT t1.medication_name AS med1_name, t2.medication_name AS med2_name, t1.manufacturer FROM 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 healthcare.medications ( medication_id text PRIMARY KEY, medication_name text, generic_name text, manufacturer text, nd... |
[
{
"content": "List the token symbol and name for all tokens whose associated contract address has emitted at least one event. Also include the contract address.",
"role": "user"
},
{
"content": "SELECT T.token_symbol, T.token_name, T.contract_address FROM web3.tokens AS T JOIN contracts AS C ON T.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 web3.tokens (
token_id character varying(64) NOT NULL, -- unique identifier for the token
contract_address cha... |
[
{
"content": "Show the count of patients residing in each unique address, excluding any entries with no address listed.",
"role": "user"
},
{
"content": "SELECT address, COUNT(patient_id) AS patient_count FROM healthcare.patients WHERE address IS NOT NULL AND address != '' GROUP BY address;",
"r... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"content": "Find all wallets that were created on the same day and list their wallet IDs, addresses, and the creation date.",
"role": "user"
},
{
"content": "SELECT w1.wallet_id, w1.address, w1.created_at::date AS creation_date FROM web3.wallets w1 JOIN (SELECT created_at::date AS creation_date FR... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.wallets (
wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet
user_id character... |
[
{
"content": "Show a list of all DApps together with the total number of unique assets linked to each via the metadata table.",
"role": "user"
},
{
"content": "SELECT d.dapp_id, d.name, d.url, COUNT(DISTINCT m.asset_id) AS unique_asset_count\nFROM trading_platform.dapps d\nLEFT JOIN trading_platform... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "For each route, list the route_number, origin city, destination city, and the total fare collected from completed bookings.",
"role": "user"
},
{
"content": "SELECT\n r.route_number,\n lo.city AS origin_city,\n ld.city AS destination_city,\n SUM(b.fare) AS total_far... | You are an SQL statement expert. Given the table 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... |
[
{
"content": "Find pairs of BUY and SELL trades from the trades table for the same account that occurred on the same settlement_date and had matching quantities.",
"role": "user"
},
{
"content": "SELECT\n a.trade_id AS buy_trade_id,\n b.trade_id AS sell_trade_id,\n a.account_id,\n a.settlement_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 financial_services.trades ( trade_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL, securit... |
[
{
"content": "Show me all policy beneficiaries who were added in the last 6 months, along with their policy details and percentage shares.",
"role": "user"
},
{
"content": "SELECT pb.*, pp.policy_id, pp.customer_id, pp.payment_date FROM insurance.policy_beneficiaries pb JOIN insurance.premium_paymen... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_id text, payment_date timestamp, amo... |
[
{
"content": "Now, sort the results by the date opened, oldest first, and show only the top 10.",
"role": "user"
},
{
"content": "SELECT case_name, case_number, date_opened FROM legal_services.cases WHERE lead_lawyer_id = 'lawyer_abc' AND status = 'Open' AND case_type = 'Criminal' ORDER BY date_open... | You are an SQL statement expert. Given the table 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... |
[
{
"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": "For each property, list the name of the room type and the number of rooms of that type at the property.",
"role": "user"
},
{
"content": "SELECT T1.property_name, T2.type_name, count(T3.room_id) AS room_count FROM hospitality_technology.properties AS T1 JOIN hospitality_technology.room... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"content": "Show the total transaction amount for each customer, including their full name and risk profile. Join customers to accounts and then to transactions.",
"role": "user"
},
{
"content": "SELECT\n T2.first_name,\n T2.last_name,\n T2.risk_profile,\n SUM(T1.amount) AS total_transaction_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": "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": "What is the current salary of employee with ID 'EMP123'?",
"role": "user"
},
{
"content": "I'm sorry, but I can't provide information about an employee's salary as it is not included in the data available in the 'employees' table.",
"role": "assistant"
}
] | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.employees (
... |
[
{
"content": "For each trip, list the trip ID, its scheduled departure time, and the total fare from all bookings associated with that trip.",
"role": "user"
},
{
"content": "SELECT T2.trip_id , T2.scheduled_departure , SUM(T1.fare) FROM transportation.bookings AS T1 JOIN transportation.trips AS T... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser... |
[
{
"content": "Show me the earliest created smart contract for each creator address.",
"role": "user"
},
{
"content": "SELECT sc1.contract_id, sc1.creator_address, sc1.timestamp FROM blockchain.smart_contracts sc1 WHERE sc1.timestamp = (SELECT MIN(sc2.timestamp) FROM blockchain.smart_contracts sc2 WH... | You are an SQL statement expert. Given the table 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": "Which five customers have the highest cumulative estimated_loss from approved or settled claims? Provide customer_id and total_estimated_loss.",
"role": "user"
},
{
"content": "SELECT customer_id,\n SUM(estimated_loss) AS total_estimated_loss\nFROM insurance.claims\nWHERE 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 insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"content": "Show the plan name and insurance provider for all insurance plans along with the total number of unique patients enrolled in each plan.",
"role": "user"
},
{
"content": "SELECT ip.plan_name, ip.insurance_provider, COUNT(DISTINCT pi.patient_id) AS enrolled_patient_count\nFROM healthcare... | You are an SQL statement expert. Given the table 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": "For the Arbitrum chain, which three tokens have the greatest positive change in price over the last 1 hour? Please show their symbol, name, price, and 1-hour price change percentage.",
"role": "user"
},
{
"content": "SELECT token_symbol, token_name, price, price_change_percentage_1h FR... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_dexpool_info ( pair_address.text, token_name.text, token_symbol.text, chain.text, price.numeric, price_change_per... |
[
{
"content": "List all pairs of vehicles in the same depot with different status. Include both vehicle IDs with their statuses and the depot_id.",
"role": "user"
},
{
"content": "SELECT v1.vehicle_id AS vehicle1_id,\n v1.status AS status1,\n v2.vehicle_id AS vehicle2_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 transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"content": "For each address, show the total amount contained in UTXOs that have been spent.",
"role": "user"
},
{
"content": "SELECT address, SUM(amount) FROM utxos WHERE spent = TRUE GROUP BY address;",
"role": "assistant"
},
{
"content": "Only include addresses where this total spen... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the UTXO
transaction... |
[
{
"content": "特定のラインIDに関連する組み立て手順と、使用されている材料の情報を取得したいです。ラインID、ステップ名、材料名、材料の説明を含めてください。",
"role": "user"
},
{
"content": "SELECT s.line_id, s.step_name, m.material_name, m.description\nFROM manufacturing.assembly_steps s\nJOIN manufacturing.materials m ON s.step_id = m.material_id\nWHERE s.line_id = ... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE manufacturing.materials (
material_id character varying(64) NOT NULL, -- unique... |
[
{
"content": "List all games released in 2023 along with their titles, platforms, and the names of their developers.",
"role": "user"
},
{
"content": "SELECT g.game_id, g.title, g.platform, d.name AS developer_name\nFROM gaming_technology.games g\nJOIN gaming_technology.developers d\n ON g.develope... | You are an SQL statement expert. Given the table 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.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date... |
[
{
"content": "List tokens with trend rank 5 or better and a price below $1. Show symbol, price, and trend rank.",
"role": "user"
},
{
"content": "SELECT token_symbol, price, trend_rank FROM token_dexpool_info WHERE trend_rank IS NOT NULL AND trend_rank <= 5 AND price < 1;",
"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 token_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexpool token_name character varying(10... |
[
{
"content": "List all Avalanche tokens from `token_info_avalanche`. Show their tick, creator, and the count of distinct wallet addresses (sender or receiver) that have interacted with this tick in the `token_activities_avalanche` table.",
"role": "user"
},
{
"content": "SELECT ti.tick, ti.creator, ... | You are an SQL statement expert. Given the table 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 average number of days by which paid invoices were paid late? Calculate the average of (payment_date - due_date) for invoices with status 'Paid'.",
"role": "user"
},
{
"content": "SELECT AVG((payment_date::date - due_date)) AS average_late_days\nFROM legal_services.invoices... | You are an SQL statement expert. Given the table 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.invoices ( invoice_id character varying(64) NOT NULL, invoice_number character varying(100) UNIQUE NOT N... |
[
{
"content": "Show me each department in each property, along with the total number of available services and their combined price.",
"role": "user"
},
{
"content": "SELECT property_id, department, COUNT(*) AS service_count, SUM(price) AS total_price FROM hospitality_technology.services WHERE is_ava... | You are an SQL statement expert. Given the table 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.services ( service_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL... |
[
{
"content": "Show me all reservations with their reservation_id, room_number, room status, and check_in_date.",
"role": "user"
},
{
"content": "SELECT r.reservation_id,\n rm.room_number,\n rm.status AS room_status,\n r.check_in_date\nFROM hospitality_technology.reservations r\nLEF... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room... |
[
{
"content": "Count the number of policies issued in each calendar year, and show the year and the count.",
"role": "user"
},
{
"content": "SELECT EXTRACT(YEAR FROM issued_at), COUNT(*) FROM insurance.policies WHERE issued_at IS NOT NULL GROUP BY 1 ORDER BY 1;",
"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.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
[
{
"content": "Show me all claims with police reports that were filed in the last 3 months, along with their policy details and estimated loss amounts.",
"role": "user"
},
{
"content": "SELECT cl.claim_id, cl.policy_id, cl.estimated_loss, cl.incident_date, cl.reported_date, p.premium_amount, p.covera... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d... |
[
{
"content": "For each group chat, list its ID, name, creation time, and the creation time of the next group chat created after it, ordered by creation time.",
"role": "user"
},
{
"content": "SELECT conversation_id, group_name, created_at, LEAD(created_at) OVER (ORDER BY created_at) AS next_group_ch... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.conversations ( conversation_id character varying(64) NOT NULL, created_at timestamp NOT NULL DEFAULT CURR... |
[
{
"content": "How many beneficiaries are there for each relationship type in the policy_beneficiaries table?",
"role": "user"
},
{
"content": "SELECT relationship, COUNT(*) AS beneficiary_count\nFROM insurance.policy_beneficiaries\nGROUP BY relationship;",
"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.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text... |
[
{
"content": "For each ERC1155 NFT contract on Ethereum, show the `contract_address`, `token_id`, total amount held across all wallets, and number of unique holders.",
"role": "user"
},
{
"content": "SELECT nh.contract_address,\n nh.token_id,\n SUM(CAST(nh.amount AS bigint)) AS total_amo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"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": "Retrieve all notifications sent in the last 24 hours, ordered by sent_at descending.",
"role": "user"
},
{
"content": "SELECT *\nFROM government_services.notifications\nWHERE sent_at >= CURRENT_TIMESTAMP - INTERVAL '24 HOURS'\nORDER BY sent_at DESC;",
"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 government_services.notifications ( notification_id.text, citizen_id.text, application_id.text, message_subject.text, m... |
[
{
"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": "Count the number of trips for each route type.",
"role": "user"
},
{
"content": "SELECT R.type, COUNT(T.trip_id) FROM transportation.trips AS T JOIN transportation.routes AS R ON T.route_id = R.route_id GROUP BY R.type;",
"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 transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati... |
[
{
"content": "List the document names and subjects of appointments that are linked to the same case, but only for documents uploaded after March 1st, 2024.",
"role": "user"
},
{
"content": "SELECT d.document_name, a.subject, d.case_id\nFROM legal_services.documents d\nJOIN legal_services.appointment... | You are an SQL statement expert. Given the table 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.