conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "For each user, list their user_id, username, the count of log entries in the last 30 days, and the count of unread notifications."
},
{
"role": "assistant",
"content": "SELECT u.user_id,\n u.username,\n COUNT(l.log_id) FILTER (WHERE l.logged_at >= NOW() ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Provide a count of appointments grouped by the booking method."
},
{
"role": "assistant",
"content": "SELECT booking_method, COUNT(*) AS appointment_count FROM government_services.appointments GROUP BY booking_method;"
}
] | You are an SQL statement expert. Given the table 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, -- unique identifier for the document i... |
[
{
"role": "user",
"content": "List all guests who have communication consent enabled along with their email addresses."
},
{
"role": "assistant",
"content": "SELECT guest_id,\n first_name || ' ' || last_name AS full_name,\n email\nFROM guests\nWHERE communication_consent = TRUE;"
}... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, la... |
[
{
"role": "user",
"content": "Can you list each citizen's first and last name, contact email, and the total amount they have paid for succeeded payments?"
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, c.contact_email, SUM(p.amount) AS total_paid FROM government_services... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Provide a count of citizens registered per calendar year."
},
{
"role": "assistant",
"content": "SELECT CAST(EXTRACT(YEAR FROM registration_date) AS INTEGER) AS registration_year, COUNT(*) AS citizen_count FROM government_services.citizens GROUP BY 1 ORDER BY 1;"
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "For each security issuer, show the count of market data points and the average close price for their securities."
},
{
"role": "assistant",
"content": "SELECT T2.issuer_name, COUNT(T1.*) AS data_point_count, AVG(T1.close_price) AS avg_close_price FROM financial_serv... | You are an SQL statement expert. Given the table 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.market_data (
data_point_id bigserial NOT NULL, -- auto-incrementing primary key
security_id... |
[
{
"role": "user",
"content": "List all active SUI coins showing coin_type, balance, and owner from sui_coins."
},
{
"role": "assistant",
"content": "SELECT coin_type, balance, owner\nFROM sui_coins\nWHERE status = 'exists';"
},
{
"role": "user",
"content": "Add symbol and decimals 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 erc20_balances ( block_number bigint, contract_address varchar, wallet_address varchar, amount varchar, pk varchar )
CR... |
[
{
"role": "user",
"content": "List tokens that exist in both the token basic information and the DEX pool information tables. For these tokens, show their symbol, the chain they are on, the current price from basic info, and the liquidity from the DEX pool info."
},
{
"role": "assistant",
"conte... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_basic_info ( coin_id.text, token_name.text, token_symbol.text, token_address.t... |
[
{
"role": "user",
"content": "What is the average profit and average ROI for smart money addresses ranked in the top 500?"
},
{
"role": "assistant",
"content": "SELECT AVG(profit), AVG(roi) FROM smart_money_profit WHERE rank <= 500"
}
] | You are an SQL statement expert. Given the table 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_profit ( address text, rank numeric, profit numeric, roi numeric, realized_ratio numeric, most_profit_token... |
[
{
"role": "user",
"content": "List all claims that are still pending (status = 'pending') and were reported more than 30 days ago."
},
{
"role": "assistant",
"content": "SELECT claim_id, policy_id, customer_id, reported_date FROM insurance.claims WHERE status = 'pending' AND reported_date < CURR... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara... |
[
{
"role": "user",
"content": "Can you show me each user's address and the date their wallet was created?"
},
{
"role": "assistant",
"content": "SELECT user_id, address, created_at FROM trading_platform.wallets;"
},
{
"role": "user",
"content": "Now, can you show only wallets created ... | You are an SQL statement expert. Given the table 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 )
|
[
{
"role": "user",
"content": "Show me all documents uploaded by lawyers from law firms located in 'New York'. Include the document name, upload timestamp, the first and last name of the uploading lawyer, and the firm name."
},
{
"role": "assistant",
"content": "SELECT d.document_name, d.upload_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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Show me the top 5 users who have the highest total order quantity, along with their order type and the average price they paid."
},
{
"role": "assistant",
"content": "SELECT user_id, order_type, SUM(quantity) as total_quantity, AVG(price) as avg_price FROM trading_p... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan... |
[
{
"role": "user",
"content": "For each guest, calculate the total number of service orders they have placed and the sum of quantities ordered. Show guest_id, order_count, and total_quantity."
},
{
"role": "assistant",
"content": "SELECT guest_id,\n COUNT(order_id) AS order_count,\n 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 hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Show me the document_id, document_name, and upload_timestamp for all documents uploaded by lawyer with ID 'lawyer_456'."
},
{
"role": "assistant",
"content": "SELECT document_id, document_name, upload_timestamp\nFROM legal_services.documents\nWHERE uploaded_by_lawye... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases ( case_id character varying(64) NOT NULL, case_number character varying(100) UNIQUE, case_name tex... |
[
{
"role": "user",
"content": "Show me the top 5 tokens by 24-hour trading volume in the 'Gaming' narrative, along with their price and 24-hour price change percentage."
},
{
"role": "assistant",
"content": "SELECT t.token_name, t.token_symbol, t.price, t.price_change_percentage_24h, t.total_volu... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "List all NFT holdings from the `nft_holders` table where the `contract_type` is 'ERC721'. Show the wallet address, contract address, token ID, and amount held."
},
{
"role": "assistant",
"content": "SELECT wallet_address, contract_address, token_id, CAST(amount AS 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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "For each property, compute the average price and count of available services grouped by department."
},
{
"role": "assistant",
"content": "SELECT p.property_id, p.property_name, s.department, COUNT(*) AS service_count, AVG(s.price) AS avg_price\nFROM hospitality_tec... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "List all active staff members who are managers, along with their hire dates and email addresses."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, hire_date, work_email FROM hospitality_technology.staff WHERE is_active = true AND position LIKE '%M... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "How many inactive insurance products are there?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM insurance.insurance_products WHERE is_active = false;"
}
] | You are an SQL statement expert. Given the table 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_... |
[
{
"role": "user",
"content": "List all users who have pending KYC reviews that were submitted more than 7 days ago, along with when they were submitted."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, k.reviewed_at FROM trading_platform.users u JOIN trading_platform.kyc_audit k... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Show the usernames and emails for all users whose bio contains the word 'engineer'."
},
{
"role": "assistant",
"content": "SELECT username, email FROM social_media.users WHERE bio ILIKE '%engineer%';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "Show the names of all agencies and the names of their associated service locations."
},
{
"role": "assistant",
"content": "SELECT T1.agency_name , T2.location_name FROM government_services.agencies AS T1 JOIN government_services.service_locations AS T2 ON T1.agency... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id text, agency_name text, jurisdiction_level text, primary_contact_email text, m... |
[
{
"role": "user",
"content": "Show the names of agencies along with their website URLs which were established before the year 2000."
},
{
"role": "assistant",
"content": "SELECT agency_name, website_url\nFROM government_services.agencies\nWHERE established_date < '2000-01-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "I want to retrieve each client's full name along with the subject and start time of their appointments."
},
{
"role": "assistant",
"content": "SELECT c.first_name || ' ' || c.last_name AS client_name, a.subject, a.start_time\nFROM legal_services.clients c\nJOIN lega... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Show me the earliest created smart contract for each creator address."
},
{
"role": "assistant",
"content": "SELECT sc1.contract_id, sc1.creator_address, sc1.timestamp FROM blockchain.smart_contracts sc1 WHERE sc1.timestamp = (SELECT MIN(sc2.timestamp) FROM blockcha... | You are an SQL statement expert. Given the table 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 )
|
[
{
"role": "user",
"content": "Which user has created the most tokens? Please show the username and the number of tokens they have created."
},
{
"role": "assistant",
"content": "SELECT u.username, COUNT(*) AS token_count\nFROM web3.tokens t\nJOIN web3.contracts c ON t.contract_address = c.addres... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,... |
[
{
"role": "user",
"content": "List all pairs of users who follow each other, including their usernames."
},
{
"role": "assistant",
"content": "SELECT\n u1.username AS user_a,\n u2.username AS user_b\nFROM\n social_media.follows f1\n JOIN social_media.follows f2\n ON f1.follower_user_id = ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "List the tag names and creation dates for all hashtags created on June 12, 2024."
},
{
"role": "assistant",
"content": "SELECT tag_name, created_at FROM social_media.hashtags WHERE created_at::date = '2024-06-12';"
},
{
"role": "user",
"content": "Please... | You are an SQL statement expert. Given the table 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.hashtags ( hashtag_id text, tag_name text, created_at timestamp )
|
[
{
"role": "user",
"content": "For each trip, list the trip ID, its scheduled departure time, and the total fare from all bookings associated with that trip."
},
{
"role": "assistant",
"content": "SELECT T2.trip_id , T2.scheduled_departure , SUM(T1.fare) FROM transportation.bookings AS T1 JOIN ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "Show the reservation ID, property name, and room type name for all reservations with a status of 'Confirmed'."
},
{
"role": "assistant",
"content": "SELECT T1.reservation_id, T2.property_name, T3.type_name FROM hospitality_technology.reservations AS T1 JOIN hospital... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "Count the number of premium payments that have a null payment method."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS null_payment_method_count\nFROM insurance.premium_payments\nWHERE payment_method IS NULL;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "For each reservation, show me the guest's full name, the property name, and the room type name."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, g.first_name || ' ' || g.last_name AS guest_full_name, p.property_name, rt.type_name AS room_type_name\nFR... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Show me the total premium paid by each customer for insurance products where the base premium is less than 2000. I want to see customer_id, product_id, and total_premium_paid."
},
{
"role": "assistant",
"content": "SELECT pp.customer_id, ip.product_id, SUM(pp.amount... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, product_name character varying(150) NOT NULL,... |
[
{
"role": "user",
"content": "List appointment_id, appointment_time, patient\\u2019s full name, and doctor\\u2019s specialty for all appointments scheduled in the next 7 days."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, a.appointment_time, p.first_name || ' ' || p.last_name 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 healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "Find all peers that haven't been seen in the last 30 days, along with their IP addresses and ports."
},
{
"role": "assistant",
"content": "SELECT peer_id, ip_address, port FROM trading_platform.peers WHERE last_seen < CURRENT_DATE - INTERVAL '30 days';"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address ch... |
[
{
"role": "user",
"content": "Show me the driver_id and full name for all drivers."
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name FROM transportation.drivers;"
},
{
"role": "user",
"content": "Only show drivers whose status is 'Inactive'."
},
{
... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "List all in-game items with their name, type, and rarity."
},
{
"role": "assistant",
"content": "SELECT item_name, item_type, rarity FROM gaming_technology.in_game_items;"
},
{
"role": "user",
"content": "Filter this list to include only items with 'Rare... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "Show the document type, verification status, and the full name of the citizen who uploaded each document."
},
{
"role": "assistant",
"content": "SELECT d.document_type, d.verification_status, CONCAT(c.first_name, ' ', c.last_name) AS citizen_full_name FROM governmen... | You are an SQL statement expert. Given the table 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, -- unique identifier for the document i... |
[
{
"role": "user",
"content": "Find pairs of games released on the same date but by different publishers. Show g1.title, g2.title, g1.publisher_id, g2.publisher_id, and the shared release_date."
},
{
"role": "assistant",
"content": "SELECT g1.title AS game1, g2.title AS game2, g1.publisher_id AS ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea... |
[
{
"role": "user",
"content": "List the full name of all patients who have no prescriptions recorded in the system."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name FROM healthcare.patients AS T1 LEFT JOIN healthcare.prescriptions AS T2 ON T1.patient_id = T2.patient_id 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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "For conversation 'C123', list participant user IDs with their usernames, theme setting, and private_profile flag."
},
{
"role": "assistant",
"content": "SELECT cp.user_id, u.username, us.theme, us.private_profile FROM social_media.conversation_participants cp JOIN 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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "Show me a list of all doctors who have made at least one diagnosis along with the total number of diagnoses they have made."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id, d.first_name, d.last_name, COUNT(di.diagnosis_id) AS diagnosis_count\nFROM healthca... | You are an SQL statement expert. Given the table 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, ... |
[
{
"role": "user",
"content": "For each user, retrieve their most recent log entry, including the action and timestamp."
},
{
"role": "assistant",
"content": "SELECT l.user_id, l.action, l.logged_at FROM trading_platform.logs l JOIN (SELECT user_id, MAX(logged_at) AS max_time FROM trading_platfor... | You are an SQL statement expert. Given the table 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.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp )
|
[
{
"role": "user",
"content": "Provide a count of payments for each unique currency type recorded in the system."
},
{
"role": "assistant",
"content": "SELECT currency, COUNT(*) AS payment_count FROM government_services.payments GROUP BY currency;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... |
[
{
"role": "user",
"content": "For each agency offering more than 5 active services, list the agency_name, jurisdiction_level, and the count of active services. Order the results by the count in descending order."
},
{
"role": "assistant",
"content": "SELECT a.agency_name,\n a.jurisdiction_... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "Show me all documents and the appointments scheduled by the same citizen. List the document ID, upload timestamp, document type, the corresponding appointment ID, and its scheduled start time."
},
{
"role": "assistant",
"content": "SELECT T1.document_id, T1.upload_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 government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz... |
[
{
"role": "user",
"content": "For each policy, get the policy_number, total_paid_amount, and beneficiary_count."
},
{
"role": "assistant",
"content": "SELECT p.policy_number,\n SUM(pp.amount_paid) AS total_paid_amount,\n COUNT(b.beneficiary_id) AS beneficiary_count\nFROM insurance.po... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
[
{
"role": "user",
"content": "List all accounts (account_id, account_number, balance) that have at least one trade with a quantity greater than 1000, along with the count of such trades for each account."
},
{
"role": "assistant",
"content": "SELECT a.account_id, a.account_number, a.balance, COU... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac... |
[
{
"role": "user",
"content": "Show me the top 5 users by the total number of trades they participated in as sellers, along with their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT t.seller_id, w.address, COUNT(t.trade_id) AS total_trades FROM trading_platform.trades t JOIN trad... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address ch... |
[
{
"role": "user",
"content": "What is the average ROI and average realized_ratio for each chain?"
},
{
"role": "assistant",
"content": "SELECT chain,\n AVG(roi) AS avg_roi,\n AVG(realized_ratio) AS avg_realized_ratio\nFROM smart_money_token_performance\nGROUP BY chain;"
},
{
... | You are an SQL statement expert. Given the table 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_performance ( token_address text, token_symbol text, pnl numeric, net_flow numeric, avg_cost numeric,... |
[
{
"role": "user",
"content": "List distinct patient IDs who have received a diagnosis from a doctor with 'Cardiology' specialty."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.patient_id FROM healthcare.diagnoses AS T1 JOIN healthcare.doctors AS T2 ON T1.doctor_id = T2.doctor_id WHERE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "Show each contract's address along with the total number of events it has emitted and the total number of transactions sent to it."
},
{
"role": "assistant",
"content": "SELECT\n c.address,\n COUNT(e.event_id) AS event_count,\n COUNT(t.transaction_id) AS tx_count... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts (
contract_id character varying(64) NOT NULL, -- unique identifier for the contract
address cha... |
[
{
"role": "user",
"content": "For each guest, list each review and its immediately following review, including guest_id, first_review_id, first_review_date, second_review_id, and second_review_date."
},
{
"role": "assistant",
"content": "SELECT r1.guest_id, r1.review_id AS first_review_id, r1.re... | You are an SQL statement expert. Given the table 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.reviews ( review_id.text, property_id.text, reservation_id.text, guest_id.text, rating_overall.i... |
[
{
"role": "user",
"content": "Show me the top 5 users who have the highest total trade volume (quantity * price) as buyers, along with their email addresses and the number of distinct assets they traded."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, COUNT(DISTINCT t.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 text, username text, email text, password_hash text, created_at timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "List all transactions together with any event emitted in the same transaction, showing transaction ID, event name, and event emitted timestamp."
},
{
"role": "assistant",
"content": "SELECT tx.transaction_id, ev.event_name, ev.emitted_at\nFROM web3.transactions tx\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,... |
[
{
"role": "user",
"content": "Show the usernames of users who have followers and the total count of followers for each."
},
{
"role": "assistant",
"content": "SELECT T1.username, COUNT(T2.follower_user_id) AS follower_count FROM social_media.users AS T1 JOIN social_media.follows AS T2 ON T1.user... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t... |
[
{
"role": "user",
"content": "For each employee who acts as a manager, please show the number of employees directly reporting to them."
},
{
"role": "assistant",
"content": "SELECT m.first_name || ' ' || m.last_name AS manager_name, COUNT(e.employee_id) AS direct_report_count FROM financial_serv... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "How many notifications are there for each distinct notification type?"
},
{
"role": "assistant",
"content": "SELECT notification_type, COUNT(*) FROM social_media.notifications GROUP BY notification_type;"
}
] | You are an SQL statement expert. Given the table 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.hashtags ( hashtag_id.text, tag_name.text, created_at.timestamp )
CREATE TABLE social_media.notifications ... |
[
{
"role": "user",
"content": "List all comments on a given post along with the commenter’s username and the comment time."
},
{
"role": "assistant",
"content": "SELECT c.comment_id, c.content, u.username, c.created_at\nFROM social_media.comments c\nJOIN social_media.users u ON c.user_id = u.user... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "How many policies were canceled in the previous month, grouped by cancellation reason?"
},
{
"role": "assistant",
"content": "SELECT cancellation_reason,\n COUNT(*) AS canceled_count\nFROM insurance.policies\nWHERE cancellation_date BETWEEN date_trunc('month',... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "Give me the average cleanliness rating from reviews for each property."
},
{
"role": "assistant",
"content": "SELECT property_id, AVG(rating_cleanliness) AS avg_cleanliness_rating\nFROM hospitality_technology.reviews\nGROUP BY property_id;"
},
{
"role": "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 hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat... |
[
{
"role": "user",
"content": "Show me all patients who have been prescribed medications with dosage greater than 100mg, along with their full names and the medication details, including the prescribing doctor's last name."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, m... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Give me the total commission and average price_per_unit for each execution_venue for trades executed in the last 30 days."
},
{
"role": "assistant",
"content": "SELECT execution_venue, SUM(commission) AS total_commission, AVG(price_per_unit) AS avg_price\nFROM finan... | You are an SQL statement expert. Given the table 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.... |
[
{
"role": "user",
"content": "Show me all achievements with their name and the total number of players who have unlocked each achievement."
},
{
"role": "assistant",
"content": "SELECT a.achievement_id, a.name, COUNT(pa.player_id) AS players_unlocked\nFROM gaming_technology.achievements a\nLEFT ... | You are an SQL statement expert. Given the table 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(), title character varying(200) NOT NULL, devel... |
[
{
"role": "user",
"content": "Find all pairs of lawyers who work for the same firm, showing each lawyer's first_name, last_name, email, and firm_id."
},
{
"role": "assistant",
"content": "SELECT l1.first_name AS lawyer1_first_name,\n l1.last_name AS lawyer1_last_name,\n l1.email AS l... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph... |
[
{
"role": "user",
"content": "I want to list pairs of developers from the same country. For each pair, show both developers’ names and their country."
},
{
"role": "assistant",
"content": "SELECT d1.name AS developer1, d2.name AS developer2, d1.country\nFROM gaming_technology.developers d1\nJOIN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "List pairs of wallet IDs owned by the same user where the creation dates are more than one year apart. Show the user ID and the wallet IDs of both wallets."
},
{
"role": "assistant",
"content": "SELECT w1.user_id, w1.wallet_id AS wallet_id_1, w2.wallet_id AS wallet_... | You are an SQL statement expert. Given the table 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 )
|
[
{
"role": "user",
"content": "List all comments made on public posts that have a location specified, including comment_id, post_id, comment content, and the comment's created_at timestamp."
},
{
"role": "assistant",
"content": "SELECT c.comment_id,\n c.post_id,\n c.content,\n 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.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u... |
[
{
"role": "user",
"content": "Show me all cases that are associated with the court jurisdiction 'Federal Court'."
},
{
"role": "assistant",
"content": "SELECT * FROM legal_services.cases WHERE court_jurisdiction = 'Federal Court';"
},
{
"role": "user",
"content": "From these cases, o... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases ( case_id text, case_number text, case_name text, client_id text, lead_lawyer_id text, case_type t... |
[
{
"role": "user",
"content": "List all pairs of cases that share the same court jurisdiction, including both case names and their common jurisdiction."
},
{
"role": "assistant",
"content": "SELECT c1.case_name AS case_name_1, c2.case_name AS case_name_2, c1.court_jurisdiction\nFROM legal_service... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases ( case_id text, case_number text, case_name text, client_id text, lead_lawyer_id text, case_type t... |
[
{
"role": "user",
"content": "I need a report of total maintenance cost per vehicle type."
},
{
"role": "assistant",
"content": "SELECT v.type AS vehicle_type,\n SUM(m.cost) AS total_maintenance_cost\nFROM transportation.vehicles v\nJOIN transportation.maintenance_logs m ON v.vehicle_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.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "Count the number of users for each email domain."
},
{
"role": "assistant",
"content": "SELECT split_part(email, '@', 2) AS domain, COUNT(*) AS user_count\nFROM web3.users\nGROUP BY domain;"
},
{
"role": "user",
"content": "Filter to domains 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 web3.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username character vary... |
[
{
"role": "user",
"content": "List all inactive insurance products that were created more than 5 years ago."
},
{
"role": "assistant",
"content": "SELECT * FROM insurance.insurance_products WHERE is_active = false AND created_at < CURRENT_DATE - INTERVAL '5 years';"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"role": "user",
"content": "I want to see, for each security, the total number of market data points and the average adjusted_close_price, including ticker_symbol and security_name."
},
{
"role": "assistant",
"content": "SELECT s.ticker_symbol, s.security_name, COUNT(md.data_point_id) AS data_... | You are an SQL statement expert. Given the table 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, ticker_symbol.text, isin_code.text, cusip_code.text, security_name.te... |
[
{
"role": "user",
"content": "List all trips that originated from locations in California, showing the trip ID, vehicle make and model, and origin location details."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, v.make, v.model, l.name AS origin_name, l.city AS origin_city FROM transpo... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "List the first name, last name, and hire date for all lawyers who were hired after the year 2020."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, hire_date FROM legal_services.lawyers WHERE hire_date > '2020-12-31'"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph... |
[
{
"role": "user",
"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": "assist... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "Show the average maintenance cost for each service type per vehicle."
},
{
"role": "assistant",
"content": "SELECT vehicle_id,\n service_type,\n AVG(cost) AS avg_cost\nFROM transportation.maintenance_logs\nGROUP BY vehicle_id, service_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 transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "List all appointments for the client with ID 'client_001' showing the lawyer's ID, appointment subject, and start time."
},
{
"role": "assistant",
"content": "SELECT a.lawyer_id, a.subject, a.start_time\nFROM legal_services.appointments a\nWHERE a.client_id = 'clien... | You are an SQL statement expert. Given the table 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, ... |
[
{
"role": "user",
"content": "How many unique medications have ever been prescribed to each patient? Show patient_id and medication_count."
},
{
"role": "assistant",
"content": "SELECT patient_id, COUNT(DISTINCT medication_id) AS medication_count\nFROM healthcare.prescriptions\nGROUP BY patient_... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "Get the total ERC20 balance per contract_address across all wallets from erc20_balances."
},
{
"role": "assistant",
"content": "SELECT contract_address,\n SUM(CAST(amount AS NUMERIC)) AS total_balance\nFROM erc20_balances\nGROUP BY contract_address\nORDER BY 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 erc20_balances ( block_number bigint, contract_address varchar, wallet_address varchar, amount varchar, pk varchar )
CR... |
[
{
"role": "user",
"content": "For each doctor, count how many medical record entries they have created and show the doctor_id alongside the record count."
},
{
"role": "assistant",
"content": "SELECT doctor_id, COUNT(*) AS record_count\nFROM healthcare.medical_records\nGROUP BY doctor_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 healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "For each property, show the total number of reservations with status 'Confirmed' and the average total_amount."
},
{
"role": "assistant",
"content": "SELECT p.property_id,\n p.property_name,\n COUNT(r.reservation_id) AS confirmed_reservations,\n 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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "For each vehicle, list the vehicle_id and the total number of trips it has performed."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, COUNT(*) AS trip_count FROM transportation.trips GROUP BY vehicle_id;"
},
{
"role": "user",
"content": "Can yo... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "List the application_id and the number of notifications with status 'Pending' for each application."
},
{
"role": "assistant",
"content": "SELECT application_id, COUNT(*) AS pending_notification_count\nFROM government_services.notifications\nWHERE status = 'Pending'... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, citizen_id character varying(64) NO... |
[
{
"role": "user",
"content": "Get the full name of guests, the property name, check-in and check-out dates, and total amount for all reservations with more than 2 adults."
},
{
"role": "assistant",
"content": "SELECT g.first_name || ' ' || g.last_name AS guest_full_name, p.property_name, r.check... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "How many routes start and end in the same city?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS same_city_routes\nFROM transportation.routes AS r\nJOIN transportation.locations AS o ON r.origin_location_id = o.location_id\nJOIN transportation.locations 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 transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f... |
[
{
"role": "user",
"content": "Get the total number of participants per conversation along with the number of participants who have private profiles."
},
{
"role": "assistant",
"content": "SELECT cp.conversation_id, COUNT(cp.user_id) AS total_participants, SUM(CASE WHEN us.private_profile THEN 1 ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, created_at.timestamp )
CREATE TABLE soc... |
[
{
"role": "user",
"content": "List the transaction IDs and timestamps for all transactions sent to the contract address of the token with the symbol 'USDC'."
},
{
"role": "assistant",
"content": "SELECT T1.transaction_id, T1.timestamp FROM web3.transactions AS T1 JOIN web3.tokens AS T2 ON T1.to_... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id.text, from_address.text, to_address.text, value.n... |
[
{
"role": "user",
"content": "How many hashtags have been created before May 2024?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.hashtags WHERE created_at < '2024-05-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.hashtags ( hashtag_id text, tag_name text, created_at timestamp )
|
[
{
"role": "user",
"content": "List all servers, showing their name, region, and current number of players."
},
{
"role": "assistant",
"content": "SELECT server_name, region, current_players FROM gaming_technology.servers;"
},
{
"role": "user",
"content": "Only include servers that ar... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "List the product_id and product_name for insurance products that are not currently active."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name FROM insurance.insurance_products WHERE is_active = FALSE;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
[
{
"role": "user",
"content": "I need to identify customers who have two different policies that have overlapping coverage periods. List the customer_id along with the two policy_ids."
},
{
"role": "assistant",
"content": "SELECT p1.customer_id,\n p1.policy_id AS policy1_id,\n p2.poli... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "Show all medical records with the record_id, record_date, the patient's insurance policy_number, and the doctor's ID, for records linked to a currently active insurance policy."
},
{
"role": "assistant",
"content": "SELECT mr.record_id, mr.record_date, pi.policy_num... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "List the names of services for which documents are set to expire in the next 90 days."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.service_name FROM government_services.services AS T1 JOIN applications AS T2 ON T1.service_id = T2.service_id JOIN governm... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, agency_id text, service_name text, description text, catego... |
[
{
"role": "user",
"content": "Get the earliest and latest unread notification for each recipient, including notification_ids, types, and timestamps."
},
{
"role": "assistant",
"content": "WITH earliest AS (\n SELECT recipient_user_id, MIN(created_at) AS earliest_time\n FROM social_media.notifi... | You are an SQL statement expert. Given the table 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.notifications ( notification_id character varying(64) NOT NULL, recipient_user_id character varying(64) NO... |
[
{
"role": "user",
"content": "Show the total amount paid for services in each category."
},
{
"role": "assistant",
"content": "SELECT T2.category , SUM(T1.amount) FROM government_services.payments AS T1 JOIN government_services.services AS T2 ON T1.service_id = T2.service_id GROUP BY T2.categ... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "Show me all properties in California with a star rating above 4.0, along with their room types and base rates."
},
{
"role": "assistant",
"content": "SELECT p.property_name, p.star_rating, rt.type_name, rt.base_rate FROM hospitality_technology.properties p JOIN hosp... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id.text, property_name.text, address_line1.text, address_line2.text, city.... |
[
{
"role": "user",
"content": "Show me all guests who have the same last name and are from the same city, along with how many guests share that last name and city combination."
},
{
"role": "assistant",
"content": "SELECT last_name, city, COUNT(*) as guest_count FROM hospitality_technology.guests... | You are an SQL statement expert. Given the table 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.