conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "For each location, what is the average appointment duration? Show location_id and the average duration."
},
{
"role": "assistant",
"content": "SELECT location_id, AVG(duration_minutes) FROM healthcare.appointments GROUP BY location_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": "For each unique item, what is the total quantity that has been acquired by all players?"
},
{
"role": "assistant",
"content": "SELECT item_id, SUM(quantity) AS total_quantity_acquired FROM gaming_technology.player_inventory GROUP BY item_id;"
},
{
"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 gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date... |
[
{
"role": "user",
"content": "Show the count of invoices for each case ID."
},
{
"role": "assistant",
"content": "SELECT case_id, COUNT(invoice_id) AS invoice_count FROM legal_services.invoices WHERE case_id IS NOT NULL GROUP BY case_id ORDER BY invoice_count DESC"
},
{
"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 legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_... |
[
{
"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 each lawyer along with the names of documents they have uploaded."
},
{
"role": "assistant",
"content": "SELECT l.first_name || ' ' || l.last_name AS lawyer_name,\n d.document_name\nFROM legal_services.lawyers l\nLEFT JOIN legal_services.documents d\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id text, first_name text, last_name text, bar_number text, firm_id text, email text, ph... |
[
{
"role": "user",
"content": "List the user ID and username for users who have placed orders for assets of type 'cryptocurrency'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.user_id, T1.username FROM trading_platform.users AS T1 JOIN trading_platform.orders AS T2 ON T1.user_id = T2... | You are an SQL statement expert. Given the table 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 user ID, wallet ID, contract ID, creator address, and timestamp for smart contracts created by addresses associated with any wallet."
},
{
"role": "assistant",
"content": "SELECT w.user_id, w.wallet_id, sc.contract_id, sc.creator_address, sc.timestamp FR... | 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": "Could you list the player_id of users who have unlocked both achievement '11111111-1111-1111-1111-111111111111' and '22222222-2222-2222-2222-222222222222'?"
},
{
"role": "assistant",
"content": "SELECT pa1.player_id\nFROM gaming_technology.player_achievements pa1\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 gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid N... |
[
{
"role": "user",
"content": "Show the first name, last name, and position of all staff members who are not currently active."
},
{
"role": "assistant",
"content": "SELECT first_name , last_name , position FROM hospitality_technology.staff WHERE is_active = false"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "Show me all customers (customer_id, first_name, last_name) who have both a checking account (account_type = 'Checking') and a savings account (account_type = 'Savings'), along with their total combined balance."
},
{
"role": "assistant",
"content": "SELECT c.custome... | You are an SQL statement expert. Given the table 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": "Show all tokens where the total_supply is less than 10000, listing the token_id, token_symbol, and decimals."
},
{
"role": "assistant",
"content": "SELECT token_id, token_symbol, decimals FROM web3.tokens WHERE total_supply < 10000;"
},
{
"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 web3.tokens ( token_id text PRIMARY KEY, contract_address text, token_name text, token_symbol text, decimals int, total... |
[
{
"role": "user",
"content": "Show daily total transaction amounts and counts for completed 'Payment' transactions in USD for the last 7 days."
},
{
"role": "assistant",
"content": "SELECT t.effective_date AS date,\n SUM(t.amount) AS total_amount,\n COUNT(*) AS transac... | You are an SQL statement expert. Given the table 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.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the trans... |
[
{
"role": "user",
"content": "For each group chat, list its ID, name, creation time, and the creation time of the next group chat created after it, ordered by creation time."
},
{
"role": "assistant",
"content": "SELECT conversation_id, group_name, created_at, LEAD(created_at) OVER (ORDER BY cre... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.conversations ( conversation_id character varying(64) NOT NULL, created_at timestamp NOT NULL DEFAULT CURR... |
[
{
"role": "user",
"content": "List all conversation participants along with post_hashtag details where the participant's user_id matches the hashtag_id."
},
{
"role": "assistant",
"content": "SELECT cp.conversation_id, cp.user_id, ph.post_id, ph.hashtag_id\nFROM social_media.conversation_partici... | You are an SQL statement expert. Given the table 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": "能否帮我统计特定车站(station_id 为 'station_xyz')的所有工作人员数量?"
},
{
"role": "assistant",
"content": "MATCH (s:Station {station_id: 'station_xyz'})<-[:BASED_AT]-(staff:Staff)\nRETURN COUNT(staff) AS total_staff"
}
] | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// Node Label: :Station
// Properties:
// station_id: String (Constraint: UNIQUE)
// station_... |
[
{
"role": "user",
"content": "List all customers (customer_id, first_name, last_name) who were born before 1990 (date_of_birth < '1990-01-01') and have an email address ending with '@gmail.com', along with their city and state information."
},
{
"role": "assistant",
"content": "SELECT 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 financial_services.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ... |
[
{
"role": "user",
"content": "I need to find all pairs of documents that were uploaded by the same lawyer within 7 days of each other."
},
{
"role": "assistant",
"content": "SELECT a.uploaded_by_lawyer_id,\n a.document_id AS doc1_id,\n b.document_id AS doc2_id,\n a.upload_times... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, case_id character varying(64) NOT NULL, document... |
[
{
"role": "user",
"content": "Calculate the average quantity for orders based on their status."
},
{
"role": "assistant",
"content": "SELECT status, AVG(quantity) FROM trading_platform.orders GROUP BY status;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "Find all managing partners who oversee more than one firm at the same address. Show the managing partner ID, the shared address, and the number of firms they manage at that address."
},
{
"role": "assistant",
"content": "SELECT managing_partner_id, address, 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 legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address t... |
[
{
"role": "user",
"content": "Provide the total count of unique users who have created wallets."
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT user_id) FROM web3.wallets;"
},
{
"role": "user",
"content": "Now, refine that to show the number of users who own *more than 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 web3.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "Which exchanges on the Ethereum chain hold the highest total USD value of tokens, and what are their top 3 tokens by USD value?"
},
{
"role": "assistant",
"content": "SELECT exchange, token_symbol, usd_value FROM cex_token_balance WHERE chain = 'Ethereum' ORDER BY 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 cex_token_balance ( snapshot_time.text, chain.text, address.text, exchange.text, token_address.text, token_symbol.text,... |
[
{
"role": "user",
"content": "For each item, can you show the total quantity held by all players and the most recent acquisition date for that item?"
},
{
"role": "assistant",
"content": "SELECT item_id, SUM(quantity) AS total_quantity, MAX(acquired_at) AS last_acquired_at\nFROM gaming_technolog... | You are an SQL statement expert. Given the table 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(), -- unique identifier for... |
[
{
"role": "user",
"content": "Can you provide a list of all medical records created by doctors for patients who are associated with 'PPO' type insurance plans? I need the record ID, patient ID, doctor ID, record date, and insurance plan name."
},
{
"role": "assistant",
"content": "SELECT mr.reco... | You are an SQL statement expert. Given the table 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": "Show me the full names and contact emails of citizens who have received notifications via 'SMS'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.first_name, c.last_name, c.contact_email\nFROM government_services.citizens c\nJOIN government_services.notifica... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "List the message_id, content, sender's username, and group_name for all messages in group chats."
},
{
"role": "assistant",
"content": "SELECT m.message_id, m.content, u.username, c.group_name\nFROM social_media.messages m\nJOIN social_media.conversations c ON m.con... | You are an SQL statement expert. Given the table 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 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": "Show all beneficiaries added in 2024. Include beneficiary_id, full name, relationship, percentage_share, and the added_at timestamp."
},
{
"role": "assistant",
"content": "SELECT beneficiary_id, first_name || ' ' || last_name AS full_name, relationship, percentage_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 insurance.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text... |
[
{
"role": "user",
"content": "List all transaction IDs that contain at least one UTXO marked as spent."
},
{
"role": "assistant",
"content": "SELECT DISTINCT transaction_id FROM utxos WHERE spent = TRUE;"
},
{
"role": "user",
"content": "Now, for those transaction IDs, also include t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.utxos (
utxo_id character varying(64) NOT NULL, -- unique identifier for the UTXO
transaction... |
[
{
"role": "user",
"content": "Show me all medical report documents with their claim IDs and descriptions, sorted by upload date."
},
{
"role": "assistant",
"content": "SELECT document_id, claim_id, description, uploaded_at FROM insurance.claim_documents WHERE document_type = 'medical_report' ORD... | You are an SQL statement expert. Given the table 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": "Which cases have at least one document uploaded, and what are the names and case numbers of those cases along with the most recent document name for each?"
},
{
"role": "assistant",
"content": "SELECT c.case_id, c.case_name, c.case_number, d.document_name AS latest_... | You are an SQL statement expert. Given the table 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 each user along with how many image-type posts they've made, showing user_id and image_post_count, sorted by the count descending."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(*) AS image_post_count\nFROM social_media.posts\nWHERE media_type = '... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u... |
[
{
"role": "user",
"content": "Show all tokens on the Ethereum chain in token_dexpool_info that had a price increase in the last 6 hours, along with their 24h trading volume and smart money ROI."
},
{
"role": "assistant",
"content": "SELECT td.token_symbol,\n td.price_change_percentage_6h,\... | You are an SQL statement expert. Given the table 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": "Show me medical records that mention a medication from the 'medications' table by name in their treatment plan. List the record ID, record date, patient ID, and the name of the mentioned medication."
},
{
"role": "assistant",
"content": "SELECT T1.record_id, T1.reco... | You are an SQL statement expert. Given the table 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 text PRIMARY KEY, patient_id text, appointment_id text, doctor_id text, record_d... |
[
{
"role": "user",
"content": "List all appointments and diagnoses associated with doctor 'doctor_123'. Show appointment_id, appointment_time, reason, diagnosis_id, diagnosis_code, description, and diagnosis_date."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, a.appointment_time,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id.text, patient_id.text, doctor_id.text, appointment_time.timestamp, duration_mi... |
[
{
"role": "user",
"content": "Find all pairs of tokens that have the same token name but different contract addresses, showing both token IDs, the shared token name, and each contract address."
},
{
"role": "assistant",
"content": "SELECT t1.token_id AS token_id_1, t2.token_id AS token_id_2, t1.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.tokens (
token_id character varying(64) NOT NULL, -- unique identifier for the token
contract_address cha... |
[
{
"role": "user",
"content": "How many achievements has each player unlocked and what's the earliest unlocked timestamp for each?"
},
{
"role": "assistant",
"content": "SELECT player_id,\n COUNT(*) AS total_unlocked,\n MIN(unlocked_at) AS first_unlocked\nFROM gaming_technology.player... | You are an SQL statement expert. Given the table 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_achievements ( player_achievement_id uuid, player_id uuid, achievement_id uuid, unlocked_at ti... |
[
{
"role": "user",
"content": "Show me the earliest created smart contract for each creator address."
},
{
"role": "assistant",
"content": "SELECT DISTINCT ON (creator_address) creator_address, contract_id, timestamp\nFROM blockchain.smart_contracts\nORDER BY creator_address, timestamp ASC;"
},... | You are an SQL statement expert. Given the table 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": "Can you list each employee's first and last name along with the first and last name of their manager?"
},
{
"role": "assistant",
"content": "SELECT e.first_name, e.last_name, m.first_name AS manager_first_name, m.last_name AS manager_last_name\nFROM government_servi... | You are an SQL statement expert. Given the table 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.employees ( employee_id text, agency_id text, first_name text, last_name text, job_title text, depa... |
[
{
"role": "user",
"content": "Can you show me how many distinct players played on each server and the average session score for those players?"
},
{
"role": "assistant",
"content": "SELECT server_id, COUNT(DISTINCT player_id) AS num_players, AVG(score) AS average_score\nFROM gaming_technology.ga... | You are an SQL statement expert. Given the table 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 me all active staff including their staff_id, first_name, last_name, position, and work_email."
},
{
"role": "assistant",
"content": "SELECT staff_id,\n first_name,\n last_name,\n position,\n work_email\nFROM hospitality_technology.staff... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, fir... |
[
{
"role": "user",
"content": "Give me a list of the usernames and email addresses of users who have participated in at least one conversation."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, u.email\nFROM social_media.users u\nJOIN social_media.conversation_participants cp ON ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "List all tokens on the 'BSC' chain with a trend rank between 6 and 20 (inclusive), along with their symbol, price, and liquidity."
},
{
"role": "assistant",
"content": "SELECT t.token_symbol, t.price, d.liquidity\nFROM token_basic_info t\nJOIN token_dexpool_info d 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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "How many participants in total have not read any messages? (where last_read_at is NULL)"
},
{
"role": "assistant",
"content": "SELECT COUNT(*)\nFROM social_media.conversation_participants\nWHERE last_read_at 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 social_media.conversation_participants (
participant_id character varying(64) NOT NULL, -- unique identifier for th... |
[
{
"role": "user",
"content": "I would like to get the total number of sessions and the average score for each game, showing game_id and title."
},
{
"role": "assistant",
"content": "SELECT g.game_id, g.title, COUNT(gs.session_id) AS total_sessions, AVG(gs.score) AS average_score\nFROM gaming_tec... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid, title text, developer_id uuid, publisher_id uuid, genre text, release_date date... |
[
{
"role": "user",
"content": "Show me all active policies for customers who live in California, along with their total premium payments made so far."
},
{
"role": "assistant",
"content": "SELECT p.policy_id, p.policy_number, c.first_name, c.last_name, p.premium_amount, SUM(pp.amount_paid) AS tot... | You are an SQL statement expert. Given the table 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": "Show me the security_id, ticker_symbol, and issuer_name for all securities where the currency is 'EUR' and the last_updated date is within the last 30 days."
},
{
"role": "assistant",
"content": "SELECT security_id, ticker_symbol, issuer_name FROM financial_services... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu... |
[
{
"role": "user",
"content": "For service orders delivered in the last 30 days, show each guest's ID, first and last name, the count of service orders, and total spent."
},
{
"role": "assistant",
"content": "SELECT so.guest_id,\n g.first_name,\n g.last_name,\n COUNT(*) AS 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 hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat... |
[
{
"role": "user",
"content": "List the total amount currently held and the number of unique wallets for each Bitcoin token tick."
},
{
"role": "assistant",
"content": "SELECT tb.tick, SUM(tb.amount) AS total_amount, COUNT(DISTINCT tb.wallet_address) AS unique_wallets\nFROM token_balances_bitcoin... | You are an SQL statement expert. Given the table 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": "List all claims with settlement_amount greater than 10000. Include claim_id, customer_id, estimated_loss, settlement_amount, and police_report_number."
},
{
"role": "assistant",
"content": "SELECT claim_id,\n customer_id,\n estimated_loss,\n settle... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d... |
[
{
"role": "user",
"content": "Show me properties that have more than 10 service orders delivered in the last month. Include the property_name and the number of delivered orders."
},
{
"role": "assistant",
"content": "SELECT p.property_name,\n COUNT(o.order_id) AS delivered_orders\nFROM hos... | You are an SQL statement expert. Given the table 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": "Can you give me the count of players grouped by their status?"
},
{
"role": "assistant",
"content": "SELECT status,\n COUNT(*) AS player_count\nFROM gaming_technology.players\nGROUP BY status;"
},
{
"role": "user",
"content": "Actually, include the... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "Show me all rooms with their room number, the type name, and the maximum occupancy for each room."
},
{
"role": "assistant",
"content": "SELECT r.room_id, r.room_number, rt.type_name, rt.max_occupancy\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "List every booking together with the route number and description for the trip being booked."
},
{
"role": "assistant",
"content": "SELECT b.booking_id, b.passenger_id, b.trip_id, r.route_number, r.description\nFROM transportation.bookings b\nJOIN transportation.rou... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"role": "user",
"content": "List all fuel logs for vehicle 'VHCL789', showing the fuel type, quantity, and log timestamp."
},
{
"role": "assistant",
"content": "SELECT fuel_type, quantity, log_timestamp FROM transportation.fuel_logs WHERE vehicle_id = 'VHCL789';"
},
{
"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 transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, qu... |
[
{
"role": "user",
"content": "List each verified user's username and their total number of public posts."
},
{
"role": "assistant",
"content": "SELECT u.username, COUNT(p.post_id) AS post_count\nFROM social_media.users u\nLEFT JOIN social_media.posts p ON u.user_id = p.user_id AND p.visibility =... | You are an SQL statement expert. Given the table 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 each patient and the number of different insurance plans they have had. Include patient_id and plan_count."
},
{
"role": "assistant",
"content": "SELECT patient_id, COUNT(DISTINCT plan_id) AS plan_count\nFROM healthcare.patient_insurance\nGROUP BY 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.diagnoses ( diagnosis_id text PRIMARY KEY, record_id text, patient_id text, doctor_id text, diagnosis_code t... |
[
{
"role": "user",
"content": "Show me a list of all insurance policies along with the subscriber's name and the effective and expiration dates for each policy, including the associated plan ID."
},
{
"role": "assistant",
"content": "SELECT policy_number, subscriber_name, effective_date, expirati... | You are an SQL statement expert. Given the table 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": "List each agent along with their manager's contact_email. Include agent_id, first_name, last_name, manager_id, and manager's contact_email."
},
{
"role": "assistant",
"content": "SELECT a.agent_id,\n a.first_name,\n a.last_name,\n a.manager_id,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state... |
[
{
"role": "user",
"content": "How many users have a non-empty bio field?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.users WHERE bio IS NOT NULL AND bio <> '';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "List all documents along with the document type and the case name they are associated with."
},
{
"role": "assistant",
"content": "SELECT d.document_name, d.document_type, c.case_name\nFROM legal_services.documents d\nJOIN legal_services.cases c ON d.case_id = c.cas... | You are an SQL statement expert. Given the table 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 the total hours spent by each lawyer, based on the time entries."
},
{
"role": "assistant",
"content": "SELECT lawyer_id, SUM(hours_spent) FROM legal_services.time_entries GROUP BY lawyer_id"
},
{
"role": "user",
"content": "Only include time entrie... | You are an SQL statement expert. Given the table 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": "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": "Find the top 5 most recently created users along with their email domains (the part after '@' in their email addresses)."
},
{
"role": "assistant",
"content": "SELECT username, SUBSTRING(email FROM POSITION('@' IN email)+1) AS email_domain FROM web3.users ORDER BY 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.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email character varying(... |
[
{
"role": "user",
"content": "List the contract_id and creator_address for all smart contracts created after January 1st, 2023, along with the total number of contracts each creator has created."
},
{
"role": "assistant",
"content": "SELECT s.contract_id, s.creator_address, creator_count.total_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 blockchain.smart_contracts (
contract_id character varying(64) NOT NULL, -- unique identifier for the smart contra... |
[
{
"role": "user",
"content": "List all appointment IDs and their corresponding location IDs for appointments that have status 'cancelled'."
},
{
"role": "assistant",
"content": "SELECT appointment_id, location_id FROM healthcare.appointments WHERE status = 'cancelled';"
}
] | You are an SQL statement expert. Given the table 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 posts that have received at least one comment."
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT post_id) FROM social_media.comments"
}
] | You are an SQL statement expert. Given the table 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 PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ... |
[
{
"role": "user",
"content": "List all pairs of record_id for the same patient that were created on the same day. Show the two record_ids, patient_id, and the date."
},
{
"role": "assistant",
"content": "SELECT\n mr1.patient_id,\n date_trunc('day', mr1.record_date) AS record_day,\n mr1.... | You are an SQL statement expert. Given the table 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": "What is the average investment value for projects that completed Series A funding rounds?"
},
{
"role": "assistant",
"content": "SELECT AVG(investment_value) AS average_investment FROM project_fundraising_record WHERE rounds_name = 'Series 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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "Find the total amount transferred between account 'ACC543210' and related accounts in April 2024, showing both the account ID and related account ID."
},
{
"role": "assistant",
"content": "SELECT account_id, related_account_id, SUM(amount) AS total_transferred 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 financial_services.transactions ( transaction_id text PRIMARY KEY, account_id text, related_account_id text, transactio... |
[
{
"role": "user",
"content": "Show me all active electric vehicles along with their make, model, and license plate, ordered by acquisition date with the newest first."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, make, model, license_plate, acquisition_date FROM transportation.vehicl... | You are an SQL statement expert. Given the table 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 all active services whose average processing time exceeds the overall average processing time across all active services. Show the service_id, service_name, its average_processing_time_days, and the overall average_processing_time."
},
{
"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 government_services.services ( service_id.text, agency_id.text, service_name.text, description.text, category.text, eli... |
[
{
"role": "user",
"content": "Show the top 5 narratives by 24 hour trading volume. Include the narrative name and volume."
},
{
"role": "assistant",
"content": "SELECT narrative, volume_24h FROM narrative_info ORDER BY volume_24h DESC LIMIT 5;"
},
{
"role": "user",
"content": "Can yo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative character varying(512) NOT NULL, top_3_coins text, price_change_percentage_1h double precisi... |
[
{
"role": "user",
"content": "Count the number of logs for each distinct action type."
},
{
"role": "assistant",
"content": "SELECT action, COUNT(*) AS log_count FROM trading_platform.logs GROUP BY action;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp )
|
[
{
"role": "user",
"content": "Which centralized exchange holds the highest total USD value of tokens on the Ethereum chain, and what is the total value?"
},
{
"role": "assistant",
"content": "SELECT exchange, SUM(usd_value) AS total_usd_value FROM cex_token_balance WHERE chain = 'Ethereum' 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 cex_token_balance (",
"snapshot_time character varying(32) NOT NULL, -- the snapshot time of record, converted ... |
[
{
"role": "user",
"content": "List the usernames of users that are being followed by user 'U123'."
},
{
"role": "assistant",
"content": "SELECT T2.username FROM social_media.follows AS T1 JOIN social_media.users AS T2 ON T1.following_user_id = T2.user_id WHERE T1.follower_user_id = 'U123'"
},
... | You are an SQL statement expert. Given the table 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 all routes where the estimated duration in minutes is exactly twice the distance in kilometers. Include the route number and both the distance and duration."
},
{
"role": "assistant",
"content": "SELECT route_number, distance_km, estimated_duration_minutes F... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"role": "user",
"content": "Show me all active managers along with their property IDs and the number of staff members they supervise, ordered by the number of supervised staff in descending order."
},
{
"role": "assistant",
"content": "SELECT s.staff_id, s.property_id, s.first_name, s.last_nam... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.staff (
staff_id character varying(64) NOT NULL, -- unique identifier for the staff member
... |
[
{
"role": "user",
"content": "Give me the post_id and hashtag_id for all posts that have a hashtag applied, where the hashtag name includes the word 'fun'."
},
{
"role": "assistant",
"content": "SELECT ph.post_id, ph.hashtag_id\nFROM social_media.post_hashtags ph\nJOIN social_media.hashtags h ON... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u... |
[
{
"role": "user",
"content": "What is the total net_flow and average realized_ratio for tokens on the Polygon chain?"
},
{
"role": "assistant",
"content": "SELECT SUM(net_flow) AS total_net_flow, AVG(realized_ratio) AS avg_realized_ratio\nFROM smart_money_token_performance\nWHERE chain = 'Polygo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_performance ( token_address text, token_symbol text, pnl numeric, net_flow numeric, avg_cost numeric,... |
[
{
"role": "user",
"content": "Find all contracts where the deployer address is the same as the contract address, indicating self-deployed contracts, and show their network IDs and deployment timestamps."
},
{
"role": "assistant",
"content": "SELECT address, network_id, deployed_at FROM web3.cont... | You are an SQL statement expert. Given the table 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": "Retrieve the top 5 most expensive active services along with their agency names."
},
{
"role": "assistant",
"content": "SELECT s.service_name, a.agency_name, s.standard_fee FROM government_services.services s JOIN government_services.agencies a ON s.agency_id = a.ag... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "List policy pairs for the same customer where one policy was cancelled and another active policy started within 30 days after the cancellation. Show customer_id, cancelled policy_number, cancellation_date, active policy_number, start_date."
},
{
"role": "assistant",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ... |
[
{
"role": "user",
"content": "How many cases are associated with each unique lead lawyer ID? Show the lead lawyer ID and the count of cases, but only for lawyers who lead at least 5 cases. Sort the results by the case count in descending order."
},
{
"role": "assistant",
"content": "SELECT lead_... | You are an SQL statement expert. Given the table 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": "Calculate the total estimated loss for all claims with status 'Closed'."
},
{
"role": "assistant",
"content": "SELECT SUM(estimated_loss) FROM insurance.claims WHERE status = 'Closed'"
}
] | You are an SQL statement expert. Given the table 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": "Show each user and the count of users who registered before them."
},
{
"role": "assistant",
"content": "SELECT u.username,\n COUNT(prev.user_id) AS earlier_count\nFROM trading_platform.users u\nLEFT JOIN trading_platform.users prev\n ON prev.created_at < u.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 trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "Show me all vehicles that are due for their next service before the end of this month, along with their last service date and type."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, service_date AS last_service_date, service_type FROM transportation.maintena... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id text PRIMARY KEY, vehicle_id text, service_date date, odometer_reading int, se... |
[
{
"role": "user",
"content": "Find pairs of citizens who have the same last name but different national_id_number."
},
{
"role": "assistant",
"content": "SELECT c1.citizen_id AS citizen_id_1, c1.first_name AS first_name_1, c1.last_name AS last_name_1, c1.national_id_number AS national_id_1, c2.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 government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth... |
[
{
"role": "user",
"content": "For each claim handler, count the number of documents uploaded for the claims they handled. Return claim_handler_id and document_count."
},
{
"role": "assistant",
"content": "SELECT c.claim_handler_id,\n COUNT(d.document_id) AS document_count\nFROM insurance.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 insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d... |
[
{
"role": "user",
"content": "Provide each game_id with the item_name of its cheapest item and its most expensive item."
},
{
"role": "assistant",
"content": "SELECT min_items.game_id,\n min_items.item_name AS cheapest_item,\n max_items.item_name AS most_expensive_item\nFROM gaming_t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.in_game_items ( item_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, item_name cha... |
[
{
"role": "user",
"content": "Find the average percentage share among all beneficiaries for each distinct relationship type."
},
{
"role": "assistant",
"content": "SELECT relationship, AVG(percentage_share) FROM insurance.policy_beneficiaries GROUP BY relationship ORDER BY relationship;"
}
] | You are an SQL statement expert. Given the table 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": "For each trip, show the trip ID, scheduled departure, and the last name of the driver."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, t.scheduled_departure, d.last_name\nFROM transportation.trips t\nJOIN transportation.drivers d ON t.driver_id = d.driver_i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ... |
[
{
"role": "user",
"content": "Show me all contracts deployed on the 'ethereum' network along with their deployer addresses and deployment timestamps, sorted by the most recent deployments first."
},
{
"role": "assistant",
"content": "SELECT address, deployer_address, deployed_at FROM web3.contra... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,... |
[
{
"role": "user",
"content": "List all payments processed in the last 90 days, showing payment ID, amount, currency, method, and status."
},
{
"role": "assistant",
"content": "SELECT payment_id, amount, currency_code, payment_method, status FROM hospitality_technology.payments WHERE payment_time... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "Show me the top 5 NFT collections with the highest token count on Ethereum, along with their names and symbols, but only include collections with a floor price greater than 0.5 ETH."
},
{
"role": "assistant",
"content": "SELECT nc.name, nc.symbol, nc.token_count, nc... | You are an SQL statement expert. Given the table 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_timestamp timestamp(3) NOT NULL, transaction_index integ... |
[
{
"role": "user",
"content": "How many pairs of distinct locations are there that share the same state or province but are in different cities?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM transportation.locations AS l1 JOIN transportation.locations AS l2 ON l1.state_province = l2... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.locations ( location_id text, name text, type text, address_line1 text, city text, state_province text, ... |
[
{
"role": "user",
"content": "Show the prescription_id, quantity_dispensed, and start_date for all prescriptions where refills_allowed equals 0."
},
{
"role": "assistant",
"content": "SELECT prescription_id, quantity_dispensed, start_date\nFROM healthcare.prescriptions\nWHERE refills_allowed = 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 healthcare.medications ( medication_id.text, medication_name.text, generic_name.text, manufacturer.text, ndc_code.text,... |
[
{
"role": "user",
"content": "Show me all transactions (transaction_id, amount, transaction_type) where the status is 'Completed' and the transaction_date is within the last 30 days, along with the security details (ticker_symbol, security_name) for securities traded on the same day as the transaction."
}... | You are an SQL statement expert. Given the table 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.transactions ( transaction_id.text, account_id.text, related_account_id.text, transaction_type.text,... |
[
{
"role": "user",
"content": "Show the number of service orders for each status and the average total_price for each status."
},
{
"role": "assistant",
"content": "SELECT status,\n COUNT(*) AS order_count,\n AVG(total_price) AS avg_total_price\nFROM hospitality_technology.service_ord... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.service_orders ( order_id.text, reservation_id.text, guest_id.text, service_id.text, staff_id_or... |
[
{
"role": "user",
"content": "For each user, list all pairs of read and unread notifications, showing the recipient_user_id, the unread notification_id and type, and the read notification_id and type."
},
{
"role": "assistant",
"content": "SELECT\n n_unread.recipient_user_id,\n n_unread.notifi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.notifications ( notification_id character varying(64) NOT NULL, recipient_user_id character varying(64) NO... |
[
{
"role": "user",
"content": "Show me all services and their associated property names where the service is available and the price is below 40."
},
{
"role": "assistant",
"content": "SELECT s.service_id, s.service_name, s.price, p.property_name\nFROM hospitality_technology.services s\nJOIN hosp... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.