conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Show me the usernames and group names for all users who received a 'mention' notification related to group conversations, and when those notifications were created."
},
{
"role": "assistant",
"content": "SELECT us.user_id, us.theme AS username, c.group_name, n.creat... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments ( comment_id character varying(64) NOT NULL, post_id character varying(64) NOT NULL, user_id char... |
[
{
"role": "user",
"content": "Give me the website for the insurance plan named 'Family Advantage'."
},
{
"role": "assistant",
"content": "SELECT website FROM healthcare.insurance_plans WHERE plan_name = 'Family Advantage';"
}
] | You are an SQL statement expert. Given the table 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": "Show all DApps whose name starts with the letter 'C'."
},
{
"role": "assistant",
"content": "SELECT * FROM trading_platform.dapps WHERE name ILIKE 'C%';"
},
{
"role": "user",
"content": "Could you instead make it case-sensitive so only names that start w... | You are an SQL statement expert. Given the table 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.dapps ( dapp_id.text, name.text, description.text, url.text )
|
[
{
"role": "user",
"content": "Which agencies offer more than three services? List the agency ID and the total number of services they provide."
},
{
"role": "assistant",
"content": "SELECT agency_id, COUNT(service_id) AS total_services\nFROM government_services.services\nGROUP BY agency_id\nHAVI... | You are an SQL statement expert. Given the table 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, -- unique identifier for the agency
ag... |
[
{
"role": "user",
"content": "For each room, list the room number, property name, and the type name of the room."
},
{
"role": "assistant",
"content": "SELECT r.room_number, p.property_name, rt.type_name\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology.properties p ON r.property... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "List all ERC20 tokens with their names and symbols where the price is greater than $100, sorted by price in descending order."
},
{
"role": "assistant",
"content": "SELECT scm.name, scm.symbol, tpl.price FROM sui_coins_metadata scm JOIN token_prices_latest tpl ON sc... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE nft_holder_historical ( block_number.bigint, contract_address.text, wallet_address.text, token_id.text, contract_type.t... |
[
{
"role": "user",
"content": "Can you show me the count of players from each country who have unlocked at least one achievement developed by studios based in France?"
},
{
"role": "assistant",
"content": "SELECT p.country_code, COUNT(DISTINCT p.player_id) AS player_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.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "Show all users who registered before 2023-01-01, along with their usernames and registration dates."
},
{
"role": "assistant",
"content": "SELECT user_id, username, created_at\nFROM web3.users\nWHERE created_at < '2023-01-01';"
},
{
"role": "user",
"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.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp )
|
[
{
"role": "user",
"content": "List all guests who have made a payment, showing their full name (first and last name) and the payment ID for each transaction."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T2.payment_id FROM hospitality_technology.guests AS T1 JOIN 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.guests (
guest_id character varying(64) NOT NULL, -- unique identifier for the guest profil... |
[
{
"role": "user",
"content": "Show me all doctors specializing in Pediatrics along with their upcoming appointments, including the patient ID and appointment time."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id, d.first_name, d.last_name, a.patient_id, a.appointment_time FROM healthca... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "Show me the top 5 narratives by market cap, along with their 24-hour trading volume and 7-day price change percentage."
},
{
"role": "assistant",
"content": "SELECT narrative.text, volume_24h.numeric, price_change_percentage_7d.numeric FROM narrative_info ORDER BY m... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume... |
[
{
"role": "user",
"content": "Find all services that cost exactly 25, showing their name, department, and property_id."
},
{
"role": "assistant",
"content": "SELECT service_name, department, property_id\nFROM hospitality_technology.services\nWHERE price = 25;"
},
{
"role": "user",
"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 hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "Find all blocks that contain transactions where the amount is greater than 500, and include the block difficulty."
},
{
"role": "assistant",
"content": "SELECT DISTINCT b.block_id, b.difficulty FROM blockchain.blocks b JOIN blockchain.transactions t ON b.block_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.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta... |
[
{
"role": "user",
"content": "List all customers along with any employees who have the same last name. For each pair, display customer_id, customer full name, employee_id, employee full name, and their respective emails."
},
{
"role": "assistant",
"content": "SELECT c.customer_id,\n c.firs... | You are an SQL statement expert. Given the table 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 diesel fuel logs from the last month with their vehicle details, including make, model and license plate."
},
{
"role": "assistant",
"content": "SELECT f.fuel_log_id, f.log_timestamp, f.quantity, f.total_cost, v.make, v.model, v.license_plate FROM transp... | You are an SQL statement expert. Given the table 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": "Get the count of insurance policies for each patient. Return patient_id and policy_count."
},
{
"role": "assistant",
"content": "SELECT patient_id, COUNT(*) AS policy_count FROM healthcare.patient_insurance GROUP BY patient_id;"
},
{
"role": "user",
"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 healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "For each customer, show the number of open accounts and their combined balance, joining the accounts table with itself on customer_id for demonstration."
},
{
"role": "assistant",
"content": "SELECT a.customer_id, COUNT(a.account_id) AS open_accounts_count, SUM(a.ba... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts (
account_id character varying(64) NOT NULL, -- unique identifier for the account
c... |
[
{
"role": "user",
"content": "Show me wallet addresses that hold more than 1000 of any ERC20 token, along with the token symbol and amount, from the erc20_balances table."
},
{
"role": "assistant",
"content": "SELECT eb.wallet_address, tm.symbol, eb.amount FROM erc20_balances eb JOIN token_metas... | You are an SQL statement expert. Given the table 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 posts along with the hashtag IDs applied to them and the usernames of the authors."
},
{
"role": "assistant",
"content": "SELECT p.post_id, ph.hashtag_id, u.username\nFROM social_media.posts p\nJOIN social_media.post_hashtags ph ON p.post_id = ph.post_id\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 social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "I want each user with the date and action of their most recent log entry, along with how many log entries they have in the last 7 days."
},
{
"role": "assistant",
"content": "WITH recent_logs AS (\n SELECT user_id, action, logged_at,\n ROW_NUMBER() OVER (PA... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "How many notifications are there for each distinct notification type?"
},
{
"role": "assistant",
"content": "SELECT notification_type, COUNT(*) FROM social_media.notifications GROUP BY notification_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.hashtags ( hashtag_id.text, tag_name.text, created_at.timestamp )
CREATE TABLE social_media.notifications ... |
[
{
"role": "user",
"content": "Show me the appointment_id alongside plan_id and plan_name for all appointments exceeding 30 minutes with plan_type 'PPO'."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, p.plan_id, p.plan_name FROM healthcare.appointments a CROSS JOIN healthcare.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 healthcare.appointments ( appointment_id text PRIMARY KEY, patient_id text, doctor_id text, appointment_time timestamp,... |
[
{
"role": "user",
"content": "Show me all policy beneficiaries who were added in the last 6 months, along with their full names and relationship to the policyholder."
},
{
"role": "assistant",
"content": "SELECT beneficiary_id, policy_id, first_name, last_name, relationship, percentage_share 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 insurance.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text... |
[
{
"role": "user",
"content": "Find the total payment amount and payment count made by citizen with national ID number 'A123456789'."
},
{
"role": "assistant",
"content": "SELECT SUM(p.amount) AS total_amount, COUNT(p.payment_id) AS payment_count\nFROM government_services.citizens c\nJOIN governm... | You are an SQL statement expert. Given the table 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": "How many patients are there for each gender?"
},
{
"role": "assistant",
"content": "SELECT gender, COUNT(*) AS patient_count\nFROM healthcare.patients\nGROUP BY gender;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "List all room types along with their property name and maximum occupancy, but only for room types with a base rate above 400."
},
{
"role": "assistant",
"content": "SELECT t1.type_name, t2.property_name, t1.max_occupancy FROM hospitality_technology.room_types AS 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 hospitality_technology.room_types ( room_type_id text, property_id text, type_name text, description text, base_rate nu... |
[
{
"role": "user",
"content": "Find all medical records with a vital sign for temperature above 38°C. Show the record ID and record date."
},
{
"role": "assistant",
"content": "SELECT record_id, record_date\nFROM healthcare.medical_records\nWHERE (vitals ->> 'temperature')::numeric > 38;"
}
] | You are an SQL statement expert. Given the table 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": "Which locations lack a postal code? For each, display the name, type, city, and state_province."
},
{
"role": "assistant",
"content": "SELECT name, type, city, state_province\nFROM transportation.locations\nWHERE postal_code IS NULL;"
},
{
"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.locations (
location_id character varying(64) NOT NULL, -- unique identifier for the location
n... |
[
{
"role": "user",
"content": "List all item names and quantities a player with username 'DragonRider' owns, and include the game titles for those items."
},
{
"role": "assistant",
"content": "SELECT i.item_name, pi.quantity, g.title AS game_title\nFROM gaming_technology.players p\nJOIN gaming_te... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "Show the total session duration in seconds and the average score for each game."
},
{
"role": "assistant",
"content": "SELECT game_id, SUM(duration_seconds), AVG(score) FROM gaming_technology.game_sessions GROUP BY game_id;"
},
{
"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 gaming_technology.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time... |
[
{
"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": "List all agents and their managers' full names."
},
{
"role": "assistant",
"content": "SELECT a.first_name, a.last_name, m.first_name AS manager_first_name, m.last_name AS manager_last_name FROM insurance.agents a LEFT JOIN insurance.agents m ON a.manager_id = m.age... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, l... |
[
{
"role": "user",
"content": "Show the total maintenance cost for each vehicle."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, SUM(cost) AS total_maintenance_cost FROM transportation.maintenance_logs GROUP BY vehicle_id;"
},
{
"role": "user",
"content": "Can you also inclu... | You are an SQL statement expert. Given the table 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 patients who have a chronic diagnosis, showing their patient ID, first and last name, and the description of the diagnosis."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, d.description FROM healthcare.diagnoses d JOIN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses ( diagnosis_id text, record_id text, patient_id text, doctor_id text, diagnosis_code text, code_ty... |
[
{
"role": "user",
"content": "Show me all prescriptions, including the prescription ID, medication ID, prescription date, and the prescribing doctor's ID, for patients who have received more than 2 prescriptions."
},
{
"role": "assistant",
"content": "SELECT prescription_id, medication_id, presc... | You are an SQL statement expert. Given the table 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.prescriptions ( prescription_id text PRIMARY KEY, record_id text, patient_id text, doctor_id text, medicatio... |
[
{
"role": "user",
"content": "Show the number of users registered each month for 2024."
},
{
"role": "assistant",
"content": "SELECT\n date_trunc('month', created_at) AS month,\n COUNT(*) AS user_count\nFROM trading_platform.users\nWHERE created_at >= '2024-01-01'\n AND created_at < '2025-01-... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "Show me the top 5 assets by the number of actions logged in the trading platform, along with their types."
},
{
"role": "assistant",
"content": "SELECT a.asset_id, a.name, a.type, COUNT(l.log_id) AS action_count FROM trading_platform.assets a JOIN trading_platform.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 trading_platform.assets ( asset_id text, name text, symbol text, type text )
CREATE TABLE trading_platform.logs ( log_i... |
[
{
"role": "user",
"content": "List all properties that have at least one room on the 10th floor. Include the property name and the count of such rooms."
},
{
"role": "assistant",
"content": "SELECT p.property_name,\n COUNT(r.room_id) AS room_count\nFROM hospitality_technology.properties p\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "What is the average ROI for smart money addresses on the Ethereum chain?"
},
{
"role": "assistant",
"content": "SELECT AVG(roi) FROM smart_money_token_performance WHERE chain = 'Ethereum';"
}
] | You are an SQL statement expert. Given the table 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 ch... |
[
{
"role": "user",
"content": "List all pairs of token transfers where the sender is the same but the recipients differ. Show both transfer IDs and the common sender address."
},
{
"role": "assistant",
"content": "SELECT t1.transfer_id AS transfer_id_1, t2.transfer_id AS transfer_id_2, t1.from_ad... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.token_transfers (
transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer
token... |
[
{
"role": "user",
"content": "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": "I want to find the top 5 wallets by USD value of their ERC20 holdings. Show wallet_address, token symbol, and USD value based on the latest price."
},
{
"role": "assistant",
"content": "SELECT b.wallet_address, p.symbol, SUM(CAST(b.amount AS numeric) * p.price) AS 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 erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "List all NFT holdings from the `nft_holders` table where the `contract_type` is 'ERC721'. Show the wallet address, contract address, token ID, and amount held."
},
{
"role": "assistant",
"content": "SELECT wallet_address, contract_address, token_id, CAST(amount AS 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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "How many total appointments have been recorded?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM appointments;"
},
{
"role": "user",
"content": "What is the count of appointments that have the status 'Completed'?"
},
{
"role": "assista... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the service
... |
[
{
"role": "user",
"content": "Which cities have more than 50 customers, and what is the average customer age in each?"
},
{
"role": "assistant",
"content": "SELECT city, COUNT(*) AS customer_count, AVG(EXTRACT(YEAR FROM AGE(CURRENT_DATE, date_of_birth))) AS avg_age\nFROM financial_services.custo... | You are an SQL statement expert. Given the table 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": "List the make, model, and acquisition_date for vehicles acquired after January 1, 2022."
},
{
"role": "assistant",
"content": "SELECT make, model, acquisition_date\nFROM transportation.vehicles\nWHERE acquisition_date > '2022-01-01';"
},
{
"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.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "Show me all ERC1155 NFTs on Ethereum with their contract address, token_id, and the total amount held by all current holders."
},
{
"role": "assistant",
"content": "SELECT nh.contract_address, nh.token_id, SUM(CAST(nh.amount AS NUMERIC)) AS total_amount\nFROM nft_ho... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "List law firm names and the full name and specialization of all lawyers hired after 2020."
},
{
"role": "assistant",
"content": "SELECT T1.firm_name, T2.first_name || ' ' || T2.last_name AS lawyer_full_name, T2.specialization FROM law_firms AS T1 JOIN lawyers AS 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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "List all failed transactions where the gas_used is greater than 100,000, including the transaction_id and timestamp."
},
{
"role": "assistant",
"content": "SELECT transaction_id, timestamp FROM web3.transactions WHERE status = 'failed' AND gas_used > 100000;"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price... |
[
{
"role": "user",
"content": "Which servers are currently 'online' and located in the 'us-west-2' region, and what is the title of the game each server is hosting?"
},
{
"role": "assistant",
"content": "SELECT s.server_id, s.server_name, s.region, g.title AS game_title\nFROM gaming_technology.se... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "Get the total ERC20 balance per contract_address across all wallets from erc20_balances."
},
{
"role": "assistant",
"content": "SELECT contract_address,\n SUM(CAST(amount AS NUMERIC)) AS total_balance\nFROM erc20_balances\nGROUP BY contract_address\nORDER BY 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 erc20_balances ( block_number bigint, contract_address varchar, wallet_address varchar, amount varchar, pk varchar )
CR... |
[
{
"role": "user",
"content": "For Avalanche tokens, show me the token `tick`, `creator`, and `max_supply` from the `token_info_avalanche` table."
},
{
"role": "assistant",
"content": "SELECT tick, creator, max_supply FROM token_info_avalanche"
},
{
"role": "user",
"content": "Now, fo... | You are an SQL statement expert. Given the table 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 token transfers where the value is an even number, showing transfer ID, token ID, value, and transaction ID."
},
{
"role": "assistant",
"content": "SELECT transfer_id, token_id, value, transaction_id\nFROM web3.token_transfers\nWHERE MOD(value, 2) = 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 web3.token_transfers ( transfer_id.text, token_id.text, from_address.text, to_address.text, value.numeric, transaction_... |
[
{
"role": "user",
"content": "Show the count of users who registered in each distinct year."
},
{
"role": "assistant",
"content": "SELECT EXTRACT(YEAR FROM created_at) AS registration_year, COUNT(*) FROM web3.users GROUP BY registration_year ORDER BY registration_year;"
},
{
"role": "use... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "For each guest, calculate their total spending on delivered service orders and the total number of those orders."
},
{
"role": "assistant",
"content": "SELECT g.guest_id,\n g.first_name || ' ' || g.last_name AS full_name,\n SUM(so.total_price) AS total_s... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"role": "user",
"content": "Show the staff members who have placed service orders and the total count of orders each staff member has placed. Display their first name, last name, and the order count."
},
{
"role": "assistant",
"content": "SELECT s.first_name, s.last_name, COUNT(so.order_id) AS... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id text, property_id text, room_number text, room_type_id text, floor integer, stat... |
[
{
"role": "user",
"content": "Show me the total number of token transfers for each token symbol on the network."
},
{
"role": "assistant",
"content": "SELECT tk.token_symbol, COUNT(tt.transfer_id) AS total_transfers FROM web3.tokens tk JOIN web3.token_transfers tt ON tk.token_id = tt.token_id GR... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "Show me the average transaction amount per block, along with the block_id and the count of transactions in each block."
},
{
"role": "assistant",
"content": "SELECT block_id, AVG(amount) AS avg_amount, COUNT(*) AS transaction_count FROM blockchain.transactions GROUP... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction
... |
[
{
"role": "user",
"content": "For each user, count how many different conversations they have participated in. Show user_id and conversation_count."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(DISTINCT conversation_id) AS conversation_count\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.follows ( follow_id.text, follower_user_id.text, following_user_id.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "For each category, list all pairs of services where one is active and the other is inactive. Show the category, active service name, and inactive service name."
},
{
"role": "assistant",
"content": "SELECT a.category,\n a.service_name AS active_service,\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 government_services.services ( service_id text, agency_id text, service_name text, description text, category text, eli... |
[
{
"role": "user",
"content": "List all cryptocurrency assets that have been traded more than 50 times but have never been traded in quantities greater than 100."
},
{
"role": "assistant",
"content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) AS trade_count FROM trading_platform.asse... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timesta... |
[
{
"role": "user",
"content": "For each document, show its document id, the verification status, and the purpose of the related appointment (if any)."
},
{
"role": "assistant",
"content": "SELECT d.document_id, d.verification_status, a.purpose\nFROM government_services.documents d\nLEFT JOIN gove... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the service
... |
[
{
"role": "user",
"content": "List all wallet addresses holding NFTs for contract_address '0xABC123...' along with the token name from metadata."
},
{
"role": "assistant",
"content": "SELECT h.wallet_address, h.token_id, m.name AS token_name\nFROM nft_holders h\nJOIN nft_metadata m ON h.contract... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "List all trades that occurred on July 10, 2024, showing the trade ID, asset symbol, quantity, and trade price."
},
{
"role": "assistant",
"content": "SELECT t.trade_id, a.symbol AS asset_symbol, t.quantity, t.price\nFROM trading_platform.trades t\nJOIN trading_platf... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.trades ( trade_id character varying(64) NOT NULL, order_id character varying(64) NOT NULL, buyer_id ch... |
[
{
"role": "user",
"content": "Find all pairs of tokens that share the same token_name but have different token_symbols. Show both token IDs, the shared token_name, and each token’s symbol."
},
{
"role": "assistant",
"content": "SELECT t1.token_id AS token_id_1,\n t2.token_id AS token_id_2,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.tokens (
token_id character varying(64) NOT NULL, -- unique identifier for the token
contract_address cha... |
[
{
"role": "user",
"content": "Show me the full name and specialty of all doctors who have had at least one completed appointment."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.first_name, T1.last_name, T1.specialty FROM healthcare.doctors AS T1 JOIN healthcare.appointments 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 healthcare.doctors (
doctor_id character varying(64) NOT NULL, -- unique identifier for the doctor
first_name ... |
[
{
"role": "user",
"content": "Show all service orders with the service_id, guest's full name, and the status of each order."
},
{
"role": "assistant",
"content": "SELECT so.order_id, so.service_id, g.first_name, g.last_name, so.status\nFROM hospitality_technology.service_orders so\nJOIN hospital... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types (
room_type_id character varying(64) NOT NULL, -- unique identifier for the room ... |
[
{
"role": "user",
"content": "Show me the average smart money ROI and the total PNL for each narrative category, based on the `smart_money_token_performance` and `token_basic_info` tables."
},
{
"role": "assistant",
"content": "SELECT tbi.narrative, AVG(smp.roi) AS average_roi, SUM(smp.pnl) AS 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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "Provide each developer_id, the number of games they have released, and the total items acquired across all their games."
},
{
"role": "assistant",
"content": "SELECT g.developer_id,\n COUNT(g.game_id) AS game_count,\n SUM(pi.quantity) AS total_items_acqu... | You are an SQL statement expert. Given the table 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": "Get the earliest and latest unread notification for each recipient, including notification_ids, types, and timestamps."
},
{
"role": "assistant",
"content": "WITH earliest AS (\n SELECT recipient_user_id, MIN(created_at) AS earliest_time\n FROM social_media.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 each player's username along with the number of unique games they've played, and also include the total number of sessions for each player."
},
{
"role": "assistant",
"content": "SELECT p.player_id, p.username, COUNT(DISTINCT gs.game_id) AS unique_games_played,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "Show me all doctors whose first name contains 'an'. Return their doctor ID, full name, and hospital affiliation ID."
},
{
"role": "assistant",
"content": "SELECT doctor_id, first_name, last_name, hospital_affiliation_id\nFROM healthcare.doctors\nWHERE first_name ILI... | You are an SQL statement expert. Given the table 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": "I need a report listing each customer’s full name, the number of accounts they hold, and the date when they opened their first account."
},
{
"role": "assistant",
"content": "SELECT c.customer_id,\n c.first_name || ' ' || c.last_name AS full_name,\n COUN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"role": "user",
"content": "What are the average liquidity and price of tokens on the BSC chain?"
},
{
"role": "assistant",
"content": "SELECT AVG(liquidity) AS avg_liquidity, AVG(price) AS avg_price FROM token_dexpool_info WHERE chain = 'BSC';"
},
{
"role": "user",
"content": "Can... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexpool token_name character varying(10... |
[
{
"role": "user",
"content": "What is the average fare for bookings with status 'Completed'?"
},
{
"role": "assistant",
"content": "SELECT AVG(fare) FROM transportation.bookings WHERE status = 'Completed';"
},
{
"role": "user",
"content": "What about the average fare for '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 transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destin... |
[
{
"role": "user",
"content": "Show me all invoice numbers and due dates where the amount paid is exactly zero."
},
{
"role": "assistant",
"content": "SELECT invoice_number, due_date FROM legal_services.invoices WHERE amount_paid = 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 legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_... |
[
{
"role": "user",
"content": "Show me the wallet addresses that have both sent and received tokens in the same transaction."
},
{
"role": "assistant",
"content": "SELECT DISTINCT w.address FROM web3.wallets w JOIN web3.token_transfers tt1 ON w.address = tt1.from_address JOIN web3.token_transfers... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "Show me all achievements with their name and the total number of players who have unlocked each achievement."
},
{
"role": "assistant",
"content": "SELECT a.achievement_id, a.name, COUNT(pa.player_id) AS players_unlocked\nFROM gaming_technology.achievements a\nLEFT ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), title character varying(200) NOT NULL, devel... |
[
{
"role": "user",
"content": "For each product type, count how many of the products are currently active."
},
{
"role": "assistant",
"content": "SELECT product_type, COUNT(*) FROM insurance.insurance_products WHERE is_active = TRUE GROUP BY product_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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"role": "user",
"content": "Show me all users who have unread notifications about DApp updates, along with the notification message and DApp name."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, n.message, d.name AS dapp_name FROM trading_platform.users u JOIN trading_plat... | You are an SQL statement expert. Given the table 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": "Show me all cryptocurrency assets that have been traded more than 50 times but have never been traded in quantities greater than 100, along with their average trade price."
},
{
"role": "assistant",
"content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "List the reference_number and status for all applications assigned to employee 'emp200', along with the submitted_at date of each application."
},
{
"role": "assistant",
"content": "SELECT reference_number, status, submitted_at FROM government_services.applications ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.applications ( application_id text, citizen_id text, service_id text, submitted_at timestamp, statu... |
[
{
"role": "user",
"content": "Find beneficiaries with percentage_share above 50% for policies that have any claim with estimated_loss greater than 20000. Show beneficiary_id, first_name, last_name, and policy_id."
},
{
"role": "assistant",
"content": "SELECT pb.beneficiary_id, pb.first_name, pb.... | You are an SQL statement expert. Given the table 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 the top 5 users who have been involved in trades as both buyers and sellers, along with their email addresses and the count of trades they participated in each role."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, \n COUNT(DISTINCT CA... | You are an SQL statement expert. Given the table 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": "For each block, get the count of failed transactions and the total gas used by these failed transactions. Show block_number, failed_tx_count, and total_failed_gas."
},
{
"role": "assistant",
"content": "SELECT block_number,\n COUNT(*) FILTER (WHERE status = 'f... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "Get the list of all active insurance products along with the number of policies sold under each product and the average premium amount."
},
{
"role": "assistant",
"content": "SELECT ip.product_id, ip.product_name, COUNT(p.policy_id) AS policy_count, AVG(p.premium_am... | You are an SQL statement expert. Given the table 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": "Show me the average high price and average low price for each security sector using market data."
},
{
"role": "assistant",
"content": "SELECT T1.sector, AVG(T2.high_price) AS average_high_price, AVG(T2.low_price) AS average_low_price FROM financial_services.securit... | You are an SQL statement expert. Given the table 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 for each loan_type, the total number of loans and the average principal_amount, along with the average account balance for the accounts associated with those loans."
},
{
"role": "assistant",
"content": "SELECT l.loan_type, COUNT(l.loan_id) AS loan_count, AV... | You are an SQL statement expert. Given the table 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": "Calculate for each player the timespan between their earliest and latest achievement unlocks."
},
{
"role": "assistant",
"content": "SELECT pa_min.player_id,\n pa_max.max_time - pa_min.min_time AS span\nFROM (\n SELECT player_id,\n MIN(unlocked_at) 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.player_achievements (
player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique id... |
[
{
"role": "user",
"content": "List all prescriptions for patients whose address contains 'New York'. Show the patient's first name, last name, medication name, and prescription date."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T2.medication_name, T3.prescription_da... | You are an SQL statement expert. Given the table 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": "Give me a list of all unpaid invoices along with the first and last names of the clients and the issue date of each invoice."
},
{
"role": "assistant",
"content": "SELECT i.invoice_number, i.issue_date, c.first_name, c.last_name\nFROM legal_services.invoices i\nJOIN... | You are an SQL statement expert. Given the table 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": "Provide a count of transactions grouped by their status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) FROM web3.transactions GROUP BY status;"
},
{
"role": "user",
"content": "Now, only show the statuses that have more than 50 transacti... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id character varying(64) NOT NULL, from_address character varying(128) NOT NULL, to_add... |
[
{
"role": "user",
"content": "I need to identify customers who have two different policies that have overlapping coverage periods. List the customer_id along with the two policy_ids."
},
{
"role": "assistant",
"content": "SELECT p1.customer_id,\n p1.policy_id AS policy1_id,\n p2.poli... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c... |
[
{
"role": "user",
"content": "Show me the policy number, claim ID, document file name, and document type for all policies that have associated claim documents."
},
{
"role": "assistant",
"content": "SELECT T1.policy_number, T2.claim_id, T3.file_name, T3.document_type FROM insurance.policies AS 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.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "List all guests who have a loyalty member ID, showing their full name (first and last name), email, and loyalty ID."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email, loyalty_member_id FROM hospitality_technology.guests WHERE loyalty_member_... | You are an SQL statement expert. Given the table 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": "Show all SUI coin types with more than 6 decimals and status 'exists' in the metadata table."
},
{
"role": "assistant",
"content": "SELECT coin_type, symbol, name, decimals\nFROM sui_coins_metadata\nWHERE status = 'exists' AND decimals > 6;"
},
{
"role": "us... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"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 properties in California with a star rating above 4.0, along with their room types and base rates."
},
{
"role": "assistant",
"content": "SELECT p.property_name, p.star_rating, rt.type_name, rt.base_rate FROM hospitality_technology.properties p JOIN 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.text, property_name.text, address_line1.text, address_line2.text, city.... |
[
{
"role": "user",
"content": "List all distinct asset types from the assets table."
},
{
"role": "assistant",
"content": "SELECT DISTINCT type\nFROM trading_platform.assets;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Show me all unread notifications sent in the last 24 hours, along with the user IDs and message content, ordered by when they were sent."
},
{
"role": "assistant",
"content": "SELECT user_id, message, sent_at FROM trading_platform.notifications WHERE 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 trading_platform.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timesta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.