conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Show me all accounts (account_id, account_number, balance) that have a balance greater than $50,000 and are in USD currency, along with the security details (ticker_symbol, security_name) for securities traded on the same exchange as the account's last_updated_at 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 character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac... |
[
{
"role": "user",
"content": "Find cases where an address received tokens in one transfer and then sent tokens in another. List the receive transfer_id, the send transfer_id, the address, and both transfer values."
},
{
"role": "assistant",
"content": "SELECT recv.transfer_id AS receive_transfer... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.token_transfers (
transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer
token... |
[
{
"role": "user",
"content": "List all document names and their latest version numbers for each case."
},
{
"role": "assistant",
"content": "SELECT d.case_id, d.document_name, MAX(d.version) AS latest_version\nFROM legal_services.documents d\nGROUP BY d.case_id, d.document_name;"
},
{
"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 legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "I'm interested in pairs of players who registered on the exact same calendar date and in the same country. Can you show two columns, player1_id and player2_id, along with that date and country code?"
},
{
"role": "assistant",
"content": "SELECT p1.player_id AS playe... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "List all accounts for customers who have at least one account with a balance over 10000 and another account with a balance under 1000. Show customer_id, account_id, account_type, balance, and currency."
},
{
"role": "assistant",
"content": "SELECT account_id , cust... | You are an SQL statement expert. Given the table 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": "List all reservations with their guest IDs and room IDs where the total amount is greater than $300, ordered by check-in date."
},
{
"role": "assistant",
"content": "SELECT reservation_id, guest_id, room_id, check_in_date FROM hospitality_technology.reservations WHE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.reservations ( reservation_id text PRIMARY KEY, property_id text, guest_id text, room_id text, r... |
[
{
"role": "user",
"content": "Summarize trade activity by account and execution venue, showing the total quantity of shares traded and the average commission paid."
},
{
"role": "assistant",
"content": "SELECT account_id, execution_venue, SUM(quantity) AS total_quantity, AVG(commission) AS avera... | You are an SQL statement expert. Given the table 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": "Provide each trip's ID, vehicle license plate, driver's full name, origin city, and destination city."
},
{
"role": "assistant",
"content": "SELECT t.trip_id,\n v.license_plate,\n CONCAT(d.first_name, ' ', d.last_name) AS driver_name,\n lo.city 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.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "List all room types showing their type name, base rate, and the name of the property where they are offered."
},
{
"role": "assistant",
"content": "SELECT T1.type_name, T1.base_rate, T2.property_name FROM hospitality_technology.room_types AS T1 JOIN 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.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "List the invoice_number, total_amount, the full name of the client, and the case_number for all invoices."
},
{
"role": "assistant",
"content": "SELECT i.invoice_number, i.total_amount, c.first_name || ' ' || c.last_name AS client_full_name, cs.case_number\nFROM leg... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"role": "user",
"content": "Show me the top 5 narratives by market cap, along with their 24-hour trading volume and 7-day price change percentage."
},
{
"role": "assistant",
"content": "SELECT narrative.text, volume_24h.numeric, price_change_percentage_7d.numeric FROM narrative_info ORDER BY 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 narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume... |
[
{
"role": "user",
"content": "List each username with how many users they follow and how many users follow them."
},
{
"role": "assistant",
"content": "SELECT u.username,\n COALESCE(following.following_count, 0) AS following_count,\n COALESCE(followers.followers_count, 0) AS follower... | You are an SQL statement expert. Given the table 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 document names and subjects of appointments that are linked to the same case, but only for documents uploaded after March 1st, 2024."
},
{
"role": "assistant",
"content": "SELECT d.document_name, a.subject, d.case_id\nFROM legal_services.documents d\nJOIN 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.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "Show me all in-game items along with their rarity and the total number of times each item has been acquired by players."
},
{
"role": "assistant",
"content": "SELECT igi.item_name, igi.rarity, COALESCE(SUM(pi.quantity),0) AS total_acquired\nFROM gaming_technology.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 gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "Can you show me all doctors affiliated with hospital ID 'HOSP1001', including their doctor ID, full name, and specialty?"
},
{
"role": "assistant",
"content": "SELECT doctor_id, first_name, last_name, specialty FROM healthcare.doctors WHERE hospital_affiliation_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.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number... |
[
{
"role": "user",
"content": "Which invoices have a status of 'Partially Paid' and have not reached their due date yet? Show the invoice number, client ID, due date, and amount paid."
},
{
"role": "assistant",
"content": "SELECT invoice_number, client_id, due_date, amount_paid\nFROM legal_servic... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices (
invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice
invo... |
[
{
"role": "user",
"content": "Can you list the wallet addresses and the amount held for the NFT with contract address '0xabcd...' and token ID '123'?"
},
{
"role": "assistant",
"content": "SELECT wallet_address, amount FROM nft_holders WHERE contract_address = '0xabcd...' AND token_id = '123';"
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ... |
[
{
"role": "user",
"content": "Find pairs of achievements within each game where the point difference is exactly 10."
},
{
"role": "assistant",
"content": "SELECT a1.achievement_id AS ach1_id,\n a2.achievement_id AS ach2_id,\n ABS(a1.points - a2.points) AS point_diff\nFROM gaming_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 gaming_technology.achievements ( achievement_id.uuid, game_id.uuid, name.text, description.text, icon_url.text, points.... |
[
{
"role": "user",
"content": "Show me the contract addresses and their deployer addresses for contracts deployed on the 'ethereum' network, sorted by deployment timestamp in descending order."
},
{
"role": "assistant",
"content": "SELECT address, deployer_address FROM web3.contracts WHERE networ... | You are an SQL statement expert. Given the table 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 me the total quantity and total revenue for each service, along with the number of unique guests who ordered each service."
},
{
"role": "assistant",
"content": "SELECT service_id, SUM(quantity) AS total_quantity, SUM(total_price) AS total_revenue, COUNT(DISTIN... | You are an SQL statement expert. Given the table 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.service_orders ( order_id text PRIMARY KEY, reservation_id text, guest_id text, service_id text,... |
[
{
"role": "user",
"content": "Show me the number of accounts and their average balance for each status and currency combination."
},
{
"role": "assistant",
"content": "SELECT status, currency, COUNT(*) AS account_count, AVG(balance) AS average_balance\nFROM financial_services.accounts\nGROUP BY ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba... |
[
{
"role": "user",
"content": "List the top 3 tokens by net flow on the Binance chain, including their symbol and average cost."
},
{
"role": "assistant",
"content": "SELECT token_symbol, net_flow, avg_cost FROM smart_money_token_performance WHERE chain = 'Binance' ORDER BY net_flow DESC LIMIT 3;... | You are an SQL statement expert. Given the table 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 character varying(100) NOT NULL, -- the token's address token_symbol char... |
[
{
"role": "user",
"content": "List policy IDs, policy numbers, start dates, and premium amounts for policies issued in the last 90 days with a premium amount greater than 5000."
},
{
"role": "assistant",
"content": "SELECT policy_id, policy_number, start_date, premium_amount FROM insurance.polic... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ... |
[
{
"role": "user",
"content": "Find consecutive image messages in each conversation: return conversation_id, first_image_id, next_image_id, and time_diff in seconds."
},
{
"role": "assistant",
"content": "SELECT m1.conversation_id,\n m1.message_id AS first_image_id,\n m2.message_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 social_media.messages (
message_id character varying(64) NOT NULL, -- unique identifier for the message
convers... |
[
{
"role": "user",
"content": "List the total traded amount and total commission for each security, including the security name."
},
{
"role": "assistant",
"content": "SELECT s.security_id, s.security_name, SUM(t.total_amount) AS total_traded_amount, SUM(t.commission) AS total_commission\nFROM fi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.trades (
trade_id character varying(64) NOT NULL, -- unique identifier for the trade
account... |
[
{
"role": "user",
"content": "Find all transactions where the amount is greater than 1000 and the receiver_address starts with '0x1'."
},
{
"role": "assistant",
"content": "SELECT * FROM blockchain.transactions WHERE amount > 1000 AND receiver_address LIKE '0x1%';"
},
{
"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 blockchain.transactions ( transaction_id text PRIMARY KEY, block_id text, sender_address text, receiver_address text, a... |
[
{
"role": "user",
"content": "For each vehicle, list its make, model, the total cost of all its maintenance logs, and the total number of completed trips it has made."
},
{
"role": "assistant",
"content": "SELECT\n v.make,\n v.model,\n COALESCE(SUM(ml.cost), 0) AS total_maintenance_cost,\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 transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "List all pending orders that were created more than 7 days ago, along with their order details."
},
{
"role": "assistant",
"content": "SELECT order_id, user_id, asset_id, order_type, quantity, price, created_at FROM trading_platform.orders WHERE status = 'pending' A... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.orders ( order_id text, user_id text, wallet_id text, asset_id text, order_type text, quantity numeric... |
[
{
"role": "user",
"content": "What are the top 3 narratives by average USD purchase value per address (for buy transactions) across all chains?"
},
{
"role": "assistant",
"content": "SELECT narrative, AVG(usd_value::float / NULLIF(address_amount,0)) AS avg_usd_per_address\nFROM smart_money_token... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the token's address token_symbol character... |
[
{
"role": "user",
"content": "Show me the total hours spent by each lawyer on a specific case, say with case_id = 'CASE001'."
},
{
"role": "assistant",
"content": "SELECT lawyer_id, SUM(hours_spent) AS total_hours FROM legal_services.time_entries WHERE case_id = 'CASE001' GROUP BY lawyer_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 legal_services.time_entries ( entry_id text PRIMARY KEY, case_id text, lawyer_id text, date_worked date, hours_spent nu... |
[
{
"role": "user",
"content": "Show the contract address, symbol, and current total supply for all Avalanche tokens from token_balances_avalanche."
},
{
"role": "assistant",
"content": "SELECT tick AS contract_address, tick AS symbol, SUM(total_supply) AS current_total_supply\nFROM token_balances... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "Show each wallet address that has received token transfers of more than one type of token, along with the count of token types received."
},
{
"role": "assistant",
"content": "SELECT tt.to_address, COUNT(DISTINCT tt.token_id) AS token_type_count\nFROM web3.token_tra... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, address text, abi text, bytecode text, deployer_address text, deployed_a... |
[
{
"role": "user",
"content": "List all appointments with status 'Completed' and location 'LOC001' that occurred in December 2023. Show appointment ID, time, duration, and notes."
},
{
"role": "assistant",
"content": "SELECT appointment_id, appointment_time, duration_minutes, notes FROM healthcar... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doc... |
[
{
"role": "user",
"content": "What is the ticket price for a journey on train number T4321?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to information about ticket prices for specific trains. The data I have is limited to train details such as model, manufacturer, c... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.t... |
[
{
"role": "user",
"content": "Show all cases that were opened and subsequently closed in the same calendar year. List the case name, case number, date opened, and date closed."
},
{
"role": "assistant",
"content": "SELECT case_name, case_number, date_opened, date_closed FROM legal_services.cases... | You are an SQL statement expert. Given the table 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": "How many appointments are scheduled to start tomorrow?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM government_services.appointments WHERE DATE(scheduled_start_time) = CURRENT_DATE + INTERVAL '1 day'"
}
] | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "List the document ID, document type, and the full name of the citizen who submitted the document, but only for documents submitted for applications with a status of 'Approved'."
},
{
"role": "assistant",
"content": "SELECT T1.document_id, T1.document_type, T3.first_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents ( document_id.text, application_id.text, citizen_id.text, document_type.text, file_refere... |
[
{
"role": "user",
"content": "Show the usernames of players who have participated in game sessions on servers in the 'eu-central-1' region. Also include the server name, game title, and the session start time."
},
{
"role": "assistant",
"content": "SELECT p.username, s.server_name, g.title, gs.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 gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "Show me the usernames and the group names of group chats where each user has posted at least one post containing a hashtag."
},
{
"role": "assistant",
"content": "SELECT u.username, c.group_name\nFROM social_media.users u\nJOIN social_media.posts p ON u.user_id = 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.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t... |
[
{
"role": "user",
"content": "Show all diagnoses recorded by doctor with ID 'doc789'. Include the diagnosis ID, patient ID, description, and diagnosis date."
},
{
"role": "assistant",
"content": "SELECT diagnosis_id, patient_id, description, diagnosis_date FROM healthcare.diagnoses WHERE doctor_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "List the names of NFT collections and the wallet addresses that hold NFTs from those collections."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.name, T2.wallet_address FROM nft_collections AS T1 JOIN nft_holder_historical AS T2 ON T1.contract_address = T... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varch... |
[
{
"role": "user",
"content": "How many documents have been uploaded by each lawyer? Show the lawyer ID and the count."
},
{
"role": "assistant",
"content": "SELECT uploaded_by_lawyer_id, COUNT(*) AS document_count FROM legal_services.documents GROUP BY uploaded_by_lawyer_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 legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... |
[
{
"role": "user",
"content": "Show the usernames and emails of all users who registered on the same day as at least one other user, along with the registration date."
},
{
"role": "assistant",
"content": "SELECT u1.username, u1.email, u1.created_at\nFROM web3.users u1\nJOIN web3.users u2\n ON u... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
|
[
{
"role": "user",
"content": "I want to find each player's total score across all sessions and the total number of items they have in their inventory."
},
{
"role": "assistant",
"content": "SELECT gs.player_id,\n SUM(gs.score) AS total_score,\n COALESCE(SUM(pi.quantity), 0) AS total_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.game_sessions ( session_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, game_id ... |
[
{
"role": "user",
"content": "Show me the top 5 tokens by 24-hour trading volume on the Ethereum chain, along with their price and 24-hour price change percentage."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, price, price_change_percentage_24h, volume_24h FROM token_de... | You are an SQL statement expert. Given the table 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, token_name character varying(100) NOT NULL, token_sy... |
[
{
"role": "user",
"content": "How many smart money addresses are recorded for each chain?"
},
{
"role": "assistant",
"content": "SELECT chain, COUNT(address) FROM smart_money_profit GROUP BY chain;"
},
{
"role": "user",
"content": "Now, only show chains that have more than 100 record... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE smart_money_profit ( address character varying(100) NOT NULL, -- the user's address ... |
[
{
"role": "user",
"content": "How many messages did user 'U456' send between '2024-01-01' and '2024-01-31'?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS message_count\nFROM social_media.messages\nWHERE sender_user_id = 'U456'\n AND sent_at BETWEEN '2024-01-01' AND '2024-01-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 social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "Can you list each user's theme setting along with the number of likes they have given to posts?"
},
{
"role": "assistant",
"content": "SELECT us.user_id, us.theme, COUNT(l.like_id) AS like_count FROM social_media.user_settings us LEFT JOIN social_media.likes l ON us... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, created_at.timestamp )
CREATE TABLE soc... |
[
{
"role": "user",
"content": "Show me all ERC1155 NFTs that were minted by wallet address '0x9876543210abcdef' on Ethereum, along with their contract address and token ID."
},
{
"role": "assistant",
"content": "SELECT contract_address, token_id FROM nft_metadata WHERE blockchain = 'Ethereum' AND... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "Show me the name of each narrative and its 24-hour price change percentage."
},
{
"role": "assistant",
"content": "SELECT narrative, price_change_percentage_24h FROM narrative_info"
},
{
"role": "user",
"content": "Now, filter the list to only include na... | 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": "Show the total number of notifications sent per user."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(*) AS total_notifications\nFROM trading_platform.notifications\nGROUP BY user_id;"
},
{
"role": "user",
"content": "I only want to see 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 trading_platform.assets (
asset_id character varying(64) NOT NULL, -- unique identifier for the asset
name cha... |
[
{
"role": "user",
"content": "How many appointments are recorded in the system?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM appointments;"
},
{
"role": "user",
"content": "Show the count of appointments for each status."
},
{
"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 government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... |
[
{
"role": "user",
"content": "Which token symbols have the highest number of addresses buying them on the Ethereum chain? Show the top 3 symbols, their total address_amount, and narrative."
},
{
"role": "assistant",
"content": "SELECT token_symbol, narrative, SUM(address_amount) AS total_buying_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the token's address token_symbol character... |
[
{
"role": "user",
"content": "Show the first name, last name, and email of customers who have filed a claim, along with the status and estimated loss of each claim."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T1.email, T2.status, T2.estimated_loss FROM insurance.cu... | You are an SQL statement expert. Given the table 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": "How many comments were created in the month of March 2024?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.comments WHERE created_at >= '2024-03-01' AND created_at < '2024-04-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.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ... |
[
{
"role": "user",
"content": "For each block number, show the highest transaction value and the status of the transaction with the highest value."
},
{
"role": "assistant",
"content": "SELECT t.block_number, t.value AS max_value, t.status\nFROM web3.transactions t\nJOIN (\n SELECT block_number,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id.text, from_address.text, to_address.text, value.numeric, gas_used.integer, gas_price... |
[
{
"role": "user",
"content": "List all distinct pairs of hashtag_id that are applied to the same post_id."
},
{
"role": "assistant",
"content": "SELECT ph1.post_id, ph1.hashtag_id AS hashtag1_id, ph2.hashtag_id AS hashtag2_id\nFROM social_media.post_hashtags ph1\nJOIN social_media.post_hashtags ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.post_hashtags ( post_hashtag_id character varying(64) NOT NULL, post_id character varying(64) NOT NULL, ha... |
[
{
"role": "user",
"content": "Retrieve each in-game item with its game title for items of rarity 'Epic'. Show item_name and title."
},
{
"role": "assistant",
"content": "SELECT i.item_name, g.title\nFROM gaming_technology.in_game_items i\nJOIN gaming_technology.games g ON i.game_id = g.game_id\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE 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 contracts that were deployed on the same network. Show both contract IDs, the network ID, and the deployment timestamps for both contracts."
},
{
"role": "assistant",
"content": "SELECT a.contract_id AS contract_id_1, b.contract_id AS contract_id_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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "List all the appointments that overlap in time for the same location, showing both appointment IDs, their start and end times, and the location."
},
{
"role": "assistant",
"content": "SELECT a1.appointment_id AS appointment_id_1, a2.appointment_id AS appointment_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 legal_services.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ... |
[
{
"role": "user",
"content": "List all drivers who have an email address but no contact number recorded in the system."
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name, email FROM transportation.drivers WHERE email IS NOT NULL AND contact_number 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 transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f... |
[
{
"role": "user",
"content": "Show me all reservations with their guest IDs and room IDs where the total amount is greater than $300, along with the service names and prices of any services ordered for those reservations."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, r.guest_id... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i... |
[
{
"role": "user",
"content": "For properties located in the city 'Los Angeles', list all rooms that are on floor 3. Include the property name and room number."
},
{
"role": "assistant",
"content": "SELECT p.property_name, r.room_number FROM hospitality_technology.properties p JOIN hospitality_te... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "List all pairs of wallets that were created within 10 minutes of each other, showing both wallet IDs, the user_id, and both creation timestamps."
},
{
"role": "assistant",
"content": "SELECT\n w1.wallet_id AS wallet1_id,\n w2.wallet_id AS wallet2_id,\n w1.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 web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "Show me the highest volume traded for each security along with its close_price and timestamp."
},
{
"role": "assistant",
"content": "WITH max_vol AS (\n SELECT security_id, MAX(volume) AS highest_volume\n FROM financial_services.market_data\n GROUP BY security_id... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.market_data ( data_point_id bigint, security_id text, data_timestamp timestamp, open_price numeric, ... |
[
{
"role": "user",
"content": "Show total session duration and average score for each player across all their sessions. Display the player ID, total duration, and average score."
},
{
"role": "assistant",
"content": "SELECT player_id, SUM(duration_seconds) AS total_duration, AVG(score) AS average... | You are an SQL statement expert. Given the table 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": "Get the number of direct reports for each manager, showing manager_id and report_count."
},
{
"role": "assistant",
"content": "SELECT manager_id,\n COUNT(*) AS report_count\nFROM hospitality_technology.staff\nWHERE manager_id IS NOT NULL\nGROUP BY manager_id;"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, fir... |
[
{
"role": "user",
"content": "I need to check the inventory status of components, including their batch details and warehouse location."
},
{
"role": "assistant",
"content": "MATCH (i:InventoryBatch)-[:IS_INSTANCE_OF]->(c:Component)\nRETURN c.component_id, c.component_name, i.inventory_record_id... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
Node Label ':Component'. Properties: { component_id: String (Constraint: UNIQUE), part_number: St... |
[
{
"role": "user",
"content": "Show me all patients who have both primary and non-primary insurance plans from the same provider, including their policy numbers and expiration dates."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, pi1.policy_number AS primary_policy, pi1.... | You are an SQL statement expert. Given the table 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": "List all patients who have been diagnosed with chronic conditions, including their diagnosis descriptions and dates."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, d.diagnosis_description, d.diagnosis_date FROM healthcare.pati... | You are an SQL statement expert. Given the table 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": "Count the total number of blocks mined for each day of the week."
},
{
"role": "assistant",
"content": "SELECT TO_CHAR(timestamp, 'Day') AS day_of_week, COUNT(*) AS block_count FROM blockchain.blocks GROUP BY day_of_week;"
},
{
"role": "user",
"content":... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta... |
[
{
"role": "user",
"content": "For each block_number, compute the maximum and minimum gas_used."
},
{
"role": "assistant",
"content": "SELECT block_number,\n MAX(gas_used) AS max_gas_used,\n MIN(gas_used) AS min_gas_used\nFROM transactions\nGROUP BY block_number;"
},
{
"role":... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price... |
[
{
"role": "user",
"content": "List all SUI coin types, symbols, names, and their status from the `sui_coins_metadata` table where the status is 'exists'."
},
{
"role": "assistant",
"content": "SELECT coin_type, symbol, name, status FROM sui_coins_metadata WHERE status = 'exists';"
},
{
"... | You are an SQL statement expert. Given the table 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": "Retrieve the name and city of all locations that act as both origin and destination for any route."
},
{
"role": "assistant",
"content": "SELECT l.name, l.city\nFROM transportation.locations l\nWHERE l.location_id IN (SELECT origin_location_id FROM transportation.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 transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"role": "user",
"content": "List all tokens together with the deployment status of the contract that created them, showing token_id, token_symbol, and contract status."
},
{
"role": "assistant",
"content": "SELECT t.token_id, t.token_symbol, c.status AS contract_status\nFROM web3.tokens t\nJOI... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "For each account status, what is the total quantity of securities traded?"
},
{
"role": "assistant",
"content": "SELECT T2.status, SUM(T1.quantity) FROM financial_services.trades AS T1 JOIN financial_services.accounts AS T2 ON T1.account_id = T2.account_id GROUP BY ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri... |
[
{
"role": "user",
"content": "For each user, show their username and the timestamp of their most recent notification. Include users who have never received notifications."
},
{
"role": "assistant",
"content": "SELECT T1.username, max(T2.sent_at) FROM users AS T1 LEFT JOIN trading_platform.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 trading_platform.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp... |
[
{
"role": "user",
"content": "List staff members who responded to public reviews with an overall rating of 3 or less. Include the staff member's first name, last name, and the review ID."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T2.review_id FROM staff 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 hospitality_technology.staff ( staff_id text PRIMARY KEY, property_id text, first_name text, last_name text, position t... |
[
{
"role": "user",
"content": "Provide a count of contracts for each unique combination of network ID and status."
},
{
"role": "assistant",
"content": "SELECT network_id, status, COUNT(*) FROM web3.contracts GROUP BY network_id, status;"
},
{
"role": "user",
"content": "Now, only sho... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "Show the usernames and registration dates for all players whose status is 'inactive'."
},
{
"role": "assistant",
"content": "SELECT username, registration_date FROM players WHERE status = 'inactive';"
},
{
"role": "user",
"content": "Refine the list to 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 gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "For citizens who registered before January 1, 2023, show the total number of notifications sent to them for each channel. List the citizen's first name, last name, the channel, and the count of notifications."
},
{
"role": "assistant",
"content": "SELECT\n T1.first... | You are an SQL statement expert. Given the table 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 contract, how many tokens are deployed at the contract address? Show contract_id, address, and token_count."
},
{
"role": "assistant",
"content": "SELECT c.contract_id, c.address, COUNT(t.token_id) AS token_count\nFROM web3.contracts c\nLEFT JOIN web3.token... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "Show me all transactions sent by wallet addresses that have a private key starting with '0x1', along with the receiver address and amount."
},
{
"role": "assistant",
"content": "SELECT t.transaction_id, t.receiver_address, t.amount FROM blockchain.transactions t JOI... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.transactions ( transaction_id text, block_id text, sender_address text, receiver_address text, amount numeri... |
[
{
"role": "user",
"content": "For each customer, list their customer ID and the total number of policies they have purchased. Only include customers who have purchased more than one type of insurance product."
},
{
"role": "assistant",
"content": "SELECT customer_id, COUNT(policy_id) AS total_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.policies (
policy_id character varying(64) NOT NULL, -- unique identifier for the policy
customer_id ... |
[
{
"role": "user",
"content": "List the appointment ID, the scheduled start time, and the name of the service location for all appointments scheduled between '2024-01-01' and '2024-12-31'."
},
{
"role": "assistant",
"content": "SELECT T1.appointment_id, T1.scheduled_start_time, T2.location_name 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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Find the most recent verified document for each application, showing application_id, document_id, and verification_timestamp."
},
{
"role": "assistant",
"content": "SELECT d.document_id, d.application_id, d.verification_timestamp\nFROM government_services.documents ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents ( document_id text PRIMARY KEY, application_id text, citizen_id text, document_type text,... |
[
{
"role": "user",
"content": "Give me the product name and description of all insurance products that have been updated in the last 30 days."
},
{
"role": "assistant",
"content": "SELECT product_name, description FROM insurance.insurance_products WHERE updated_at >= NOW() - 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 insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, product_type text, description text, bas... |
[
{
"role": "user",
"content": "Find the fastest reply for each conversation, showing conversation_id, initial_message_id, reply_message_id, and response_time in seconds."
},
{
"role": "assistant",
"content": "SELECT m1.conversation_id,\n m1.message_id AS initial_message_id,\n m2.messa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.messages (
message_id character varying(64) NOT NULL, -- unique identifier for the message
convers... |
[
{
"role": "user",
"content": "Show prescriptions with their corresponding chief complaint from the medical record. Return prescription_id, record_id, and chief_complaint."
},
{
"role": "assistant",
"content": "SELECT p.prescription_id, p.record_id, mr.chief_complaint\nFROM healthcare.prescriptio... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "List all medical records along with the doctor's first and last name who created them. Show the record ID, record date, doctor ID, and doctor full name."
},
{
"role": "assistant",
"content": "SELECT mr.record_id, mr.record_date, d.doctor_id, d.first_name, d.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 PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "Show me for each user how many conversations they've participated in, include their email and conversation count, only for those who have participated in more than five conversations."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, COUNT(DISTINCT 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 social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "List pairs of distinct patient insurance entries that share the same subscriber_name. Show patient1_id, patient2_id, and subscriber_name."
},
{
"role": "assistant",
"content": "SELECT\n p1.patient_id AS patient1_id,\n p2.patient_id AS patient2_id,\n p1.subscriber... | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "Show recipient_user_id and the number of unread notifications (where read_at is NULL) for each recipient."
},
{
"role": "assistant",
"content": "SELECT recipient_user_id, COUNT(*) AS unread_count\nFROM social_media.notifications\nWHERE read_at IS NULL\nGROUP BY reci... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi... |
[
{
"role": "user",
"content": "List the full name of all guests who have submitted a review."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.first_name, T1.last_name FROM hospitality_technology.guests AS T1 JOIN hospitality_technology.reviews AS T2 ON T1.guest_id = T2.guest_id;"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, la... |
[
{
"role": "user",
"content": "Could you provide the total number of notifications sent on each day?"
},
{
"role": "assistant",
"content": "SELECT DATE(sent_at), COUNT(*) FROM notifications GROUP BY DATE(sent_at) ORDER BY DATE(sent_at);"
},
{
"role": "user",
"content": "Now, show 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 trading_platform.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp... |
[
{
"role": "user",
"content": "List all completed appointments in the last week, showing patient_id, doctor_id and appointment_time."
},
{
"role": "assistant",
"content": "SELECT patient_id, doctor_id, appointment_time FROM healthcare.appointments WHERE status = 'Completed' AND appointment_time >... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the appointment
... |
[
{
"role": "user",
"content": "List the full names of employees who have verified 'Proof of Identity' documents."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.first_name, T1.last_name FROM government_services.employees AS T1 JOIN government_services.documents AS T2 ON T1.employee_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 government_services.documents ( document_id text, application_id text, citizen_id text, document_type text, file_refere... |
[
{
"role": "user",
"content": "Show me all pairs of time entries made by the same lawyer on the same date. Include both entry IDs, lawyer_id, and date_worked."
},
{
"role": "assistant",
"content": "SELECT t1.lawyer_id, t1.date_worked, t1.entry_id AS entry_id_1, t2.entry_id AS entry_id_2\nFROM leg... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries (
entry_id character varying(64) NOT NULL, -- unique identifier for the time entry
... |
[
{
"role": "user",
"content": "Show all medications that share a manufacturer with at least one other medication. Return the medication_id, medication_name, and manufacturer for each."
},
{
"role": "assistant",
"content": "SELECT m.medication_id,\n m.medication_name,\n m.manufacturer\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id text, medication_name text, generic_name text, manufacturer text, ndc_code text,... |
[
{
"role": "user",
"content": "For each property, list the name of the room type and the number of rooms of that type at the property."
},
{
"role": "assistant",
"content": "SELECT T1.property_name, T2.type_name, count(T3.room_id) AS room_count FROM hospitality_technology.properties AS T1 JOIN ho... | You are an SQL statement expert. Given the table 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.