conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Provide a list of node IDs, IP addresses, and the contract IDs and timestamps of smart contracts that were hypothetically created by these nodes."
},
{
"role": "assistant",
"content": "SELECT T1.node_id, T1.ip_address, T2.contract_id, T2.timestamp FROM blockchain.no... | 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.nodes (
node_id character varying(64) NOT NULL, -- unique identifier... |
[
{
"role": "user",
"content": "For each unique registration year, list the year and the number of users who registered in that year."
},
{
"role": "assistant",
"content": "SELECT EXTRACT(YEAR FROM created_at) AS registration_year, COUNT(*) AS user_count\nFROM web3.users\nGROUP BY EXTRACT(YEAR 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 web3.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp )
|
[
{
"role": "user",
"content": "What is the average price of services grouped by category? Display category and average_price."
},
{
"role": "assistant",
"content": "SELECT category, AVG(price) AS average_price FROM hospitality_technology.services GROUP BY category;"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.services ( service_id text PRIMARY KEY, property_id text, service_name text, description text, c... |
[
{
"role": "user",
"content": "Retrieve the product_id and product_name for all insurance products created after March 1, 2024."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name\nFROM insurance.insurance_products\nWHERE created_at > '2024-03-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": "I need a combined report displaying each customer’s full name, their account number, account balance, and the ticker symbol and security name of every security traded in the same currency as their account."
},
{
"role": "assistant",
"content": "SELECT c.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 financial_services.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ... |
[
{
"role": "user",
"content": "Show me all invoices where the notes field is not null. Display invoice number, client ID, and notes."
},
{
"role": "assistant",
"content": "SELECT invoice_number, client_id, notes FROM legal_services.invoices WHERE notes IS NOT NULL;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices ( invoice_id text, invoice_number text, client_id text, case_id text, issue_date date, due_date... |
[
{
"role": "user",
"content": "Show me the top 5 users by the total number of trades they participated in as buyers, along with their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, w.address, COUNT(t.trade_id) AS trade_count FROM trading_platform.users u 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 trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "Could you list each developer along with the next developer founded after them in the same country? Return columns current_developer, next_developer, and years_difference."
},
{
"role": "assistant",
"content": "SELECT d1.name AS current_developer,\n d2.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 gaming_technology.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_... |
[
{
"role": "user",
"content": "Show me the first name, last name, and date of birth for all patients who are male."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, date_of_birth FROM healthcare.patients WHERE gender = 'Male';"
},
{
"role": "user",
"content": "Pleas... | You are an SQL statement expert. Given the table 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": "Show each user's earliest wallet and latest wallet with their wallet_id and created_at."
},
{
"role": "assistant",
"content": "SELECT w1.user_id,\n w1.wallet_id AS earliest_wallet,\n w1.created_at AS earliest_date,\n w2.wallet_id AS latest_wallet,\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "Show me all tokens with their contract addresses and total supply, but only include tokens where the decimals are greater than 6, sorted by total supply in descending order."
},
{
"role": "assistant",
"content": "SELECT token_name, contract_address, total_supply 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 web3.tokens ( token_id.text, contract_address.text, token_name.text, token_symbol.text, decimals.integer, total_supply.... |
[
{
"role": "user",
"content": "I need to find all pairs of BUY and SELL trades for the same account that occurred on the same settlement_date."
},
{
"role": "assistant",
"content": "SELECT a.trade_id AS buy_trade_id, b.trade_id AS sell_trade_id, a.account_id, a.settlement_date\nFROM financial_ser... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.trades ( trade_id.text, account_id.text, security_id.text, order_id.text, trade_type.text, quantity.... |
[
{
"role": "user",
"content": "Retrieve the agency name and the most recent notification sent date for each agency, considering only notifications related to agencies."
},
{
"role": "assistant",
"content": "SELECT a.agency_name, MAX(n.sent_at) AS last_notification_date\nFROM government_services.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 government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... |
[
{
"role": "user",
"content": "List all pairs of diagnoses that belong to the same medical record. Show record_id, diagnosis_id from the first entry as diag1_id, and diagnosis_id from the second entry as diag2_id."
},
{
"role": "assistant",
"content": "SELECT d1.record_id,\n d1.diagnosis_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 character varying(64) NOT NULL, -- unique identifier for the diagnosis entry
... |
[
{
"role": "user",
"content": "List all active staff members who are managers, along with their hire dates and email addresses."
},
{
"role": "assistant",
"content": "SELECT staff_id, first_name, last_name, position, hire_date, work_email FROM hospitality_technology.staff WHERE is_active = true 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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "List the usernames of users who have sent messages containing the word 'urgent', along with the message content and sent time."
},
{
"role": "assistant",
"content": "SELECT u.username, m.content, m.sent_at FROM social_media.messages m JOIN social_media.users u ON 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.messages (
message_id character varying(64) NOT NULL, -- unique identifier for the message
convers... |
[
{
"role": "user",
"content": "For each game, find the next game released by the same developer. Return game_id, title, next_game_id, and next_game_title."
},
{
"role": "assistant",
"content": "SELECT g1.game_id, g1.title, g2.game_id AS next_game_id, g2.title AS next_game_title\nFROM gaming_techn... | You are an SQL statement expert. Given the table 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 the names and manufacturers of all medications that have a description provided."
},
{
"role": "assistant",
"content": "SELECT medication_name, manufacturer FROM healthcare.medications WHERE description IS NOT NULL;"
},
{
"role": "user",
"content... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,... |
[
{
"role": "user",
"content": "For each transaction_id in the utxos table, show the transaction_id and the total number of UTXOs associated with it, sorted by the count descending."
},
{
"role": "assistant",
"content": "SELECT transaction_id,\n COUNT(*) AS utxo_count\nFROM trading_platform.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.assets (
asset_id character varying(64) NOT NULL, -- unique identifier for the asset
name cha... |
[
{
"role": "user",
"content": "Calculate the total PNL and total Net Flow for all tokens recorded on the 'Arbitrum' chain."
},
{
"role": "assistant",
"content": "SELECT SUM(pnl) as total_pnl, SUM(net_flow) as total_net_flow FROM smart_money_token_performance WHERE chain = 'Arbitrum';"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, token_symbol character varying(100), pnl... |
[
{
"role": "user",
"content": "List all female patients born before 1990 who have a phone number listed, showing their full names and contact information."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, phone_number, email, emergency_contact_name, emergency_contact_phone 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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "How many service locations do we have in each state?"
},
{
"role": "assistant",
"content": "SELECT state, COUNT(*) AS location_count FROM government_services.service_locations GROUP BY state;"
},
{
"role": "user",
"content": "Only show states where there... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the ph... |
[
{
"role": "user",
"content": "Can you help me fetch the inventory details for components associated with a specific aircraft build, including the batch number, quantity, and warehouse location?"
},
{
"role": "assistant",
"content": "MATCH (ab:AircraftBuild {build_id: 'specific_build_id'})-[:IS_M... | 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 ':AircraftModel'. Properties: { model_id: String (Constraint: UNIQUE), model_name: Str... |
[
{
"role": "user",
"content": "What is the average and maximum standard fee for services in each category?"
},
{
"role": "assistant",
"content": "SELECT category, AVG(standard_fee) AS avg_standard_fee, MAX(standard_fee) AS max_standard_fee FROM government_services.services GROUP BY 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 government_services.services ( service_id text PRIMARY KEY, agency_id text, service_name text, description text, catego... |
[
{
"role": "user",
"content": "Find the token with the highest total supply and show its name, symbol, and contract address."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, contract_address FROM web3.tokens ORDER BY total_supply DESC LIMIT 1;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.tokens ( token_id text, contract_address text, token_name text, token_symbol text, decimals integer, total_supply ... |
[
{
"role": "user",
"content": "How many unique email domains are there among all registered users?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT SUBSTRING(email FROM '@(.*)$')) AS unique_domains FROM blockchain.users;"
},
{
"role": "user",
"content": "Can you list these... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email character va... |
[
{
"role": "user",
"content": "Find the citizen ID and document ID for documents with a 'Proof of Address' document type, for citizens who have also received at least one notification. Show distinct combinations."
},
{
"role": "assistant",
"content": "SELECT DISTINCT d.citizen_id, d.document_id F... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document i... |
[
{
"role": "user",
"content": "How many game sessions has each player started? Show player ID and the total count."
},
{
"role": "assistant",
"content": "SELECT player_id, count(*) AS session_count FROM game_sessions GROUP BY player_id;"
},
{
"role": "user",
"content": "Only show play... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea... |
[
{
"role": "user",
"content": "Count the number of documents for each document type."
},
{
"role": "assistant",
"content": "SELECT document_type, COUNT(*) FROM government_services.documents GROUP BY document_type;"
},
{
"role": "user",
"content": "Only include document types that have... | You are an SQL statement expert. Given the table 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": "Show the total balance for each SUI coin across all owners. Group by coin_type."
},
{
"role": "assistant",
"content": "SELECT coin_type,\n SUM(CAST(balance AS DECIMAL)) AS total_balance\nFROM sui_coins\nGROUP BY coin_type;"
},
{
"role": "user",
"co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "Show the total number of customers in each state."
},
{
"role": "assistant",
"content": "SELECT\n state,\n COUNT(customer_id)\nFROM insurance.customers\nGROUP BY\n state;"
}
] | You are an SQL statement expert. Given the table 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": "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": "Provide a list of all future appointments showing appointment_id, scheduled_start_time, location_name, city, and state."
},
{
"role": "assistant",
"content": "SELECT\n a.appointment_id,\n a.scheduled_start_time,\n sl.location_name,\n sl.city,\n sl.state\nFROM 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 government_services.service_locations ( location_id character varying(64) NOT NULL, agency_id character varying(64) NOT... |
[
{
"role": "user",
"content": "I need pairs of items within the same game where one item_type is 'Weapon' and the other is 'Consumable'. Show game_id, weapon_name, and consumable_name."
},
{
"role": "assistant",
"content": "SELECT i1.game_id, i1.item_name AS weapon_name, i2.item_name AS consumabl... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.in_game_items ( item_id uuid PRIMARY KEY, game_id uuid, item_name text, item_type text, description t... |
[
{
"role": "user",
"content": "Show me all active policies with coverage limits above $1,000,000, along with the customer names and agent names."
},
{
"role": "assistant",
"content": "SELECT p.policy_id, p.coverage_limit, c.first_name || ' ' || c.last_name AS customer_name, a.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 insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d... |
[
{
"role": "user",
"content": "List all policy beneficiaries, showing their first name, last name, relationship, percentage share, and the first and last name of the customer associated with the beneficiary record."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T1.rela... | You are an SQL statement expert. Given the table 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": "Can you show, for each employee, the full name and job title of their direct manager, as well as the employee's department and branch_id?"
},
{
"role": "assistant",
"content": "SELECT e.employee_id, e.first_name AS employee_first_name, e.last_name AS employee_last_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 financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri... |
[
{
"role": "user",
"content": "Show me all clients who have appointments with lawyers from law firms located at the same address as their own company. I want to see the client's first and last name, company name, the lawyer's name, the law firm's name, and the shared address."
},
{
"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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Show me the average investment value for projects that completed fundraising in the last 6 months, grouped by round name."
},
{
"role": "assistant",
"content": "SELECT rounds_name, AVG(investment_value) as avg_investment FROM project_fundraising_record WHERE investm... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "Find the average commission rate among all agents whose hire date is after '2020-01-01'."
},
{
"role": "assistant",
"content": "SELECT AVG(commission_rate) FROM insurance.agents WHERE hire_date > '2020-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.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state... |
[
{
"role": "user",
"content": "Show me the total amount held and number of unique wallets for each ERC20 token with a symbol ending in 'X'."
},
{
"role": "assistant",
"content": "SELECT tm.symbol, SUM(CAST(ebh.amount AS DECIMAL)) AS total_amount, COUNT(DISTINCT ebh.wallet_address) AS unique_walle... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "Retrieve all loans along with the corresponding customer's first and last name and the current principal balance."
},
{
"role": "assistant",
"content": "SELECT l.loan_id, c.first_name, c.last_name, l.current_principal_balance\nFROM financial_services.loans l\nJOIN 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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad... |
[
{
"role": "user",
"content": "Show me all claims that are associated with a policy having a deductible greater than 1000. Show the claim ID, incident date, and the policy's deductible."
},
{
"role": "assistant",
"content": "SELECT T1.claim_id, T1.incident_date, T2.deductible FROM insurance.claim... | You are an SQL statement expert. Given the table 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": "Show all claim documents (document_id, file_name, and document_type) for claims that have a settlement amount greater than 5000."
},
{
"role": "assistant",
"content": "SELECT cd.document_id, cd.file_name, cd.document_type\nFROM insurance.claim_documents cd\nJOIN ins... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "Find any two claims made by the same customer on the same day. Return customer_id, the two claim IDs, and the incident date."
},
{
"role": "assistant",
"content": "SELECT c1.customer_id,\n c1.claim_id AS claim1_id,\n c2.claim_id AS claim2_id,\n DAT... | You are an SQL statement expert. Given the table 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 all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address, from the nft_holders table."
},
{
"role": "assistant",
"content": "SELECT wallet_address, token_id, contract_address FROM nft_holders WHERE 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 erc1155_approval_for_all ( block_number.bigint, block_timestamp.timestamp, transaction_index.integer, transaction_hash.... |
[
{
"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": "I need a list showing the name of each law firm and the full name of every lawyer employed by that firm."
},
{
"role": "assistant",
"content": "SELECT T1.firm_name, T2.first_name, T2.last_name FROM law_firms AS T1 JOIN lawyers AS T2 ON T1.firm_id = T2.firm_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, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"role": "user",
"content": "Find the total balance per coin_type for active SUI coins, including coin_type, symbol, name, and SUM(balance) as total_balance. Sort by total_balance descending."
},
{
"role": "assistant",
"content": "SELECT\n c.coin_type,\n m.symbol,\n m.name,\n SUM(CAST(c.bal... | You are an SQL statement expert. Given the table 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": "How many users have non-empty full_name and bio fields? Return only the count."
},
{
"role": "assistant",
"content": "SELECT COUNT(*)\nFROM social_media.users\nWHERE full_name IS NOT NULL\n AND full_name <> ''\n AND bio IS NOT NULL\n 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 text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "For each state, count the number of customers and display state as state and the count as customer_count, ordered by customer_count descending."
},
{
"role": "assistant",
"content": "SELECT state,\n COUNT(*) AS customer_count\nFROM insurance.customers\nGROUP 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 insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "For each customer, show their full name, account number, account balance, and the ticker symbol of securities they have traded."
},
{
"role": "assistant",
"content": "SELECT c.first_name || ' ' || c.last_name AS full_name, a.account_number, a.balance, s.ticker_symbo... | You are an SQL statement expert. Given the table 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": "Could you provide a list of all employees along with their manager's full name and the branch_id where they work?"
},
{
"role": "assistant",
"content": "SELECT e.employee_id, e.first_name || ' ' || e.last_name AS employee_name, m.first_name || ' ' || m.last_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 financial_services.employees (
employee_id character varying(64) NOT NULL, -- unique identifier for the employee
... |
[
{
"role": "user",
"content": "List all medical records created in the last 7 days, including patient_id, doctor_id, and record_date."
},
{
"role": "assistant",
"content": "SELECT patient_id, doctor_id, record_date FROM healthcare.medical_records WHERE created_at >= CURRENT_DATE - INTERVAL '7 day... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records ( record_id.text, patient_id.text, appointment_id.text, doctor_id.text, record_date.timestam... |
[
{
"role": "user",
"content": "Show me the average billing rate and total hours spent for each lawyer, grouped by lawyer_id."
},
{
"role": "assistant",
"content": "SELECT lawyer_id, AVG(billing_rate) AS avg_billing_rate, SUM(hours_spent) AS total_hours FROM legal_services.time_entries GROUP BY la... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries ( entry_id text PRIMARY KEY, case_id text, lawyer_id text, date_worked date, hours_spent nu... |
[
{
"role": "user",
"content": "Show me the total number of trades and the sum of total_amount for each status in the trades table."
},
{
"role": "assistant",
"content": "SELECT\n t.status,\n COUNT(t.trade_id) AS trade_count,\n SUM(t.total_amount) AS total_amount_by_status\nFROM financial_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 financial_services.trades ( trade_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL, securit... |
[
{
"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 type and date."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, service_type, service_date FROM transportation.maintenance_logs WHERE next_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 transportation.maintenance_logs (
log_id character varying(64) NOT NULL, -- unique identifier for the maintenance ... |
[
{
"role": "user",
"content": "I need a list of conversation IDs and participant usernames for conversations that have media messages. Include conversation_id, username, and media_type."
},
{
"role": "assistant",
"content": "SELECT m.conversation_id, u.username, m.media_type\nFROM social_media.me... | You are an SQL statement expert. Given the table 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": "Which doctors have both a listed email address and a license number that starts with the letter 'A'? Show their ID, full name, specialty, and email."
},
{
"role": "assistant",
"content": "SELECT doctor_id, first_name, last_name, specialty, email\nFROM healthcare.doc... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number... |
[
{
"role": "user",
"content": "Can you show me all user IDs that have both email and push notifications disabled, along with whether their profile is set to private?"
},
{
"role": "assistant",
"content": "SELECT user_id, private_profile FROM social_media.user_settings WHERE email_notifications_en... | You are an SQL statement expert. Given the table 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.user_settings ( setting_id text, user_id text, theme text, email_notifications_enabled boolean, push_notif... |
[
{
"role": "user",
"content": "List each in-game item along with the number of sessions played in the game it belongs to. Show item_id, item_name, and session_count."
},
{
"role": "assistant",
"content": "SELECT i.item_id, i.item_name, COUNT(s.session_id) AS session_count\nFROM gaming_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 gaming_technology.developers (
developer_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the d... |
[
{
"role": "user",
"content": "Find pairs of patients who share the same last name. Show the patient IDs, full names, and the shared last name."
},
{
"role": "assistant",
"content": "SELECT p1.patient_id AS patient1_id, p1.first_name AS patient1_first_name, p1.last_name AS patient1_last_name, p2.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "Show me the names and providers of all insurance plans, along with their plan type."
},
{
"role": "assistant",
"content": "SELECT plan_name, insurance_provider, plan_type FROM healthcare.insurance_plans;"
},
{
"role": "user",
"content": "Only include tho... | You are an SQL statement expert. Given the table 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.insurance_plans ( plan_id text PRIMARY KEY, plan_name text, insurance_provider text, plan_type text, contact... |
[
{
"role": "user",
"content": "List all securities along with their latest close price and volume from the market data."
},
{
"role": "assistant",
"content": "SELECT m.security_id, s.security_name, m.close_price, m.volume\nFROM financial_services.market_data m\nJOIN (\n SELECT security_id, MAX(d... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad... |
[
{
"role": "user",
"content": "Show me appointment_id, start_time, subject, case_number, and status for all appointments scheduled for tomorrow."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id,\n a.start_time,\n a.subject,\n c.case_number,\n a.status\nFROM l... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, man... |
[
{
"role": "user",
"content": "Show the names and types of all assets whose symbol is exactly 3 characters long."
},
{
"role": "assistant",
"content": "SELECT name, type, symbol FROM trading_platform.assets WHERE LENGTH(symbol) = 3;"
},
{
"role": "user",
"content": "Also, I want to or... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, name text, symbol text, type text )
|
[
{
"role": "user",
"content": "Calculate the total billable hours spent by each lawyer for entries in March 2024."
},
{
"role": "assistant",
"content": "SELECT lawyer_id,\n SUM(hours_spent) AS total_hours\nFROM legal_services.time_entries\nWHERE is_billable = TRUE\n AND date_worked BETWEEN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries (
entry_id character varying(64) NOT NULL, -- unique identifier for the time entry
... |
[
{
"role": "user",
"content": "Show me the total quantity traded and total amount for each security, identified by its ticker symbol, for trades in the last month."
},
{
"role": "assistant",
"content": "SELECT T2.ticker_symbol, SUM(T1.quantity), SUM(T1.total_amount) FROM financial_services.trades... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.trades ( trade_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL, securit... |
[
{
"role": "user",
"content": "List all vehicles with a capacity greater than 20, including their make, model, and depot location details."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id, v.make, v.model, v.capacity, v.depot_id FROM transportation.vehicles v WHERE v.capacity > 20;"
}... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"role": "user",
"content": "Show me each participant in group chats with their username, conversation ID, join date, and last read date."
},
{
"role": "assistant",
"content": "SELECT cp.conversation_id, u.username, cp.joined_at, cp.last_read_at\nFROM social_media.conversation_participants cp\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.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "Show all premium payments made via 'bank transfer' along with the policy_id and customer_id."
},
{
"role": "assistant",
"content": "SELECT payment_id, policy_id, customer_id, amount_paid, payment_date FROM insurance.premium_payments WHERE payment_method = 'bank 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 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 token symbols that have a positive ROI and a Realized Ratio greater than 0.7. Show their token symbol, chain, ROI, and Realized Ratio."
},
{
"role": "assistant",
"content": "SELECT token_symbol, chain, roi, realized_ratio FROM smart_money_token_performance ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, token_symbol character varying(100), pnl... |
[
{
"role": "user",
"content": "List all lawyers and their hire dates."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, hire_date FROM legal_services.lawyers;"
},
{
"role": "user",
"content": "Now, only show lawyers hired after 2022."
},
{
"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 legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t... |
[
{
"role": "user",
"content": "Show me the full name of all partner lawyers and the total hours they have spent on all time entries."
},
{
"role": "assistant",
"content": "SELECT l.first_name, l.last_name, SUM(te.hours_spent) AS total_hours FROM legal_services.lawyers l JOIN legal_services.time_e... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients (
client_id character varying(64) NOT NULL, -- unique identifier for the client
first_n... |
[
{
"role": "user",
"content": "Find the average settlement_amount of closed claims for each claim handler. Return claim_handler_id and avg_settlement_amount."
},
{
"role": "assistant",
"content": "SELECT c.claim_handler_id, AVG(c.settlement_amount) AS avg_settlement_amount\nFROM insurance.claims ... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "Show me all products where the description or coverage details contain the word 'insurance'."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name, product_type, description, coverage_details FROM insurance.insurance_products WHERE description LIKE ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"role": "user",
"content": "I would like to calculate the average rarity_score for each NFT collection on the Ethereum blockchain."
},
{
"role": "assistant",
"content": "SELECT c.contract_address,\n AVG(m.rarity_score) AS avg_rarity\nFROM nft_collections c\nJOIN nft_metadata m\n ON c.co... | You are an SQL statement expert. Given the table 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": "List all unique pairs of routes that share the same destination location, and show the route numbers and their type for both routes."
},
{
"role": "assistant",
"content": "SELECT r1.route_number AS route_number_1, r1.type AS type_1, r2.route_number AS route_number_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 transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destin... |
[
{
"role": "user",
"content": "Show the claim ID, estimated loss, and the corresponding policy number for claims reported in the year 2023."
},
{
"role": "assistant",
"content": "SELECT T1.claim_id, T1.estimated_loss, T2.policy_number FROM insurance.claims AS T1 JOIN insurance.policies AS T2 ON 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 insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d... |
[
{
"role": "user",
"content": "Which guests have used services that are currently unavailable? Show guest full names, the service name, and the order status."
},
{
"role": "assistant",
"content": "SELECT g.first_name, g.last_name, s.service_name, so.status\nFROM hospitality_technology.guests g\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 hospitality_technology.guests ( guest_id.text, first_name.text, last_name.text, email.text, phone_number.text, date_of_... |
[
{
"role": "user",
"content": "List all pairs of routes where the origin location of one route is the destination location of the other, showing both route numbers and their types."
},
{
"role": "assistant",
"content": "SELECT r1.route_number AS route_number_1, r1.type AS type_1,\n r2.route... | You are an SQL statement expert. Given the table 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 each payment_method and the number of premium payments made using that method, sorted by the count in descending order."
},
{
"role": "assistant",
"content": "SELECT payment_method, COUNT(*) AS payment_count FROM insurance.premium_payments GROUP BY payment_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 insurance.agents ( agent_id text, first_name text, last_name text, agency_name text, license_number text, license_state... |
[
{
"role": "user",
"content": "List each lawyer's full name with the full name of the partner at the same firm."
},
{
"role": "assistant",
"content": "SELECT l.lawyer_id,\n CONCAT(l.first_name, ' ', l.last_name) AS lawyer_name,\n CONCAT(p.first_name, ' ', p.last_name) AS partner_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 legal_services.lawyers (
lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer
first_n... |
[
{
"role": "user",
"content": "List the names and types of all in-game items that have a rarity of 'Epic'."
},
{
"role": "assistant",
"content": "SELECT item_name, item_type FROM gaming_technology.in_game_items WHERE rarity = 'Epic';"
},
{
"role": "user",
"content": "Further restrict ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid, username text, email text, password_hash text, registration_date timestamp ... |
[
{
"role": "user",
"content": "List the content and sent time for messages sent by user 'U101'."
},
{
"role": "assistant",
"content": "SELECT content, sent_at FROM social_media.messages WHERE sender_user_id = 'U101';"
},
{
"role": "user",
"content": "Could you also include the group 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.messages (
message_id character varying(64) NOT NULL, -- unique identifier for the message
convers... |
[
{
"role": "user",
"content": "List all unique document types available in the system."
},
{
"role": "assistant",
"content": "SELECT DISTINCT document_type FROM insurance.claim_documents;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ... |
[
{
"role": "user",
"content": "How many unique user_ids are there in the wallets table?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT user_id) FROM blockchain.wallets;"
},
{
"role": "user",
"content": "Now show me the count of wallet addresses for each 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 blockchain.wallets ( wallet_id.text, user_id.text, address_id.text, private_key.text )
|
[
{
"role": "user",
"content": "For each game, I need a breakdown of how many sessions each server has hosted and what percentage of that game's total sessions each server represents. Display game_id, server_id, server_name, session_count, and session_percentage."
},
{
"role": "assistant",
"conten... | You are an SQL statement expert. Given the table 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 guests from California (state_province = 'California') who are loyalty members, along with their email and phone number."
},
{
"role": "assistant",
"content": "SELECT guest_id, first_name, last_name, email, phone_number FROM hospitality_technology.guests 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 hospitality_technology.guests ( guest_id.text, first_name.text, last_name.text, email.text, phone_number.text, date_of_... |
[
{
"role": "user",
"content": "How many agencies exist for each jurisdiction level?"
},
{
"role": "assistant",
"content": "SELECT jurisdiction_level, COUNT(*) AS agency_count FROM government_services.agencies GROUP BY jurisdiction_level;"
},
{
"role": "user",
"content": "Only show 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 government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... |
[
{
"role": "user",
"content": "Show me the usernames of all players who own at least one item with a quantity above 20, and for each player include the total number of such inventory records they have."
},
{
"role": "assistant",
"content": "SELECT p.username, COUNT(pi.inventory_id) AS inventory_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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "I want to find the total number of ERC1155 \"approval-for-all\" events per contract. Show contract_address and the approval_count."
},
{
"role": "assistant",
"content": "SELECT contract_address, COUNT(*) AS approval_count\nFROM erc1155_approval_for_all\nGROUP BY 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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "Find all staff members who are managers and list their direct reports. Show the manager's first name, last name, and the direct report's first name, last name, and position."
},
{
"role": "assistant",
"content": "SELECT m.first_name AS manager_first_name, m.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 text PRIMARY KEY, property_id text, first_name text, last_name text, position t... |
[
{
"role": "user",
"content": "Show the invoice number, issue date, total amount, and the client's full name for all invoices, including only those invoices that have not been paid fully."
},
{
"role": "assistant",
"content": "SELECT i.invoice_number, i.issue_date, i.total_amount, c.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 legal_services.clients ( client_id.text, first_name.text, last_name.text, company_name.text, email.text, phone.text, ad... |
[
{
"role": "user",
"content": "Show the application ID, status, and submitted date for all applications with the status 'Pending'."
},
{
"role": "assistant",
"content": "SELECT application_id, status, submitted_at\nFROM government_services.applications\nWHERE status = 'Pending';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth... |
[
{
"role": "user",
"content": "Show me the record_id, patient_id, prescription_id, medication_id, start_date, and the systolic blood pressure from the associated medical record for all prescriptions."
},
{
"role": "assistant",
"content": "SELECT p.prescription_id,\n p.medication_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 healthcare.medical_records ( record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, appoi... |
[
{
"role": "user",
"content": "For each project that held fundraising rounds in 2022, calculate the total investment_value and average valuation, then list the project_name, total_investment, average_valuation, and the token's symbol and current price. Match projects to tokens by case-insensitive equality of... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "Find all users who share a conversation with user 'user123', listing their user_id and the conversation_id."
},
{
"role": "assistant",
"content": "SELECT DISTINCT cp2.user_id, cp2.conversation_id\nFROM social_media.conversation_participants cp1\nJOIN social_media.co... | You are an SQL statement expert. Given the table 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": "For each citizen, find the timestamp of their first 'SMS' notification and their first 'Email' notification. Show citizen_id, first_sms_at, and first_email_at."
},
{
"role": "assistant",
"content": "SELECT citizen_id,\n MIN(sent_at) FILTER (WHERE channel = 'SM... | You are an SQL statement expert. Given the table 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": "Show me the top 5 addresses with the highest balances, along with their public keys."
},
{
"role": "assistant",
"content": "SELECT address_id, public_key, balance FROM blockchain.addresses ORDER BY balance DESC LIMIT 5;"
},
{
"role": "user",
"content": "... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.addresses ( address_id text PRIMARY KEY, public_key text, balance numeric )
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.