conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Show me all employees (employee_id, first_name, last_name) who work in the 'Investment' department and have processed transactions (transaction_id) in the last month, along with the total transaction amount they processed."
},
{
"role": "assistant",
"content": "SELE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "How many time entries were recorded on each date? List the date and the count of entries for that date, ordered by date."
},
{
"role": "assistant",
"content": "SELECT date_worked, COUNT(*) AS entry_count FROM legal_services.time_entries GROUP BY date_worked ORDER 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 legal_services.time_entries ( entry_id text PRIMARY KEY, case_id text, lawyer_id text, date_worked date, hours_spent nu... |
[
{
"role": "user",
"content": "How many documents of type 'Pleading' were uploaded for case 'case_abc'?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM legal_services.documents WHERE document_type = 'Pleading' AND case_id = 'case_abc';"
}
] | You are an SQL statement expert. Given the table 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": "Summarize the accounts table by account type and currency, showing the average balance for each combination."
},
{
"role": "assistant",
"content": "SELECT account_type, currency, AVG(balance) AS average_balance, COUNT(account_id) AS account_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 character varying(64) NOT NULL, -- unique identifier for the account
c... |
[
{
"role": "user",
"content": "List each wallet with its corresponding user_id and the total number of notifications that user has received."
},
{
"role": "assistant",
"content": "SELECT w.wallet_id, w.user_id, COUNT(n.notification_id) as total_notifications\nFROM trading_platform.wallets w\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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
CREATE ... |
[
{
"role": "user",
"content": "List all NFTs on the 'Ethereum' blockchain with a rarity score above 85. Show their name, contract address, token ID, and rarity score."
},
{
"role": "assistant",
"content": "SELECT name, contract_address, token_id, rarity_score FROM nft_metadata WHERE blockchain = ... | You are an SQL statement expert. Given the table 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 all rooms that are on floor 3."
},
{
"role": "assistant",
"content": "SELECT room_id, property_id, room_number FROM hospitality_technology.rooms WHERE floor = 3;"
},
{
"role": "user",
"content": "For these rooms, include the property name and room n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "List the license plate, make, and current status of all vehicles acquired after January 1, 2021."
},
{
"role": "assistant",
"content": "SELECT license_plate, make, status \nFROM transportation.vehicles\nWHERE acquisition_date > '2021-01-01';"
},
{
"role": "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 transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "List all peer logs, showing the user_id and the action taken, ordered by the most recent log entry."
},
{
"role": "assistant",
"content": "SELECT user_id, action, logged_at\nFROM trading_platform.logs\nORDER BY logged_at DESC;"
}
] | You are an SQL statement expert. Given the table 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": "Find pairs of items within each game that share the same rarity but have different item_types. Show game_id, rarity, item1_name, and item2_name."
},
{
"role": "assistant",
"content": "SELECT i1.game_id, i1.rarity, i1.item_name AS item1_name, i2.item_name AS item2_na... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.in_game_items ( item_id uuid PRIMARY KEY, game_id uuid, item_name text, item_type text, description t... |
[
{
"role": "user",
"content": "List pairs of invoice_number for invoices that share the same due_date."
},
{
"role": "assistant",
"content": "SELECT a.due_date,\n a.invoice_number AS invoice1,\n b.invoice_number AS invoice2\nFROM legal_services.invoices a\nJOIN legal_services.invoices... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices (
invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice
invo... |
[
{
"role": "user",
"content": "Show me all servers, the title of the game they host, and the name of the game's developer."
},
{
"role": "assistant",
"content": "SELECT s.server_name, g.title AS game_title, d.name AS developer_name FROM gaming_technology.servers s JOIN gaming_technology.games g 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(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "Show me all events with the name 'Transfer' that occurred in the last 7 days, including the contract_id and transaction_id."
},
{
"role": "assistant",
"content": "SELECT e.contract_id, e.transaction_id FROM web3.events e WHERE e.event_name = 'Transfer' AND e.emitted... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"role": "user",
"content": "Find all in-game items that have a 'mana_cost' attribute in their attributes JSON. Show the item ID, item name, and the value of the 'mana_cost'."
},
{
"role": "assistant",
"content": "SELECT item_id, item_name, attributes ->> 'mana_cost' AS mana_cost FROM gaming_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 gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea... |
[
{
"role": "user",
"content": "Which posts have been mentioned with at least one hashtag and also have users who joined the conversation corresponding to the post? Please show the post_id and the user_id of participants."
},
{
"role": "assistant",
"content": "SELECT ph.post_id, cp.user_id\nFROM 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.post_hashtags ( post_hashtag_id text, post_id text, hashtag_id text )
CREATE TABLE social_media.conversati... |
[
{
"role": "user",
"content": "List the names and email addresses of guests who have made a reservation in the last 60 days."
},
{
"role": "assistant",
"content": "SELECT DISTINCT g.first_name, g.last_name, g.email\nFROM hospitality_technology.guests g\nJOIN hospitality_technology.reservations 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 hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "I need all pairs of hashtags that start with the same first two letters. Show both tag names."
},
{
"role": "assistant",
"content": "SELECT h1.tag_name AS tag1, h2.tag_name AS tag2\nFROM social_media.hashtags h1\nJOIN social_media.hashtags h2\n ON LEFT(h1.tag_name,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name character varying(100) NOT NULL UNIQUE, cre... |
[
{
"role": "user",
"content": "Retrieve all room types where the base rate exceeds 200, listing the type name and base rate."
},
{
"role": "assistant",
"content": "SELECT type_name, base_rate FROM hospitality_technology.room_types WHERE base_rate > 200"
},
{
"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 hospitality_technology.room_types ( room_type_id text, property_id text, type_name text, description text, base_rate nu... |
[
{
"role": "user",
"content": "For each trip, provide the trip_id, the total fuel quantity refueled, and the number of refueling events that occurred during the trip."
},
{
"role": "assistant",
"content": "SELECT trip_id, SUM(quantity) AS total_fuel_quantity, COUNT(*) AS refuel_event_count\nFROM ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.fuel_logs (
fuel_log_id character varying(64) NOT NULL, -- unique identifier for the fuel log entry... |
[
{
"role": "user",
"content": "List all pairs of beneficiaries on the same policy where one is a 'Parent' and the other is a 'Child'. Return policy_id, parent_id, and child_id."
},
{
"role": "assistant",
"content": "SELECT pb1.policy_id,\n pb1.beneficiary_id AS parent_id,\n pb2.benefi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id character varying(64) NOT NULL, policy_id character varying(64) NOT NUL... |
[
{
"role": "user",
"content": "List all players who have unlocked achievements in the last 7 days, showing their username and the number of achievements unlocked."
},
{
"role": "assistant",
"content": "SELECT p.username, COUNT(pa.achievement_id) AS unlocked_count\nFROM gaming_technology.players 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 gaming_technology.players ( player_id uuid, username text, email text, password_hash text, registration_date timestamp ... |
[
{
"role": "user",
"content": "Show me the usernames of users who have the word 'explorer' in their bio."
},
{
"role": "assistant",
"content": "SELECT username\nFROM social_media.users\nWHERE bio ILIKE '%explorer%';"
}
] | You are an SQL statement expert. Given the table 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": "特定の予約ID 'book_zyx' に関連するすべてのチケットの詳細を取得するのを手伝っていただけますか?また、関連する車両情報も含めてください。"
},
{
"role": "assistant",
"content": "SMEMBERS booking:book_zyx:tickets\nHGETALL ticket:<ticket_id>\nHGETALL car:<car_id>"
},
{
"role": "user",
"content": "チェックイン済みのチケットだけを表示するよう... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// Use Hashes for ticket details. Key format: ticket:<ticket_id>
// HSET ticket:tkt_1a2b ticket_i... |
[
{
"role": "user",
"content": "For each premium payment, list all previous payments made by the same customer. Show customer_id, previous_payment_id, previous_payment_date, current_payment_id, current_payment_date, and amount difference."
},
{
"role": "assistant",
"content": "SELECT p1.customer_i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.premium_payments ( payment_id text, policy_id text, customer_id text, payment_date timestamp, amount_paid num... |
[
{
"role": "user",
"content": "Find smart money addresses that have a positive ROI but their realized profit ratio is less than 50%. List their address, ROI, and realized ratio, ordered by ROI in descending order."
},
{
"role": "assistant",
"content": "SELECT address, roi, realized_ratio FROM sma... | 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, rank INT, profit numer... |
[
{
"role": "user",
"content": "Which servers are currently offline, and how many players could they host if all were full? Please show the server name, region, and max_players."
},
{
"role": "assistant",
"content": "SELECT server_name, region, max_players\nFROM gaming_technology.servers\nWHERE st... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.servers ( server_id.uuid, game_id.uuid, server_name.text, region.text, ip_address.text, port.integer,... |
[
{
"role": "user",
"content": "For each state_province, count the number of guests."
},
{
"role": "assistant",
"content": "SELECT state_province,\n COUNT(*) AS guest_count\nFROM guests\nGROUP BY state_province;"
},
{
"role": "user",
"content": "Only include states with more than... | You are an SQL statement expert. Given the table 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": "How many insurance policies have 'Group' in their group_number?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM healthcare.patient_insurance WHERE group_number ILIKE '%Group%';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patient_insurance ( patient_insurance_id text, patient_id text, plan_id text, policy_number text, group_numb... |
[
{
"role": "user",
"content": "Show me the top 5 NFT collections with the highest floor price on Ethereum, along with their names and symbols, but only include collections with more than 10,000 tokens."
},
{
"role": "assistant",
"content": "SELECT name, symbol, floor_price FROM nft_collections 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 erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "How many applications are currently pending review? Please group the results by assigned_employee_id."
},
{
"role": "assistant",
"content": "SELECT assigned_employee_id, COUNT(*) AS pending_applications FROM government_services.applications WHERE 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.applications ( application_id text, citizen_id text, service_id text, submitted_at timestamp, statu... |
[
{
"role": "user",
"content": "Find all claims with a settlement amount between 5000 and 10000. List the claim ID, incident date, and settlement date."
},
{
"role": "assistant",
"content": "SELECT claim_id, incident_date, settlement_date\nFROM insurance.claims\nWHERE settlement_amount BETWEEN 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 insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara... |
[
{
"role": "user",
"content": "List the full names of guests who have made reservations at properties with a star rating of 5. Include the guest ID and the property name."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T1.guest_id, T3.property_name FROM hospitality_tech... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "List the event_id, event_name, emitted_at, contract_id from the events table, and the token_symbol and token_name for the token associated with that contract address from the tokens table, for all events that have a corresponding token."
},
{
"role": "assistant",
"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 web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "Show all comments that are replies, including the comment_id, parent_comment_id, and post_id."
},
{
"role": "assistant",
"content": "SELECT comment_id, parent_comment_id, post_id FROM social_media.comments WHERE parent_comment_id IS NOT 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 social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ... |
[
{
"role": "user",
"content": "List all token symbols and their total supply for tokens where the total supply is greater than the average total supply of all tokens."
},
{
"role": "assistant",
"content": "SELECT token_symbol, total_supply FROM web3.tokens WHERE total_supply > (SELECT AVG(total_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 web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"role": "user",
"content": "Find guests who have made at least one payment using a 'CreditCard'. List their full name (first and last name) and email address."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.first_name, T1.last_name, T1.email FROM hospitality_technology.guests AS T1 J... | You are an SQL statement expert. Given the table 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, -- unique identifier for the guest profil... |
[
{
"role": "user",
"content": "Show me all customers (customer_id, first_name, last_name) who live in California (state = 'CA') and were born after 1990, along with their email addresses and risk profiles."
},
{
"role": "assistant",
"content": "SELECT customer_id, first_name, last_name, email, ri... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"role": "user",
"content": "Show me the total transaction amount sent by each sender address in the last 7 days, along with their current balance from the addresses table."
},
{
"role": "assistant",
"content": "SELECT t.sender_address, SUM(t.amount) AS total_sent, a.balance FROM blockchain.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 blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta... |
[
{
"role": "user",
"content": "List all male patients who don't have an email address but have an emergency contact, showing their full names and emergency contact details."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, emergency_contact_name, emergency_contact_phone FROM he... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "List all smart money addresses that made over $500,000 profit in the last month, including their chain and last trade time."
},
{
"role": "assistant",
"content": "SELECT address, chain, last_trade_time FROM smart_money_profit WHERE profit > 500000 ORDER BY profit 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 smart_money_profit ( address character varying(100) NOT NULL, -- the user's address rank INT, -- the rank of the addres... |
[
{
"role": "user",
"content": "For each passenger, list their email along with the total amount spent on fares across all their bookings."
},
{
"role": "assistant",
"content": "SELECT p.passenger_id, p.email, SUM(b.fare) AS total_fare_spent\nFROM transportation.passengers p\nJOIN transportation.b... | You are an SQL statement expert. Given the table 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.passengers (
passenger_id character varying(64) NOT NULL, -- unique identifier for the passenger
... |
[
{
"role": "user",
"content": "Show me all contracts deployed on the 'ethereum' network along with their deployer wallet addresses and creation dates, sorted by the most recent deployments first."
},
{
"role": "assistant",
"content": "SELECT c.contract_id, c.address, c.deployer_address, w.address... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,... |
[
{
"role": "user",
"content": "Find law firms where the managing partner is also listed as a lawyer within that firm. Show the firm name and the managing partner's first and last name."
},
{
"role": "assistant",
"content": "SELECT T1.firm_name, T2.first_name, T2.last_name FROM law_firms AS T1 JOI... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t... |
[
{
"role": "user",
"content": "Show me the total deposit and withdrawal amounts for each account in February 2024."
},
{
"role": "assistant",
"content": "SELECT account_id, SUM(CASE WHEN transaction_type = 'Deposit' THEN amount ELSE 0 END) AS total_deposit, SUM(CASE WHEN transaction_type = 'Withd... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"role": "user",
"content": "Find the total number of likes made on posts versus comments. Show two columns: like_type (either 'post' or 'comment') and like_count."
},
{
"role": "assistant",
"content": "SELECT CASE WHEN post_id IS NOT NULL THEN 'post' ELSE 'comment' END AS like_type, COUNT(*) 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 social_media.likes ( like_id text PRIMARY KEY, user_id text, post_id text, comment_id text, created_at timestamp )
|
[
{
"role": "user",
"content": "Find all smart contract IDs and the block IDs that were mined within 5 minutes before or after the contract deployment timestamp."
},
{
"role": "assistant",
"content": "SELECT T1.contract_id, T2.block_id FROM blockchain.smart_contracts AS T1 JOIN blockchain.blocks 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 blockchain.blocks (
block_id character varying(64) NOT NULL, -- unique identifier for the block
previous_block... |
[
{
"role": "user",
"content": "What is the total revenue generated for each department from delivered service orders? Return department and total_revenue."
},
{
"role": "assistant",
"content": "SELECT s.department,\n SUM(so.total_price) AS total_revenue\nFROM hospitality_technology.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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"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": "Show me all addresses that have created smart contracts, along with their balance and the count of contracts they've created."
},
{
"role": "assistant",
"content": "SELECT a.address_id, a.balance, COUNT(sc.contract_id) AS contract_count FROM blockchain.addresses a J... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text... |
[
{
"role": "user",
"content": "I need a list of upcoming appointments within the next 7 days for patients whose primary insurance is expiring in the next 30 days. Show the patient's full name, appointment_time, insurance plan_name, and expiration_date."
},
{
"role": "assistant",
"content": "SELEC... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "List all medical record entries where the treatment_plan mentions a medication name. Return patient_id, record_id, and the matching medication_name."
},
{
"role": "assistant",
"content": "SELECT mr.patient_id,\n mr.record_id,\n m.medication_name\nFROM he... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "List all claims with police reports that were filed in the last 3 months, showing the claim ID, policy ID, and estimated loss amount."
},
{
"role": "assistant",
"content": "SELECT claim_id, policy_id, estimated_loss FROM insurance.claims WHERE police_report_number I... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ... |
[
{
"role": "user",
"content": "Show me the content of all comments that have received at least one like."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.content FROM social_media.comments AS T1 JOIN social_media.likes AS T2 ON T1.comment_id = T2.comment_id;"
},
{
"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 social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "For each narrative in token_basic_info, calculate the total net_flow and average ROI from smart_money_token_performance. List narrative, total_net_flow, avg_roi, ordered by total_net_flow descending."
},
{
"role": "assistant",
"content": "SELECT tbi.narrative,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id text, project_id text, project_name text, rounds_name text, investment_value numeric, i... |
[
{
"role": "user",
"content": "Find overlapping appointments for each doctor. Return doctor_id, appointment_id_1, appointment_id_2, and overlap duration in minutes."
},
{
"role": "assistant",
"content": "SELECT a.doctor_id,\n a.appointment_id AS appointment_id_1,\n b.appointment_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 healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi... |
[
{
"role": "user",
"content": "List all cryptocurrency assets that have been traded more than 50 times but have never been traded in quantities greater than 100."
},
{
"role": "assistant",
"content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) AS trade_count FROM trading_platform.asse... | You are an SQL statement expert. Given the table 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 appointments scheduled for the service named 'Passport Renewal', showing the appointment ID, citizen ID, and scheduled start time."
},
{
"role": "assistant",
"content": "SELECT T1.appointment_id, T1.citizen_id, T1.scheduled_start_time FROM government_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 government_services.appointments ( appointment_id text, citizen_id text, employee_id text, location_id text, service_id... |
[
{
"role": "user",
"content": "Show me the top 5 tokens by PnL on the Ethereum chain, along with their token symbol and ROI."
},
{
"role": "assistant",
"content": "SELECT token_symbol, pnl, roi FROM smart_money_token_performance WHERE chain = 'Ethereum' ORDER BY pnl DESC LIMIT 5;"
},
{
"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 smart_money_token_performance ( token_address character varying(100) NOT NULL, -- the token's address token_symbol char... |
[
{
"role": "user",
"content": "Show me, for each game, the player who achieved the highest total score, along with that total score."
},
{
"role": "assistant",
"content": "SELECT game_id, player_id, SUM(score) AS total_score\nFROM gaming_technology.game_sessions\nGROUP BY game_id, player_id\nQUAL... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time... |
[
{
"role": "user",
"content": "Show the usernames of users who have liked a comment made by a user they are following."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.username FROM social_media.users AS T1 JOIN likes AS T2 ON T1.user_id = T2.user_id JOIN comments AS T3 ON T2.target_enti... | You are an SQL statement expert. Given the table 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": "Show me all appointments with status 'Completed' where the associated medical records have a treatment plan containing 'antibiotics', including the appointment details and the record date."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, a.patient_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.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi... |
[
{
"role": "user",
"content": "List all users who have made comments that are replies to other comments. Show their user IDs, the comment ID, and the parent comment ID."
},
{
"role": "assistant",
"content": "SELECT user_id, comment_id, parent_comment_id\nFROM social_media.comments\nWHERE parent_c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "List the username and email for all users whose email address ends with '@example.com'."
},
{
"role": "assistant",
"content": "SELECT username, email FROM blockchain.users WHERE email LIKE '%@example.com';"
},
{
"role": "user",
"content": "Now, filter 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 blockchain.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email character va... |
[
{
"role": "user",
"content": "Show me all intercity routes with their origin and destination cities, along with the average passenger count for completed trips on these routes."
},
{
"role": "assistant",
"content": "SELECT r.route_id, lo.city AS origin_city, ld.city AS destination_city, AVG(t.pa... | You are an SQL statement expert. Given the table 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": "Which customers have made more than three premium payments in 2024? Show the customer_id and the number of payments."
},
{
"role": "assistant",
"content": "SELECT customer_id, COUNT(*) AS payment_count FROM insurance.premium_payments WHERE payment_date >= '2024-01-0... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_id text, payment_date timestamp, amo... |
[
{
"role": "user",
"content": "Show me the first name, last name, and position of all staff members, along with the name of the property they work at."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T1.position, T2.property_name FROM hospitality_technology.staff AS T1 J... | You are an SQL statement expert. Given the table 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": "Show all active staff members' full names and their positions."
},
{
"role": "assistant",
"content": "SELECT staff_id, first_name || ' ' || last_name AS staff_full_name, position\nFROM hospitality_technology.staff\nWHERE is_active = true;"
},
{
"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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"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": "Show me the highest and lowest close price for each security in the 'Healthcare' sector, along with the security name."
},
{
"role": "assistant",
"content": "SELECT s.security_name, MAX(md.close_price) AS highest_close, MIN(md.close_price) AS lowest_close\nFROM fina... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities (
security_id character varying(64) NOT NULL, -- unique identifier for the security
... |
[
{
"role": "user",
"content": "List each loan with its loan_id, principal_amount, interest_rate, origination_date, and show the ticker_symbol and security_name of any collateral, matching on collateral_description = ticker_symbol from the securities table."
},
{
"role": "assistant",
"content": "S... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri... |
[
{
"role": "user",
"content": "Show the full name and contact email of citizens who have submitted at least one application for services that are currently inactive."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.first_name || ' ' || c.last_name AS full_name, c.contact_email\nFROM gover... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth... |
[
{
"role": "user",
"content": "Show me all in-progress trips with their current locations (origin_location_id) and destinations, along with the scheduled vs actual departure time difference in minutes."
},
{
"role": "assistant",
"content": "SELECT trip_id, origin_location_id, destination_location... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips (
trip_id character varying(64) NOT NULL, -- unique identifier for a specific trip instance
... |
[
{
"role": "user",
"content": "List all NFT collections where the floor price is greater than 0.5 ETH, including their names and contract addresses."
},
{
"role": "assistant",
"content": "SELECT name, contract_address FROM nft_collections WHERE CAST(floor_price AS decimal) > 0.5 AND floor_price_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 token_metas (
block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded
... |
[
{
"role": "user",
"content": "Show a list of all fuel refueling events for each trip, including the trip ID, fuel type, quantity, total cost, and the name of the refueling location."
},
{
"role": "assistant",
"content": "SELECT fl.trip_id, fl.fuel_type, fl.quantity, fl.total_cost, l.name AS loca... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text... |
[
{
"role": "user",
"content": "Show me all police report documents uploaded in the last month, along with their claim IDs and file sizes in MB."
},
{
"role": "assistant",
"content": "SELECT claim_id, document_id, file_size_bytes/1024/1024 AS file_size_mb FROM insurance.claim_documents WHERE docum... | You are an SQL statement expert. Given the table 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.claim_documents ( document_id text, claim_id text, document_type text, file_name text, file_path text, file_s... |
[
{
"role": "user",
"content": "Provide a count of transactions grouped by their status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) FROM web3.transactions GROUP BY status;"
},
{
"role": "user",
"content": "Now, only show the statuses that have more than 50 transacti... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id character varying(64) NOT NULL, from_address character varying(128) NOT NULL, to_add... |
[
{
"role": "user",
"content": "I need a summary of the number of cases by case_type. Please show the case_type and how many cases exist for each."
},
{
"role": "assistant",
"content": "SELECT case_type, COUNT(*) AS case_count FROM legal_services.cases GROUP BY case_type;"
},
{
"role": "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 legal_services.cases ( case_id character varying(64) NOT NULL, case_number character varying(100) UNIQUE, case_name tex... |
[
{
"role": "user",
"content": "List all users along with their associated wallet addresses."
},
{
"role": "assistant",
"content": "SELECT u.username, w.address FROM trading_platform.users u JOIN trading_platform.wallets w ON u.user_id = w.user_id;"
},
{
"role": "user",
"content": "Now... | 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 trading_platform.users ( user_id character varying(64) NOT NULL, username character ... |
[
{
"role": "user",
"content": "For each driver, find the other driver whose license_expiry_date is the next one after theirs. Show both IDs, names and their expiry dates."
},
{
"role": "assistant",
"content": "SELECT\n d1.driver_id AS driver_id,\n d1.first_name || ' ' || d1.last_name... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens... |
[
{
"role": "user",
"content": "For each booking, show the booking_id, seat_number, fare, and the city of the origin location for the trip that was booked."
},
{
"role": "assistant",
"content": "SELECT b.booking_id, b.seat_number, b.fare, orig.city AS origin_city\nFROM transportation.bookings b\nJ... | You are an SQL statement expert. Given the table 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": "Find transactions where the from_address is the same as the to_address (self-transactions) with values greater than 1 ETH (1e18 wei), showing transaction_id and value."
},
{
"role": "assistant",
"content": "SELECT transaction_id, value FROM web3.transactions WHERE 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 web3.transactions ( transaction_id text PRIMARY KEY, from_address text, to_address text, value numeric, gas_used int, g... |
[
{
"role": "user",
"content": "Provide a summary showing, for each vehicle type, the total number of fueling events and the combined total fuel quantity refueled."
},
{
"role": "assistant",
"content": "SELECT v.type AS vehicle_type, COUNT(f.fuel_log_id) AS total_fueling_events, SUM(f.quantity) 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 character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "For each property in the 'USA' country, list the property name and the total count of services that cost more than 50."
},
{
"role": "assistant",
"content": "SELECT T1.property_name, COUNT(T2.service_id) FROM hospitality_technology.properties AS T1 JOIN hospitality_... | You are an SQL statement expert. Given the table 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 average transaction amount per block, along with the block_id and the count of transactions in each block."
},
{
"role": "assistant",
"content": "SELECT block_id, AVG(amount) AS avg_amount, COUNT(*) AS transaction_count FROM blockchain.transactions GROUP... | You are an SQL statement expert. Given the table 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": "List all service orders with service name, guest's full name, order timestamp and status for orders with status 'Delivered'."
},
{
"role": "assistant",
"content": "SELECT so.order_id, s.service_name, g.first_name || ' ' || g.last_name AS guest_full_name, so.order_ti... | You are an SQL statement expert. Given the table 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": "What are the latest prices for tokens with symbol 'USDT'?"
},
{
"role": "assistant",
"content": "SELECT * FROM token_prices_latest WHERE symbol = 'USDT';"
},
{
"role": "user",
"content": "Now show me the historical prices for 'USDT' from the last 7 days.... | 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": "Show me all employees (employee_id, first_name, last_name) in the 'Wealth Management' department who have processed trades for securities with a currency of 'EUR', along with the count of such trades for each employee."
},
{
"role": "assistant",
"content": "SELECT e... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
... |
[
{
"role": "user",
"content": "Show me the total amount processed by each payment method, grouped by currency code."
},
{
"role": "assistant",
"content": "SELECT payment_method, currency_code, SUM(amount) as total_amount FROM hospitality_technology.payments GROUP BY payment_method, currency_code ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.payments ( payment_id text, reservation_id text, guest_id text, bill_id text, amount numeric, cu... |
[
{
"role": "user",
"content": "I want to see a list of insurance plans along with the full names of all doctors whose hospital affiliation ID matches the plan ID. For each entry, include the plan name, insurance provider, doctor ID, and the doctor's first and last name."
},
{
"role": "assistant",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "Show me all PDF documents uploaded in the last 3 months, along with their claim IDs and uploaders."
},
{
"role": "assistant",
"content": "SELECT document_id, claim_id, uploaded_by, uploaded_at FROM insurance.claim_documents WHERE mime_type = 'application/pdf' AND up... | You are an SQL statement expert. Given the table 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.claim_documents ( document_id.text, claim_id.text, document_type.text, file_name.text, file_path.text, file_s... |
[
{
"role": "user",
"content": "List all securities (security_id, ticker_symbol, security_name) that are traded on the 'NASDAQ' exchange and belong to the 'Technology' sector."
},
{
"role": "assistant",
"content": "SELECT security_id, ticker_symbol, security_name FROM financial_services.securities... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu... |
[
{
"role": "user",
"content": "List all guests from California who are loyalty members and have provided their email addresses, ordered by last name."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email, loyalty_member_id FROM hospitality_technology.guests WHERE state_provin... | You are an SQL statement expert. Given the table 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": "Give me the max supply, creator, and current supply for all Avalanche tokens by their tick."
},
{
"role": "assistant",
"content": "SELECT tia.tick, tia.max_supply, tia.creator, tb.total_supply\nFROM token_info_avalanche tia\nLEFT JOIN token_balances tb ON tia.tick =... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "Show me all users who have liked both a comment and a post, including their user IDs."
},
{
"role": "assistant",
"content": "SELECT DISTINCT l1.user_id\nFROM social_media.likes l1\nJOIN social_media.likes l2 ON l1.user_id = l2.user_id\nWHERE l1.post_id IS NOT NULL 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 social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "List all hashtags and for each, show how many different users have created posts using that hashtag."
},
{
"role": "assistant",
"content": "SELECT ph.hashtag_id, COUNT(DISTINCT p.user_id) AS unique_user_count\nFROM social_media.post_hashtags ph\nJOIN social_media.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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "List all patients who have primary insurance plans from providers with 'Blue' in their name, showing their policy numbers and expiration dates."
},
{
"role": "assistant",
"content": "SELECT pi.patient_id, pi.policy_number, pi.expiration_date FROM healthcare.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.appointments ( appointment_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, doc... |
[
{
"role": "user",
"content": "Count the number of transactions for each block that was created in 2023 and has a difficulty greater than 1000. Show the block ID and the transaction count."
},
{
"role": "assistant",
"content": "SELECT B.block_id, COUNT(T.transaction_id) AS transaction_count FROM ... | 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 blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id chara... |
[
{
"role": "user",
"content": "Provide a summary that shows, for each property, the total number of distinct amenities listed across all its room types."
},
{
"role": "assistant",
"content": "SELECT property_id, COUNT(DISTINCT TRIM(UNNEST(string_to_array(amenities, ',')))) AS total_amenities FROM... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text, type_name text, description text, ... |
[
{
"role": "user",
"content": "Show me the top 3 tokens by trend rank in the 'NFT' narrative, along with their price and 24-hour trading volume."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, price, total_volume FROM token_basic_info WHERE narrative = 'NFT' ORDER BY trend... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character varying(100) NOT NULL, token_symbol ch... |
[
{
"role": "user",
"content": "List the vehicle_id, make, model, and total maintenance cost for each vehicle that has undergone maintenance, ordering by total maintenance cost descending."
},
{
"role": "assistant",
"content": "SELECT m.vehicle_id, v.make, v.model, SUM(m.cost) AS total_maintenance... | You are an SQL statement expert. Given the table 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.