conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"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": "For each event recorded, list its ID, name, and the status and value of the transaction in which it occurred."
},
{
"role": "assistant",
"content": "SELECT E.event_id, E.event_name, E.transaction_id, T.status, T.value FROM web3.events AS E JOIN web3.transactions 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 web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "Show me all vehicles that had maintenance in the past month, including their make, model, maintenance service_date, and depot name."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id,\n v.make,\n v.model,\n m.service_date,\n l.name 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, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"role": "user",
"content": "Find pairs of products that share the same product_type but have different is_active statuses. Return the product_type, active product_id, active product_name, inactive product_id, and inactive product_name."
},
{
"role": "assistant",
"content": "SELECT a.product_ty... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"role": "user",
"content": "List pairs of games that share the same publisher but belong to different genres, showing both titles and genres."
},
{
"role": "assistant",
"content": "SELECT g1.game_id AS game1_id,\n g1.title AS title1,\n g1.genre AS genre1,\n g2.game_id AS game... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games (
game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game
ti... |
[
{
"role": "user",
"content": "For each patient, show the total number of diagnoses they have received, along with their patient ID and the ID of their latest diagnosis. Join with the diagnoses table."
},
{
"role": "assistant",
"content": "SELECT patient_id, COUNT(diagnosis_id) AS diagnosis_count... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi... |
[
{
"role": "user",
"content": "Show all token transfers including the token symbol and the address of the contract that created each token. List the transfer id, token id, value, transaction id, the contract address, and the token symbol."
},
{
"role": "assistant",
"content": "SELECT tt.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.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"role": "user",
"content": "List all CEX addresses on the BSC chain that hold more than $1 million USD value in total."
},
{
"role": "assistant",
"content": "SELECT address, SUM(usd_value) AS total_usd_value FROM cex_token_balance WHERE chain = 'BSC' GROUP BY address HAVING SUM(usd_value) > 10... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE cex_token_balance (",
"snapshot_time character varying(32) NOT NULL, -- the snapshot time of record, converted ... |
[
{
"role": "user",
"content": "Find all primary insurance plans that became effective in the last 30 days, showing the patient IDs, policy numbers, and subscriber names, ordered by effective date."
},
{
"role": "assistant",
"content": "SELECT patient_id, policy_number, subscriber_name, effective_... | You are an SQL statement expert. Given the table 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, -- unique identifier for this p... |
[
{
"role": "user",
"content": "Show me all comments that have non-empty content, including their ID, post ID, user ID, and content."
},
{
"role": "assistant",
"content": "SELECT comment_id, post_id, user_id, content FROM social_media.comments WHERE content IS NOT NULL AND 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 social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ... |
[
{
"role": "user",
"content": "Provide for each security its ticker_symbol, the most recent close_price and corresponding timestamp."
},
{
"role": "assistant",
"content": "SELECT s.ticker_symbol, md.close_price, md.data_timestamp\nFROM financial_services.market_data md\nJOIN financial_services.se... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.market_data ( data_point_id bigserial NOT NULL, security_id character varying(64) NOT NULL, data_tim... |
[
{
"role": "user",
"content": "Show me all nodes that were last seen in the last 7 days, along with their IP addresses and ports."
},
{
"role": "assistant",
"content": "SELECT node_id, ip_address, port, last_seen FROM blockchain.nodes WHERE last_seen >= CURRENT_DATE - INTERVAL '7 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 blockchain.nodes ( node_id text, ip_address text, port integer, last_seen timestamp )
CREATE TABLE blockchain.users (
... |
[
{
"role": "user",
"content": "List all unspent UTXOs, including their utxo_id, address, amount, and transaction_id."
},
{
"role": "assistant",
"content": "SELECT utxo_id, address, amount, transaction_id \nFROM trading_platform.utxos \nWHERE spent = false;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.trades ( trade_id text, order_id text, buyer_id text, seller_id text, asset_id text, quantity numeric,... |
[
{
"role": "user",
"content": "List the record ID, record date, and chief complaint for all medical records created by doctor 'doc_321' for patient 'pat_007'."
},
{
"role": "assistant",
"content": "SELECT record_id, record_date, chief_complaint\nFROM healthcare.medical_records\nWHERE doctor_id = ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "Calculate the total quantity traded for each day in the dataset."
},
{
"role": "assistant",
"content": "SELECT DATE_TRUNC('day', traded_at) AS trade_day, SUM(quantity) AS total_daily_quantity FROM trading_platform.trades GROUP BY DATE_TRUNC('day', traded_at) ORDER 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 trading_platform.trades ( trade_id character varying(64) NOT NULL, order_id character varying(64) NOT NULL, buyer_id ch... |
[
{
"role": "user",
"content": "List all customers who reside in New York and were created in the system before 2023."
},
{
"role": "assistant",
"content": "SELECT customer_id, first_name, last_name, created_at FROM insurance.customers WHERE state = 'NY' AND created_at < '2023-01-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "List all guests who have provided a phone number, showing their guest ID and phone number."
},
{
"role": "assistant",
"content": "SELECT guest_id, phone_number FROM hospitality_technology.guests WHERE phone_number IS NOT NULL AND phone_number <> '';"
},
{
"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.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"role": "user",
"content": "List the product_name and description for all active products."
},
{
"role": "assistant",
"content": "SELECT product_name, description FROM insurance.insurance_products WHERE is_active = true;"
},
{
"role": "user",
"content": "Can you also include the pr... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, product_name character varying(150) NOT NULL,... |
[
{
"role": "user",
"content": "How many group chats have been created since January 1, 2024?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS group_chat_count\nFROM social_media.conversations\nWHERE is_group_chat = TRUE\n AND created_at >= '2024-01-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id text, user_id text, content text, media_url text, media_type text, created_at timestamp, u... |
[
{
"role": "user",
"content": "List all law firms founded in the year 2015. Show their names, phone numbers, and website."
},
{
"role": "assistant",
"content": "SELECT firm_name, phone, website\nFROM legal_services.law_firms\nWHERE EXTRACT(YEAR FROM founded_date) = 2015;"
}
] | You are an SQL statement expert. Given the table 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.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address t... |
[
{
"role": "user",
"content": "List all guests who have not provided their date of birth, along with their email if available."
},
{
"role": "assistant",
"content": "SELECT guest_id, first_name, last_name, email FROM hospitality_technology.guests WHERE date_of_birth IS NULL;"
},
{
"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 hospitality_technology.guests ( guest_id.text, first_name.text, last_name.text, email.text, phone_number.text, date_of_... |
[
{
"role": "user",
"content": "Show me the top 5 users by the total amount of unspent UTXOs they have in their wallets, along with their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT w.user_id, w.address, SUM(u.amount) AS total_unspent_amount FROM trading_platform.wallets w 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 trading_platform.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address ch... |
[
{
"role": "user",
"content": "Show me the top 5 smart money addresses by profit on the Ethereum chain, along with their most profitable token and ROI."
},
{
"role": "assistant",
"content": "SELECT address, most_profit_token, roi FROM smart_money_profit WHERE chain = 'Ethereum' 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, rank INT, profit numeric(38,6), roi numeric(38,2), realiz... |
[
{
"role": "user",
"content": "Which available services in the 'Wellness' category are offered by each property? Please show property_id, service_name, and price."
},
{
"role": "assistant",
"content": "SELECT property_id, service_name, price FROM hospitality_technology.services WHERE category = '... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.services ( service_id text PRIMARY KEY, property_id text, service_name text, description text, c... |
[
{
"role": "user",
"content": "Get the five most recent public posts that have media_type = 'video', showing post_id, created_at, and the author's username."
},
{
"role": "assistant",
"content": "SELECT\n p.post_id,\n p.created_at,\n u.username\nFROM social_media.posts p\nJOIN social_media.use... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t... |
[
{
"role": "user",
"content": "For each developer, show their name and the total number of in-game items in all games they've developed."
},
{
"role": "assistant",
"content": "SELECT d.name AS developer_name,\n COUNT(i.item_id) AS total_items\nFROM gaming_technology.developers d\nJOIN gamin... | You are an SQL statement expert. Given the table 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 doctors who were created in the year 2022. Show their doctor ID, first name, and last name."
},
{
"role": "assistant",
"content": "SELECT doctor_id, first_name, last_name FROM healthcare.doctors WHERE EXTRACT(YEAR FROM created_at) = 2022"
},
{
"role... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "List all players who have unlocked achievements related to items of rarity 'Epic'. Show the player_id, achievement_id, and the item_name associated with the achievement."
},
{
"role": "assistant",
"content": "SELECT pa.player_id, pa.achievement_id, igi.item_name\nFR... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "Show the product name, type, and creation date for products created before January 1st, 2023."
},
{
"role": "assistant",
"content": "SELECT product_name, product_type, created_at FROM insurance.insurance_products WHERE created_at < '2023-01-01';"
},
{
"role"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id text, product_name text, product_type text, description text, base_premium nu... |
[
{
"role": "user",
"content": "Show me all trips where the actual arrival was delayed by more than 30 minutes compared to the scheduled arrival, including the trip ID, driver's full name, scheduled arrival, and actual arrival."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, d.first_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": "Which projects had fundraising rounds named 'Series A' in 2022, and what are their token symbols and current token prices from DEX pools?"
},
{
"role": "assistant",
"content": "SELECT p.project_name, p.rounds_name, d.token_symbol, d.price\nFROM project_fundraising_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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "Show me the top 3 tokens by USD value inflow where smart money was buying (type = 1), along with their token symbol and narrative from the smart_money_token_inflow table."
},
{
"role": "assistant",
"content": "SELECT token_symbol, narrative, usd_value FROM smart_mon... | You are an SQL statement expert. Given the table 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": "What are the top 5 tokens by net_flow in smart_money_token_performance along with their chain and ROI?"
},
{
"role": "assistant",
"content": "SELECT token_symbol, chain, net_flow, roi FROM smart_money_token_performance ORDER BY net_flow DESC LIMIT 5;"
},
{
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "Find all wallets that hold at least one NFT and also hold ERC-20 tokens."
},
{
"role": "assistant",
"content": "SELECT DISTINCT nh.wallet_address\nFROM nft_holders nh\nJOIN erc20_balances eb\n ON nh.wallet_address = eb.wallet_address;"
},
{
"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 erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, amount.text, pk.text )
CREATE TABLE n... |
[
{
"role": "user",
"content": "Show me all claims filed in the last 6 months with their associated policy details and customer information."
},
{
"role": "assistant",
"content": "SELECT cl.claim_id, cl.incident_date, cl.status, cl.settlement_amount, p.policy_number, p.product_id, p.coverage_limit... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "For each chain, find the narrative category that has the highest total market_cap and display the chain, narrative, and that total market_cap."
},
{
"role": "assistant",
"content": "SELECT chain,\n narrative,\n total_cap\nFROM (\n SELECT chain,\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 token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri... |
[
{
"role": "user",
"content": "Show me all bookings with the passenger's full name and the booking status."
},
{
"role": "assistant",
"content": "SELECT b.booking_id, p.first_name || ' ' || p.last_name AS passenger_full_name, b.status\nFROM transportation.bookings b\nJOIN transportation.passenger... | You are an SQL statement expert. Given the table 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 a list of appointments, including their subject and start time, along with the case number for the related case."
},
{
"role": "assistant",
"content": "SELECT T1.subject, T1.start_time, T2.case_number FROM appointments AS T1 JOIN cases AS T2 ON T1.case_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.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Show me all properties in California with a star rating above 4.0, along with the count of active staff members at each property."
},
{
"role": "assistant",
"content": "SELECT p.property_id, p.property_name, p.star_rating, COUNT(s.staff_id) AS active_staff_count FRO... | You are an SQL statement expert. Given the table 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": "List application IDs that have both documents and payments associated with them."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.application_id FROM documents AS T1 JOIN payments AS T2 ON T1.application_id = T2.application_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 government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz... |
[
{
"role": "user",
"content": "Provide a count of documents grouped by their current verification status."
},
{
"role": "assistant",
"content": "SELECT verification_status, COUNT(*) FROM government_services.documents GROUP BY verification_status"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.applications ( application_id character varying(64) NOT NULL, citizen_id character varying(64) NOT ... |
[
{
"role": "user",
"content": "List all posts that contain the word 'festival' in their content, showing the post_id, the author's username, and the post creation time."
},
{
"role": "assistant",
"content": "SELECT p.post_id, u.username, p.created_at\nFROM social_media.posts p\nJOIN social_media.... | You are an SQL statement expert. Given the table 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 the product ID, name, and creation date for all insurance products created in 2024."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name, created_at\nFROM insurance.insurance_products\nWHERE created_at >= '2024-01-01' AND created_at < '2025-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 insurance.insurance_products (
product_id character varying(64) NOT NULL, -- unique identifier for the insurance pr... |
[
{
"role": "user",
"content": "I want to retrieve all agents along with the number of active policies they've sold and the average premium amount of those active policies. Please include agent_id, first_name, last_name, policy_count, avg_premium. Sort the results by policy_count in descending order."
},
... | You are an SQL statement expert. Given the table 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": "Find all smart contracts where the code length is greater than 1000 characters."
},
{
"role": "assistant",
"content": "SELECT * FROM blockchain.smart_contracts WHERE LENGTH(code) > 1000;"
},
{
"role": "user",
"content": "Now group these by creator_addres... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.smart_contracts ( contract_id.text, creator_address.text, code.text, timestamp.timestamp )
|
[
{
"role": "user",
"content": "What is the performance review score for employee with ID 'EMP456' for the last quarter?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't assist with information about performance review scores as this data is not included in the employees table."
}
] | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.employees ( ... |
[
{
"role": "user",
"content": "For each service location, find its nearest accessible location by geographic distance."
},
{
"role": "assistant",
"content": "SELECT sl.location_id,\n sl.location_name,\n nearest.location_id AS nearest_location_id,\n nearest.location_name AS nea... | You are an SQL statement expert. Given the table 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.service_locations ( location_id.text, agency_id.text, location_name.text, address.text, city.text, ... |
[
{
"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": "List all orders that are currently pending and were created more than 24 hours ago."
},
{
"role": "assistant",
"content": "SELECT * FROM trading_platform.orders WHERE status = 'pending' AND created_at < CURRENT_TIMESTAMP - INTERVAL '24 hours';"
},
{
"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 trading_platform.orders ( order_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, wallet_id ch... |
[
{
"role": "user",
"content": "Show me the usernames and email addresses of users who commented on any post tagged with the hashtag 'H777'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, u.email\nFROM social_media.comments c\nJOIN social_media.users u ON c.user_id = u.user_id\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "List all users who have pending orders for cryptocurrency assets, along with the asset_id and order quantity."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, o.asset_id, o.quantity FROM trading_platform.users u JOIN trading_platform.orders o ON u.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 trading_platform.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "List the top 5 oldest verified citizens. Show each citizen's full name and date of birth."
},
{
"role": "assistant",
"content": "SELECT\n first_name || ' ' || last_name AS full_name,\n date_of_birth\nFROM government_services.citizens\nWHERE is_verified = TRUE\nORD... | You are an SQL statement expert. Given the table 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": "List all pairs of employees who work in the same department but at different branches. For each pair, show the employee_id and branch_id for both members."
},
{
"role": "assistant",
"content": "SELECT a.employee_id AS employee_id_a, a.branch_id AS branch_id_a, b.emp... | You are an SQL statement expert. Given the table 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 the usernames of players who own at least one item from the game with title 'Game Title X'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.username FROM players AS T1 INNER JOIN player_inventory AS T2 ON T1.player_id = T2.player_id INNER JOIN items 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 gaming_technology.player_inventory ( inventory_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, ite... |
[
{
"role": "user",
"content": "Show each contract address and the count of successful transactions sent to that contract."
},
{
"role": "assistant",
"content": "SELECT c.address, COUNT(t.transaction_id) AS success_tx_count FROM web3.contracts c JOIN web3.transactions t ON t.to_address = c.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 character varying(64) NOT NULL, -- unique identifier for the contract
address cha... |
[
{
"role": "user",
"content": "List the first name, last name, and relationship for all beneficiaries whose percentage share is between 10 and 50, inclusive."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, relationship FROM insurance.policy_beneficiaries WHERE percentage_shar... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text... |
[
{
"role": "user",
"content": "How many users have their profile pictures set and also have written a bio?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS user_count\nFROM social_media.users\nWHERE profile_picture_url IS NOT NULL AND profile_picture_url <> ''\n AND bio IS NOT NULL 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 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 non-primary insurance plans from providers containing 'Care' in their name, including the policy number and expiration date."
},
{
"role": "assistant",
"content": "SELECT pi.patient_id, pi.policy_number, pi.expiration_date FROM healthcare.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors (
doctor_id character varying(64) NOT NULL, -- unique identifier for the doctor
first_name ... |
[
{
"role": "user",
"content": "Could you please list the first and last names of all clients?"
},
{
"role": "assistant",
"content": "SELECT first_name, last_name FROM clients;"
},
{
"role": "user",
"content": "Now, only show clients whose status is 'active'."
},
{
"role": "ass... | You are an SQL statement expert. Given the table 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 a list of all asset names along with the current KYC status of each user, including the asset symbol. Join the assets and kyc_audit tables."
},
{
"role": "assistant",
"content": "SELECT a.name AS asset_name, a.symbol, k.user_id, k.status AS kyc_status \nFROM tr... | You are an SQL statement expert. Given the table 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, name character varying(128) NOT NULL, symbol charact... |
[
{
"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 each genre and the number of games in that genre."
},
{
"role": "assistant",
"content": "SELECT genre,\n COUNT(*) AS game_count\nFROM gaming_technology.games\nGROUP BY genre;"
},
{
"role": "user",
"content": "Now filter to only include genres ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games (
game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game
ti... |
[
{
"role": "user",
"content": "Retrieve all notifications sent in the last 24 hours, ordered by sent_at descending."
},
{
"role": "assistant",
"content": "SELECT *\nFROM government_services.notifications\nWHERE sent_at >= CURRENT_TIMESTAMP - INTERVAL '24 HOURS'\nORDER BY sent_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 government_services.notifications ( notification_id.text, citizen_id.text, application_id.text, message_subject.text, m... |
[
{
"role": "user",
"content": "How many hashtags were created in each month of 2024?"
},
{
"role": "assistant",
"content": "SELECT date_trunc('month', created_at) AS month, COUNT(*) AS count\nFROM social_media.hashtags\nWHERE created_at >= '2024-01-01'\n AND created_at < '2025-01-01'\nGROUP 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 social_media.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name character varying(100) NOT NULL UNIQUE, cre... |
[
{
"role": "user",
"content": "What is the average ROI for smart money addresses on the Binance chain?"
},
{
"role": "assistant",
"content": "SELECT AVG(roi) FROM smart_money_profit WHERE chain = 'Binance';"
}
] | You are an SQL statement expert. Given the table 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 text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri... |
[
{
"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 replacement policies where a customer received a new policy starting the day after their previous policy was cancelled. Return customer_id, original_policy_id, original_cancellation_date, new_policy_id, new_start_date."
},
{
"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 insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c... |
[
{
"role": "user",
"content": "List the product ID and product name of all insurance products created in 2024."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name\nFROM insurance.insurance_products\nWHERE created_at >= '2024-01-01' AND created_at < '2025-01-01';"
},
{
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, product_type text, description text, bas... |
[
{
"role": "user",
"content": "For each contract, can you list the token symbols and total supply of all tokens created by that contract, along with the contract's current status?"
},
{
"role": "assistant",
"content": "SELECT c.contract_id, c.address AS contract_address, c.status, t.token_symbol,... | You are an SQL statement expert. Given the table 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": "Provide a list of user ID, wallet ID, and details (contract ID, creator address, timestamp) for smart contracts created by addresses associated with wallets."
},
{
"role": "assistant",
"content": "SELECT w.user_id, w.wallet_id, sc.contract_id, sc.creator_address, sc... | 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.text, previous_block_id.text, timestamp.timestamp, nonc... |
[
{
"role": "user",
"content": "List all likes made by user 'U100' on posts, including the like_id and the post_id."
},
{
"role": "assistant",
"content": "SELECT like_id, post_id FROM social_media.likes WHERE user_id = 'U100' AND post_id IS NOT NULL;"
},
{
"role": "user",
"content": "N... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, created_at.timestamp )
|
[
{
"role": "user",
"content": "Show user_id and post_id for users who have created posts and have a private profile."
},
{
"role": "assistant",
"content": "SELECT p.user_id, p.post_id FROM social_media.posts AS p JOIN social_media.user_settings AS us ON p.user_id = us.user_id WHERE us.private_pro... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u... |
[
{
"role": "user",
"content": "List all achievements with their name, points, and the title of the game they belong to."
},
{
"role": "assistant",
"content": "SELECT a.name AS achievement_name, a.points, g.title AS game_title FROM gaming_technology.achievements a JOIN games g ON a.game_id = g.gam... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, game_id uuid, name text, description text, icon_url t... |
[
{
"role": "user",
"content": "Find tokens with a 24-hour DEX trading volume greater than $500,000. For these tokens, display their symbol, chain, the 24h volume from the DEX pool, and the narrative category they belong to from the smart money inflow data."
},
{
"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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "List the top 5 largest unspent UTXOs by amount, showing utxo_id, address, and amount, ordered descending."
},
{
"role": "assistant",
"content": "SELECT utxo_id, address, amount FROM trading_platform.utxos WHERE spent = false ORDER BY amount DESC LIMIT 5;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan... |
[
{
"role": "user",
"content": "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": "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": "Which hashtags appear on the most posts? Return hashtag_id, tag_name, and the number of posts each hashtag is used in, sorted descending, limited to the top 3."
},
{
"role": "assistant",
"content": "SELECT\n h.hashtag_id,\n h.tag_name,\n COUNT(ph.post_id) AS post... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t... |
[
{
"role": "user",
"content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens where the price is greater than $0.1."
},
{
"role": "assistant",
"content": "SELECT tm.name, tm.contract_address, tm.total_supply, tp... | You are an SQL statement expert. Given the table 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": "Find all pairs of distinct routes that share the same origin location ID. List the route IDs and route numbers for both routes in each pair, along with the shared origin location ID."
},
{
"role": "assistant",
"content": "SELECT r1.route_id AS route1_id, r1.route_nu... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati... |
[
{
"role": "user",
"content": "Show me all addresses with a balance greater than 1000, ordered by balance in descending order."
},
{
"role": "assistant",
"content": "SELECT address_id, public_key, balance FROM blockchain.addresses WHERE balance > 1000 ORDER BY balance DESC;"
},
{
"role": ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.addresses (
address_id character varying(128) NOT NULL, -- unique identifier for the address
public... |
[
{
"role": "user",
"content": "Show me all contract addresses deployed by the address '0xabc...def'."
},
{
"role": "assistant",
"content": "SELECT address FROM web3.contracts WHERE deployer_address = '0xabc...def';"
},
{
"role": "user",
"content": "Can you refine that list to only inc... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE web3.contracts ( contract_id text PRIMARY KEY, address text, abi text, bytecode text... |
[
{
"role": "user",
"content": "Show me all trips that originated from locations in California, including the trip ID, origin city, and destination city."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, o.city AS origin_city, d.city AS destination_city FROM transportation.trips t JOIN tran... | You are an SQL statement expert. Given the table 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": "Show me all asset types along with the count of distinct assets and the count of log actions for each type."
},
{
"role": "assistant",
"content": "SELECT a.type, COUNT(DISTINCT a.asset_id) AS asset_count, COUNT(l.log_id) AS action_count FROM trading_platform.assets ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.assets ( asset_id text, name text, symbol text, type text )
CREATE TABLE trading_platform.logs ( log_i... |
[
{
"role": "user",
"content": "I need a list of agents along with their manager's contact email and phone number."
},
{
"role": "assistant",
"content": "SELECT a.agent_id, a.first_name, a.last_name, m.contact_email AS manager_email, m.contact_phone AS manager_phone FROM insurance.agents a LEFT JO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.agents ( agent_id text, first_name text, last_name text, agency_name text, license_number text, license_state... |
[
{
"role": "user",
"content": "List each player's username along with the names and rarities of items they own, but only include Legendary items."
},
{
"role": "assistant",
"content": "SELECT p.username, igi.item_name, igi.rarity\nFROM gaming_technology.players p\nJOIN gaming_technology.player_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 PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "For each user, can you show their username and the length of their email address?"
},
{
"role": "assistant",
"content": "SELECT user_id, username, LENGTH(email) AS email_length FROM web3.users;"
}
] | You are an SQL statement expert. Given the table 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 PRIMARY KEY, username text, email text, password_hash text, created_at timestamp )
|
[
{
"role": "user",
"content": "Show me the usernames and full names of all users who have updated their profile after April 1, 2024, and have specified a location."
},
{
"role": "assistant",
"content": "SELECT username, full_name FROM social_media.users WHERE updated_at > '2024-04-01' AND locatio... | You are an SQL statement expert. Given the table 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 all rooms along with their room number, room type name, and the base rate for that room type."
},
{
"role": "assistant",
"content": "SELECT T1.room_number, T2.type_name, T2.base_rate FROM rooms AS T1 JOIN room_types AS T2 ON T1.room_type_id = T2.room_type_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.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "For each department, what is the earliest and latest employee hire date?"
},
{
"role": "assistant",
"content": "SELECT department, MIN(hire_date) AS earliest_hire_date, MAX(hire_date) AS latest_hire_date FROM financial_services.employees GROUP BY department;"
},
... | You are an SQL statement expert. Given the table 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.employees ( employee_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ... |
[
{
"role": "user",
"content": "Count how many insurance policies do not have a group number specified."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM healthcare.patient_insurance WHERE group_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 healthcare.patient_insurance (
patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p... |
[
{
"role": "user",
"content": "List all claim documents that are police reports and were uploaded in the last 30 days, along with their file sizes."
},
{
"role": "assistant",
"content": "SELECT cd.document_id, cd.claim_id, cd.file_size_bytes FROM insurance.claim_documents cd WHERE cd.document_typ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c... |
[
{
"role": "user",
"content": "Show me all active vehicles with their make, model, and depot location details, along with their last maintenance service type and date."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id, v.make, v.model, v.depot_id, ml.service_type, ml.service_date FROM tr... | You are an SQL statement expert. Given the table 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": "For the latest snapshot time, list the total `usd_value` held by CEXes for each distinct `token_symbol` across all chains. Order the results by total value descending."
},
{
"role": "assistant",
"content": "WITH latest_snapshot AS (\n SELECT max(snapshot_time) as 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 cex_token_balance (",
"snapshot_time character varying(32) NOT NULL, -- the snapshot time of record, converted ... |
[
{
"role": "user",
"content": "Which document_name has the highest number of versions? Return the document_name and the number of versions."
},
{
"role": "assistant",
"content": "SELECT document_name,\n COUNT(*) AS version_count\nFROM legal_services.documents\nGROUP BY document_name\nORDER ... | You are an SQL statement expert. Given the table 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": "List the make and model of vehicles that have completed a trip, along with the trip ID."
},
{
"role": "assistant",
"content": "SELECT T1.make, T1.model, T2.trip_id FROM transportation.vehicles AS T1 JOIN transportation.trips AS T2 ON T1.vehicle_id = T2.vehicle_id WH... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "List each unique plan_id and the total number of patients enrolled in that plan."
},
{
"role": "assistant",
"content": "SELECT plan_id, COUNT(DISTINCT patient_id) AS patient_count FROM healthcare.patient_insurance GROUP BY plan_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.patient_insurance ( patient_insurance_id text, patient_id text, plan_id text, policy_number text, group_numb... |
[
{
"role": "user",
"content": "Which users have participated in conversations that are not group chats? Please show their usernames and the conversation IDs."
},
{
"role": "assistant",
"content": "SELECT u.username, cp.conversation_id\nFROM social_media.conversation_participants cp\nJOIN social_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 text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "List the first name, last name, license number, and status for all drivers whose license expires in the next 6 months."
},
{
"role": "assistant",
"content": "SELECT\n first_name,\n last_name,\n license_number,\n status\nFROM transportation.drivers\nWHERE\n lice... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ... |
[
{
"role": "user",
"content": "Find all documents of type 'Correspondence' uploaded in 2023. Show the document name, upload timestamp, and the name of the case it belongs to."
},
{
"role": "assistant",
"content": "SELECT T1.document_name, T1.upload_timestamp, T2.case_name FROM legal_services.docu... | You are an SQL statement expert. Given the table 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.