conversations listlengths 2 8 | system stringlengths 298 8.24k |
|---|---|
[
{
"content": "List all auto loans (loan_id, principal_amount, interest_rate) where the current principal balance is less than 40% of the original principal amount, along with the account_id and the difference between principal_amount and current_principal_balance.",
"role": "user"
},
{
"content": "S... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.loans ( loan_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL UNIQUE, lo... |
[
{
"content": "What is the performance review score for employee with ID 'EMP456' for the last quarter?",
"role": "user"
},
{
"content": "I'm sorry, but I can't assist with information about performance review scores as this data is not included 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": "What is the count of securities for each security_type in the 'Financial' sector?",
"role": "user"
},
{
"content": "SELECT security_type, COUNT(*) as security_count FROM financial_services.securities WHERE sector = 'Financial' GROUP BY security_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 financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu... |
[
{
"content": "Find appointments that are longer than 30 minutes.",
"role": "user"
},
{
"content": "SELECT * FROM legal_services.appointments WHERE end_time IS NOT NULL AND start_time IS NOT NULL AND end_time > start_time + INTERVAL '30 minutes'",
"role": "assistant"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ... |
[
{
"content": "Find all pairs of doctors who share the same specialty. Display d1.doctor_id, d1.first_name, d1.last_name, d2.doctor_id, d2.first_name, d2.last_name, and the specialty.",
"role": "user"
},
{
"content": "SELECT d1.doctor_id AS doctor1_id, d1.first_name AS doctor1_first_name, d1.last_nam... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number... |
[
{
"content": "I need to know the total USD value of all ERC-20 holdings by each wallet. Calculate the sum of (amount * price) using the latest token prices from token_prices_latest, grouped by wallet_address.",
"role": "user"
},
{
"content": "SELECT eb.wallet_address,\n SUM(CAST(eb.amount AS 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 erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, amount.text, pk.text )
CREATE TABLE n... |
[
{
"content": "Show all active staff members' full names and their positions.",
"role": "user"
},
{
"content": "SELECT staff_id, first_name || ' ' || last_name AS staff_full_name, position\nFROM hospitality_technology.staff\nWHERE is_active = true;",
"role": "assistant"
},
{
"content": "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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"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": "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 show me all doctors affiliated with hospital ID 'HOSP1001', including their doctor ID, full name, and specialty?",
"role": "user"
},
{
"content": "SELECT doctor_id, first_name, last_name, specialty FROM healthcare.doctors WHERE hospital_affiliation_id = 'HOSP1001';",
"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 healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number... |
[
{
"content": "I want to retrieve each client's full name along with the subject and start time of their appointments.",
"role": "user"
},
{
"content": "SELECT c.first_name || ' ' || c.last_name AS client_name, a.subject, a.start_time\nFROM legal_services.clients c\nJOIN legal_services.appointments 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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"content": "For each guest, calculate their total spending on delivered service orders and the total number of those orders.",
"role": "user"
},
{
"content": "SELECT g.guest_id,\n g.first_name || ' ' || g.last_name AS full_name,\n SUM(so.total_price) AS total_spent,\n COUNT(*) AS... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"content": "For each employee who has verified more than one document, list their employee ID, the first document they verified, and the next document they verified, along with both verification timestamps.",
"role": "user"
},
{
"content": "SELECT\n d1.verified_by_employee_id AS employee_id,\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 government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz... |
[
{
"content": "List patients who have appointments scheduled, their appointment time, the name of their primary insurance plan, and the provider name.",
"role": "user"
},
{
"content": "SELECT p.first_name AS patient_first_name, p.last_name AS patient_last_name, a.appointment_time, ip.plan_name, ip.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 healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"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": "Retrieve the name and city of all locations that act as both origin and destination for any route.",
"role": "user"
},
{
"content": "SELECT l.name, l.city\nFROM transportation.locations l\nWHERE l.location_id IN (SELECT origin_location_id FROM transportation.routes)\n AND l.location_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 transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"content": "Get each user's ID, the count of wallets they own, and the total amount of their unspent UTXOs across all wallets.",
"role": "user"
},
{
"content": "SELECT w.user_id,\n COUNT(DISTINCT w.wallet_id) AS wallet_count,\n COALESCE(SUM(u.amount), 0) ... | You are an SQL statement expert. Given the table 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, -- unique identifier for the wallet
user_... |
[
{
"content": "For each vehicle, show vehicle_id, make, model, the earliest and latest fuel log IDs with their timestamps.",
"role": "user"
},
{
"content": "WITH extremes AS (\n SELECT vehicle_id,\n MIN(log_timestamp) AS first_ts,\n MAX(log_timestamp) AS last_ts\n FROM transportatio... | You are an SQL statement expert. Given the table 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 NFT collection deployed on Ethereum, count the number of distinct wallets that have ever held any token from that collection.",
"role": "user"
},
{
"content": "SELECT\n nc.contract_address,\n nc.name,\n COUNT(DISTINCT nh.wallet_address) AS holder_count\nFROM nft_collections... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, amount.text, pk.text )
CREATE TABLE n... |
[
{
"content": "Give me the number of patient insurance policies for each plan where the policy is currently active. Return plan_id and policy_count.",
"role": "user"
},
{
"content": "SELECT\n plan_id,\n COUNT(*) AS policy_count\nFROM healthcare.patient_insurance\nWHERE (expiration_date IS NULL OR e... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, patient_id character varying(64) NO... |
[
{
"content": "Please provide the first name, last name, and the total number of trips completed by each driver.",
"role": "user"
},
{
"content": "SELECT T1.first_name , T1.last_name , COUNT(T2.trip_id) FROM transportation.drivers AS T1 JOIN transportation.trips AS T2 ON T1.driver_id = T2.driver_... | You are an SQL statement expert. Given the table 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": "List users and their latest wallet address if they have one, ordered by username.",
"role": "user"
},
{
"content": "SELECT u.username, w.address FROM users u JOIN wallets w ON u.user_id = w.user_id WHERE w.created_at = (SELECT MAX(w2.created_at) FROM wallets w2 WHERE w2.user_id = u.use... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"content": "For each category, list all pairs of services where one is active and the other is inactive. Show the category, active service name, and inactive service name.",
"role": "user"
},
{
"content": "SELECT a.category,\n a.service_name AS active_service,\n i.service_name AS inact... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services ( service_id text, agency_id text, service_name text, description text, category text, eli... |
[
{
"content": "Which chain has the highest total USD inflow from buy transactions (type=1), and how many distinct tokens were involved in that inflow?",
"role": "user"
},
{
"content": "SELECT chain, SUM(usd_value) AS total_inflow, COUNT(DISTINCT token_symbol) AS distinct_tokens\nFROM smart_money_toke... | You are an SQL statement expert. Given the table 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 text, token_symbol text, token_amount numeric, usd_value numeric, avg_price nu... |
[
{
"content": "Can you list all group conversations and the number of participants in each?",
"role": "user"
},
{
"content": "SELECT c.conversation_id, c.group_name, COUNT(cp.user_id) AS participant_count\nFROM social_media.conversations c\nJOIN social_media.conversation_participants cp ON c.conversa... | You are an SQL statement expert. Given the table 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 NFTs minted on the Ethereum blockchain in the last 14 days, including their contract address, token ID, name, and minter.",
"role": "user"
},
{
"content": "SELECT contract_address, token_id, name, minter\nFROM nft_metadata\nWHERE blockchain = 'Ethereum' AND mint_time >= (extra... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc20_balances ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, amou... |
[
{
"content": "Find all applications whose last update occurred on a weekend. Show application_id, citizen full name, last_updated_at, and status.",
"role": "user"
},
{
"content": "SELECT\na.application_id,\n(c.first_name || ' ' || c.last_name) AS full_name,\na.last_updated_at,\na.status\nFROM govern... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"content": "List usernames and the length of their 'bio' field for users whose 'is_verified' status is true.",
"role": "user"
},
{
"content": "SELECT username, LENGTH(bio) AS bio_length FROM social_media.users WHERE is_verified IS 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 PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"content": "Show me the top 5 tokens by 24-hour trading volume on the Ethereum chain, along with their narrative and 7-day price change percentage.",
"role": "user"
},
{
"content": "SELECT t.token_symbol, t.narrative, t.price_change_percentage_7d FROM token_basic_info t WHERE t.chain = 'Ethereum' ... | You are an SQL statement expert. Given the table 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 varying(100) NO... |
[
{
"content": "For each vehicle, list the vehicle_id and the total number of trips it has performed.",
"role": "user"
},
{
"content": "SELECT vehicle_id, COUNT(*) AS trip_count FROM transportation.trips GROUP BY vehicle_id;",
"role": "assistant"
},
{
"content": "Can you limit this to only... | You are an SQL statement expert. Given the table 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, route_id character varying(64), vehicle_id character var... |
[
{
"content": "Find all contracts where the deployer address is the same as the contract address, indicating self-deployed contracts.",
"role": "user"
},
{
"content": "SELECT address, deployer_address FROM web3.contracts WHERE address = deployer_address;",
"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.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,... |
[
{
"content": "List all employees (employee_id, first_name, last_name) who have processed trades with a commission greater than $500.",
"role": "user"
},
{
"content": "SELECT DISTINCT e.employee_id, e.first_name, e.last_name FROM financial_services.employees e JOIN financial_services.trades t ON e.em... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.trades ( trade_id.text, account_id.text, security_id.text, order_id.text, trade_type.text, quantity.... |
[
{
"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": "For each route, list the route number, description, and the combined total maintenance cost for all vehicles that have ever operated on that route.",
"role": "user"
},
{
"content": "WITH VehicleTotalMaintenance AS ( SELECT vehicle_id, SUM(cost) AS total_cost FROM transportation.mainten... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ... |
[
{
"content": "Show me all users who have commented on a post and have also liked any comment on that same post. I want their user IDs and the corresponding post IDs.",
"role": "user"
},
{
"content": "SELECT DISTINCT c.user_id, c.post_id\nFROM social_media.comments c\nJOIN social_media.likes l ON l.c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"content": "Show me the total number of invoices issued.",
"role": "user"
},
{
"content": "SELECT COUNT(*) FROM invoices;",
"role": "assistant"
},
{
"content": "How many invoices were issued in each status?",
"role": "user"
},
{
"content": "SELECT status, COUNT(*) FROM invo... | You are an SQL statement expert. Given the table 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.text, invoice_number.text, client_id.text, case_id.text, issue_date.date, due_date... |
[
{
"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": "List the post_id and the count of distinct hashtags associated with each post that has at least 3 hashtags.",
"role": "user"
},
{
"content": "SELECT ph.post_id, COUNT(DISTINCT ph.hashtag_id) AS hashtag_count FROM social_media.post_hashtags ph GROUP BY ph.post_id HAVING COUNT(DISTINCT 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 social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"content": "How many appointments are scheduled to start tomorrow?",
"role": "user"
},
{
"content": "SELECT count(*) FROM government_services.appointments WHERE DATE(scheduled_start_time) = CURRENT_DATE + INTERVAL '1 day'",
"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.appointments ( appointment_id text PRIMARY KEY, citizen_id text, employee_id text, location_id text... |
[
{
"content": "Which wallets hold at least 100 units of any ERC1155 NFT, and what is the token ID and contract address of the NFT for each such holding?",
"role": "user"
},
{
"content": "SELECT wallet_address, contract_address, token_id, amount\nFROM nft_holders\nWHERE contract_type = 'ERC1155' AND C... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"content": "Show me all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address, from the nft_holders table.",
"role": "user"
},
{
"content": "SELECT nh.wallet_address, nh.token_id, nh.contract_address FROM nft_holders nh WHERE nh.contract_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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"content": "Show me a list of all customers from California along with their full names and phone numbers.",
"role": "user"
},
{
"content": "SELECT customer_id, first_name || ' ' || last_name AS full_name, phone_number FROM insurance.customers WHERE state = 'CA';",
"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 reservations made by guests from 'California' with their full name and the property name where they stayed. Include the reservation ID and check-in date.",
"role": "user"
},
{
"content": "SELECT t1.reservation_id, t2.first_name, t2.last_name, t3.property_name, t1.check_in_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 hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"content": "What is the total balance and the number of accounts for each currency, including only accounts opened in the last 2 years?",
"role": "user"
},
{
"content": "SELECT currency , SUM(balance) AS total_balance , COUNT(*) AS account_count FROM financial_services.accounts WHERE opened_date... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri... |
[
{
"content": "Provide a breakdown of the total number of conversations, showing how many are group chats and how many are not. Also, show the count of conversations that have a recorded last message time.",
"role": "user"
},
{
"content": "SELECT COUNT(*) AS total_conversations, COUNT(CASE WHEN is_gr... | You are an SQL statement expert. Given the table 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": "List all depot locations in the United States with their city and state information.",
"role": "user"
},
{
"content": "SELECT name, city, state_province FROM transportation.locations WHERE type = 'depot' AND country = 'United States';",
"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 transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_pro... |
[
{
"content": "List all insurance plans and the number of patients associated with each plan.",
"role": "user"
},
{
"content": "SELECT ip.plan_name, COUNT(pi.patient_id) FROM healthcare.insurance_plans ip JOIN healthcare.patient_insurance pi ON ip.plan_id = pi.plan_id GROUP BY ip.plan_name;",
"ro... | You are an SQL statement expert. Given the table 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 each citizen who has made at least one payment, show the citizen's full name, number of payments, and total amount paid, grouped by currency.",
"role": "user"
},
{
"content": "SELECT\n c.first_name || ' ' || c.last_name AS full_name,\n p.currency,\n COUNT(*) AS payment_count,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"content": "Show me all ERC20 token transfers where the amount is over 5000, including the sender and receiver addresses.",
"role": "user"
},
{
"content": "SELECT from_address, to_address, amt, tick, tx_hash FROM token_activities WHERE type = 'transfer' AND CAST(amt AS DECIMAL) > 5000;",
"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 erc20_balances ( block_number bigint, contract_address varchar, wallet_address varchar, amount varchar, pk varchar )
CR... |
[
{
"content": "List all patients who have been diagnosed with chronic conditions, including their diagnosis descriptions and dates.",
"role": "user"
},
{
"content": "SELECT p.first_name, p.last_name, d.description, d.diagnosis_date FROM healthcare.patients p JOIN healthcare.diagnoses d ON p.patient_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 healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"content": "Show me all intercity routes with their origin and destination locations, including the city and country for each location.",
"role": "user"
},
{
"content": "SELECT r.route_id, r.route_number, r.type, orig.name AS origin_name, orig.city AS origin_city, orig.country AS origin_country, 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.routes (
route_id character varying(64) NOT NULL, -- unique identifier for the route
route_numb... |
[
{
"content": "For each driver, show their driver_id, first_name, last_name, along with any other driver whose license_expiry_date is earlier than theirs.",
"role": "user"
},
{
"content": "SELECT d1.driver_id AS driver_id,\n d1.first_name,\n d1.last_name,\n d2.driver_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 transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... |
[
{
"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": "Find maintenance log pairs for the same vehicle where the odometer reading is significantly higher in the second log compared to the first. Show the vehicle ID, service date and odometer for both logs in the pair, for increases greater than 50,000.",
"role": "user"
},
{
"content": "WIT... | You are an SQL statement expert. Given the table 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 all tokens on the Ethereum chain in token_dexpool_info that had a price increase in the last 6 hours, along with their 24h trading volume and smart money ROI.",
"role": "user"
},
{
"content": "SELECT td.token_symbol,\n td.price_change_percentage_6h,\n td.volume_24h,\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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"content": "Show me all active insurance products that have a base premium less than $100, sorted by product type.",
"role": "user"
},
{
"content": "SELECT * FROM insurance.insurance_products WHERE is_active = true AND base_premium < 100 ORDER BY product_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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"content": "Show the usernames of users who have used any hashtag in their posts, along with the tag name.",
"role": "user"
},
{
"content": "SELECT DISTINCT T1.username, T4.tag_name FROM social_media.users AS T1 JOIN posts AS T2 ON T1.user_id = T2.user_id JOIN post_hashtags AS T3 ON T2.post_id = 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 text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"content": "Retrieve the username and email for every user, along with the wallet ID and associated address ID for any wallets they own.",
"role": "user"
},
{
"content": "SELECT\n u.username,\n u.email,\n w.wallet_id,\n w.address_id\nFROM\n blockchain.users AS u\nLEFT JOIN\n bloc... | You are an SQL statement expert. Given the table 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.blocks ( block_id.text, previous_block_id.text, timestamp.timestamp, nonce.integer, merkle_root.text, diffic... |
[
{
"content": "List all ERC20 tokens where the price is greater than $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.address WHER... | You are an SQL statement expert. Given the table 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 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": "List all events and any token transfers that occurred in the same transaction, showing event_id, event_name, transfer_id, and token_symbol.",
"role": "user"
},
{
"content": "SELECT\n e.event_id,\n e.event_name,\n tt.transfer_id,\n tk.token_symbol\nFROM web3.events e\nLEFT JOIN web3... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"content": "Find all wallets created by users in the last 7 days along with any tokens that have a total supply greater than 10 million, showing the wallet address and token details.",
"role": "user"
},
{
"content": "SELECT w.address AS wallet_address, t.token_name, t.token_symbol, t.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, contract_address character varying(128) NOT NULL, token_name cha... |
[
{
"content": "List all unique claim handler IDs present in the claims table.",
"role": "user"
},
{
"content": "SELECT DISTINCT claim_handler_id FROM insurance.claims WHERE claim_handler_id 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 insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ... |
[
{
"content": "Show me all asset types along with the count of distinct assets and the count of log actions for each type.",
"role": "user"
},
{
"content": "SELECT a.type, COUNT(DISTINCT a.asset_id) AS asset_count, COUNT(l.log_id) AS action_count FROM trading_platform.assets a LEFT JOIN trading_platf... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.assets ( asset_id text, name text, symbol text, type text )
CREATE TABLE trading_platform.logs ( log_i... |
[
{
"content": "How many documents of each type exist in the system? Show the document type and the count.",
"role": "user"
},
{
"content": "SELECT document_type, COUNT(*) AS document_count\nFROM legal_services.documents\ngroup BY document_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 legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"content": "For each ERC20 token, how many unique wallets currently hold them? Show the contract address and unique wallet count.",
"role": "user"
},
{
"content": "SELECT contract_address, COUNT(DISTINCT wallet_address) AS unique_wallet_count FROM erc20_balances GROUP BY contract_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 erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"content": "List all staff members who processed payments for guest ID 'G123', including their first name, last name, and the payment ID.",
"role": "user"
},
{
"content": "SELECT T1.first_name, T1.last_name, T2.payment_id FROM staff AS T1 JOIN payments AS T2 ON T1.staff_id = T2.staff_id_processed ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.staff ( staff_id text PRIMARY KEY, property_id text, first_name text, last_name text, position t... |
[
{
"content": "List users who have received notifications triggered by another user (non-system notifications). Show the recipient username, notification type, and the sender username.",
"role": "user"
},
{
"content": "SELECT T1.username AS recipient_username, T2.notification_type, T3.username AS sen... | You are an SQL statement expert. Given the table 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 unique wallet addresses present in the system.",
"role": "user"
},
{
"content": "SELECT DISTINCT address FROM trading_platform.wallets;",
"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": "Calculate the average number of days cases stay open before being closed, grouped by case type. Only consider cases that have a date closed.",
"role": "user"
},
{
"content": "SELECT case_type, AVG(DATE_PART('day', date_closed - date_opened)) AS average_duration_days FROM legal_services... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases (
case_id character varying(64) NOT NULL, -- unique identifier for the case/matter
case_n... |
[
{
"content": "特定の予約ID 'book_zyx' に関連するすべてのチケットの詳細を取得するのを手伝っていただけますか?また、関連する車両情報も含めてください。",
"role": "user"
},
{
"content": "SMEMBERS booking:book_zyx:tickets\nHGETALL ticket:<ticket_id>\nHGETALL car:<car_id>",
"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 for ticket details. Key format: ticket:<ticket_id>
// HSET ticket:tkt_1a2b ticket_i... |
[
{
"content": "Show me all vehicles that are currently out of service (status = 'out_of_service'), including their make, model, and the reason (type field).",
"role": "user"
},
{
"content": "SELECT vehicle_id, make, model, type FROM transportation.vehicles WHERE status = 'out_of_service';",
"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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"content": "Show all SUI coins with 'exists' status and more than 8 decimal places. Display coin_type, symbol, name, and decimals.",
"role": "user"
},
{
"content": "SELECT coin_type, symbol, name, decimals\nFROM sui_coins_metadata\nWHERE status = 'exists' AND decimals > 8;",
"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 nft_holders ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, token_i... |
[
{
"content": "For each asset, calculate the total quantity and average price of orders that have status 'filled'.",
"role": "user"
},
{
"content": "SELECT o.asset_id,\n SUM(o.quantity) AS total_quantity,\n AVG(o.price) AS average_price\nFROM trading_platform.orders o\nWHERE o.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 trading_platform.wallets (
wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet
user_... |
[
{
"content": "Show me the total fuel quantity and cost for each route, grouped by route number, only for trips that have associated fuel logs.",
"role": "user"
},
{
"content": "SELECT r.route_number, SUM(f.quantity) AS total_quantity, SUM(f.total_cost) AS total_cost\nFROM transportation.fuel_logs 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 transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"content": "List each property and the number of available rooms. Only include properties with more than 10 available rooms.",
"role": "user"
},
{
"content": "SELECT p.property_id, p.property_name, COUNT(r.room_id) AS available_rooms\nFROM hospitality_technology.properties p\nJOIN hospitality_tech... | You are an SQL statement expert. Given the table 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 top 10 NFT collections with the highest token count, along with their names, symbols, and floor prices.",
"role": "user"
},
{
"content": "SELECT name, symbol, floor_price, token_count FROM nft_collections ORDER BY token_count DESC LIMIT 10;",
"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_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"content": "Find the full names and emails of citizens who have received notifications with the status 'Sent' related to a document. Also show the document_id for each notification.",
"role": "user"
},
{
"content": "SELECT c.first_name || ' ' || c.last_name AS full_name, c.contact_email, n.related... | You are an SQL statement expert. Given the table 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": "List every diagnosis description paired with every insurance plan's website.",
"role": "user"
},
{
"content": "SELECT T1.description, T2.website FROM healthcare.diagnoses AS T1 CROSS JOIN healthcare.insurance_plans AS T2;",
"role": "assistant"
},
{
"content": "Only include ... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_i... |
[
{
"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": "Calculate the average number of days between when an incident occurred and when the claim was reported, but only for claims that were settled in the year 2023.",
"role": "user"
},
{
"content": "SELECT\n AVG(EXTRACT(EPOCH FROM (reported_date - incident_date)) / 86400.0)::numeric(10, 2)... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims (
claim_id character varying(64) NOT NULL, -- unique identifier for the claim
policy_id charac... |
[
{
"content": "List all rooms that have a 'Jacuzzi' feature, including the room_number, property_id, type_name, and base_rate.",
"role": "user"
},
{
"content": "SELECT r.room_number,\n r.property_id,\n rt.type_name,\n rt.base_rate\nFROM hospitality_technology.rooms AS r\nJOIN hospit... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat... |
[
{
"content": "List all agents who have a commission rate above 0.1, showing their full names and agency names.",
"role": "user"
},
{
"content": "SELECT agent_id, first_name, last_name, agency_name, commission_rate FROM insurance.agents WHERE commission_rate > 0.1 AND status = 'Active';",
"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 character varying(64) NOT NULL, -- unique identifier for the policy
customer_id ... |
[
{
"content": "Show me all vehicles that are due for their next service before the end of this month, along with their last service date and type.",
"role": "user"
},
{
"content": "SELECT v.vehicle_id, v.make, v.model, s.service_date, s.service_type FROM transportation.vehicles v JOIN 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.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"content": "Find all blocks where the difficulty is between 1000 and 2000.",
"role": "user"
},
{
"content": "SELECT * FROM blockchain.blocks WHERE difficulty BETWEEN 1000 AND 2000;",
"role": "assistant"
},
{
"content": "Now filter these results to only show blocks mined after June 1, 2... | You are an SQL statement expert. Given the table 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.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic... |
[
{
"content": "Show me the top 5 projects by valuation that have completed fundraising rounds in the last 12 months, along with their token symbol and price from the token_basic_info table.",
"role": "user"
},
{
"content": "SELECT pfr.project_name, pfr.valuation, tbi.token_symbol, tbi.price\nFROM 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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"content": "For each doctor, count the number of chronic diagnoses they have made. Show the doctor's full name and the count.",
"role": "user"
},
{
"content": "SELECT doc.first_name, doc.last_name, COUNT(d.diagnosis_id) FROM healthcare.doctors doc JOIN healthcare.diagnoses d ON doc.doctor_id = d.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.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"content": "Show me the list of hashtags that have been used, along with the time they were first used.",
"role": "user"
},
{
"content": "SELECT tag_name, created_at \nFROM social_media.hashtags;",
"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": "How many claims were reported in the last 90 days?",
"role": "user"
},
{
"content": "SELECT COUNT(*) FROM claims WHERE reported_date >= CURRENT_DATE - INTERVAL '90 days'",
"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.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c... |
[
{
"content": "Can you show me the titles and release dates of all games developed by companies founded after 2018, as well as the name and country of each developer?",
"role": "user"
},
{
"content": "SELECT g.title, g.release_date, d.name AS developer_name, d.country\nFROM gaming_technology.games g\... | You are an SQL statement expert. Given the table 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 NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game
ti... |
[
{
"content": "List all policies that expired in the last 30 days, along with their product IDs and premium amounts.",
"role": "user"
},
{
"content": "SELECT policy_id, product_id, premium_amount FROM insurance.policies WHERE end_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 30 DAY) AND CURRENT_DATE 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 insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d... |
[
{
"content": "How many notifications have been sent per channel?",
"role": "user"
},
{
"content": "SELECT channel,\n COUNT(*) AS notification_count\nFROM government_services.notifications\nGROUP BY channel;",
"role": "assistant"
},
{
"content": "Exclude any notifications with statu... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, citizen_id text, application_id text, message_sub... |
[
{
"content": "What is the total USD value held across all wallets for the ERC20 token with symbol 'DAI'?",
"role": "user"
},
{
"content": "SELECT SUM((eb.amount::numeric / POWER(10, tm.decimals)) * tpl.price) AS total_usd\nFROM erc20_balances eb\nJOIN token_metas tm ON eb.contract_address = tm.contr... | You are an SQL statement expert. Given the table 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 all peers whose last_seen timestamp is before '2023-01-01' and whose port number is less than 1000, listing their peer_id and ip_address.",
"role": "user"
},
{
"content": "SELECT peer_id, ip_address FROM trading_platform.peers WHERE last_seen < '2023-01-01' AND port < 1000;",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.peers ( peer_id character varying(64) NOT NULL, ip_address character varying(15) NOT NULL, port intege... |
[
{
"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": "Find all users who registered with a Yahoo email address, along with their registration dates.",
"role": "user"
},
{
"content": "SELECT user_id, username, email, password_hash FROM blockchain.users WHERE email LIKE '%@yahoo.com';",
"role": "assistant"
},
{
"content": "This ... | You are an SQL statement expert. Given the table 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.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic... |
[
{
"content": "Count how many posts have media attachments.",
"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": "For all NFT collections on the Ethereum blockchain, show me the collection name and the current floor price. Sort by floor price descending.",
"role": "user"
},
{
"content": "SELECT name, floor_price FROM nft_collections WHERE blockchain = 'Ethereum' ORDER BY CAST(floor_price AS FLOAT)... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"content": "Show the symbol, name, and total supply for all SUI coins with status 'active'.",
"role": "user"
},
{
"content": "SELECT scm.symbol, scm.name, scm.coin_type, scm.total_supply\nFROM sui_coins_metadata scm\nWHERE scm.status = 'active';",
"role": "assistant"
},
{
"content": "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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"content": "List all document IDs and their corresponding location names for documents that are associated with applications assigned to a service location in the city of 'Los Angeles'.",
"role": "user"
},
{
"content": "SELECT d.document_id, sl.location_name\nFROM government_services.documents 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 government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.