conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "How many users have their profiles set to private?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT user_id) AS private_user_count\nFROM social_media.user_settings\nWHERE private_profile = true;"
}
] | You are an SQL statement expert. Given the table 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 text, conversation_id text, user_id text, joined_at timestamp, ... |
[
{
"role": "user",
"content": "What are the safety ratings or crash statistics for the Boeing 787 Dreamliner?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to safety ratings or crash statistics for specific aircraft models like the Boeing 787 Dreamliner. My data is lim... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.aircraft_mod... |
[
{
"role": "user",
"content": "List developers along with the count of games they released in the 2010s (2010-2019)."
},
{
"role": "assistant",
"content": "SELECT\n d.developer_id,\n d.name,\n COUNT(g.game_id) AS games_in_2010s_count\nFROM\n gaming_technology.developers d\nJOIN\n gaming_tech... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"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": "How many employees work in each department? List the department name and the count."
},
{
"role": "assistant",
"content": "SELECT department, COUNT(*) FROM government_services.employees GROUP BY department"
},
{
"role": "user",
"content": "Only show depa... | You are an SQL statement expert. Given the table 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": "Get the total trading volume and average close_price for each data source over the last quarter."
},
{
"role": "assistant",
"content": "SELECT source,\n SUM(volume) AS total_volume,\n AVG(close_price) AS avg_close_price\nFROM financial_services.market_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 financial_services.market_data ( data_point_id bigint, security_id text, data_timestamp timestamp, open_price numeric, ... |
[
{
"role": "user",
"content": "I need a report showing the count of servers grouped by their status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) AS server_count\nFROM gaming_technology.servers\nGROUP BY status;"
},
{
"role": "user",
"content": "Actually, can you als... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.servers ( server_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, server_name chara... |
[
{
"role": "user",
"content": "Please list the agent ID, agent's name, and manager's email for all agents who have a commission_rate greater than 0.12."
},
{
"role": "assistant",
"content": "SELECT a.agent_id, a.first_name || ' ' || a.last_name AS agent_name, m.contact_email AS manager_email\nFRO... | You are an SQL statement expert. Given the table 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 all unique wallet addresses present in the system."
},
{
"role": "assistant",
"content": "SELECT DISTINCT address FROM trading_platform.wallets;"
}
] | You are an SQL statement expert. Given the table 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 patients who have both primary and non-primary insurance plans, along with their policy numbers and expiration dates."
},
{
"role": "assistant",
"content": "SELECT p1.patient_id, p1.policy_number AS primary_policy, p1.expiration_date AS primary_expiry, 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 healthcare.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.text, policy_number.text, group_numb... |
[
{
"role": "user",
"content": "List all law firms that share the same address with another firm, showing both firm names and the address."
},
{
"role": "assistant",
"content": "SELECT f1.firm_name AS firm_a, f2.firm_name AS firm_b, f1.address\nFROM law_firms f1\nJOIN law_firms f2\n ON f1.address... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms (
firm_id character varying(64) NOT NULL, -- unique identifier for the law firm
firm_... |
[
{
"role": "user",
"content": "Find all blocks mined in January 2023 with difficulty above 5000, and include the time difference from their previous block if available."
},
{
"role": "assistant",
"content": "SELECT b1.block_id, b1.timestamp, b1.difficulty, (b1.timestamp - b2.timestamp) AS time_di... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks (
block_id character varying(64) NOT NULL, -- unique identifier for the block
previous_block... |
[
{
"role": "user",
"content": "Find claims where the estimated loss is greater than the average estimated loss for claims with a status of 'Closed'. Show the claim ID, incident date, estimated loss, and status."
},
{
"role": "assistant",
"content": "SELECT claim_id, incident_date, estimated_loss,... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ... |
[
{
"role": "user",
"content": "List all drivers who have an email address but no contact number recorded in the system."
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name, email FROM transportation.drivers WHERE email IS NOT NULL AND contact_number IS NULL"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f... |
[
{
"role": "user",
"content": "Can you give me the total number of appointments grouped by status?"
},
{
"role": "assistant",
"content": "SELECT status,\n COUNT(*) AS total_appointments\nFROM healthcare.appointments\nGROUP BY status;"
},
{
"role": "user",
"content": "Filter 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 healthcare.appointments ( appointment_id text PRIMARY KEY, patient_id text, doctor_id text, appointment_time timestamp,... |
[
{
"role": "user",
"content": "Give me a daily breakdown of the total number of payments and total amount processed in the last 14 days."
},
{
"role": "assistant",
"content": "SELECT DATE(payment_timestamp) AS day, COUNT(*) AS payment_count, SUM(amount) AS total_amount\nFROM hospitality_technolog... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.payments ( payment_id text, reservation_id text, guest_id text, bill_id text, amount numeric, cu... |
[
{
"role": "user",
"content": "List all distinct plan types available in the insurance_plans table."
},
{
"role": "assistant",
"content": "SELECT DISTINCT plan_type FROM healthcare.insurance_plans;"
}
] | You are an SQL statement expert. Given the table 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 policies that have at least one beneficiary with a 'Child' relationship, showing policy number, policy status, and the number of child beneficiaries for that policy."
},
{
"role": "assistant",
"content": "SELECT T1.policy_number, T1.status, COUNT(T2.benefic... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c... |
[
{
"role": "user",
"content": "Show me all comments that are replies to other comments, along with the ID of the parent comment and the post ID."
},
{
"role": "assistant",
"content": "SELECT comment_id, parent_comment_id, post_id\nFROM social_media.comments\nWHERE parent_comment_id IS NOT NULL;"
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t... |
[
{
"role": "user",
"content": "Show me the total number of sessions and the total duration in seconds for each server, including the server name and the game title."
},
{
"role": "assistant",
"content": "SELECT\n s.server_name,\n g.game_title,\n COUNT(gs.session_id) AS total_sessions,\n SUM(g... | You are an SQL statement expert. Given the table 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, player_id.uuid, game_id.uuid, server_id.uuid, start_time.timestamptz... |
[
{
"role": "user",
"content": "For each customer, could you list their full name, email, and the combined balance of all their accounts? Please also show the number of accounts they hold."
},
{
"role": "assistant",
"content": "SELECT c.customer_id, c.first_name || ' ' || c.last_name AS full_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 text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"role": "user",
"content": "Which narratives have more than 20 tokens? Show the narrative, token number, and trend rank."
},
{
"role": "assistant",
"content": "SELECT narrative, token_num, trend_rank FROM narrative_info WHERE token_num > 20;"
},
{
"role": "user",
"content": "Add th... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative text, top_3_coins text, price_change_percentage_1h numeric, price_change_percentage_24h nume... |
[
{
"role": "user",
"content": "Find all pairs of lawyers who share the same specialization."
},
{
"role": "assistant",
"content": "SELECT l1.lawyer_id AS lawyer1_id,\n l2.lawyer_id AS lawyer2_id,\n l1.specialization\nFROM legal_services.lawyers l1\nJOIN legal_services.lawyers l2\n ON... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers (
lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer
first_n... |
[
{
"role": "user",
"content": "List all Sui NFT collections where the owner is not null, including their name and collection_type, sorted by name in ascending order."
},
{
"role": "assistant",
"content": "SELECT name, collection_type FROM sui_nfts WHERE owner IS NOT NULL ORDER BY name ASC;"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas (
block_timestamp timestamp(6) NOT NULL, -- Timestamp of the block when token metadata was recorded
... |
[
{
"role": "user",
"content": "List the first name, last name, and job title of each employee, along with the job title of their manager."
},
{
"role": "assistant",
"content": "SELECT e.first_name AS employee_first_name, e.last_name AS employee_last_name, e.job_title AS employee_job_title, m.job_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.employees (
employee_id character varying(64) NOT NULL, -- unique identifier for the government... |
[
{
"role": "user",
"content": "Can you show a list of securities with their ticker symbol, instrument type, and the total number of trades for each security?"
},
{
"role": "assistant",
"content": "SELECT s.security_id, s.ticker_symbol, s.security_type, COUNT(t.transaction_id) AS trade_count\nFROM... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"role": "user",
"content": "Count the number of trips for each route type."
},
{
"role": "assistant",
"content": "SELECT R.type, COUNT(T.trip_id) FROM transportation.trips AS T JOIN transportation.routes AS R ON T.route_id = R.route_id GROUP BY R.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 transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati... |
[
{
"role": "user",
"content": "List the name, address line 1, and city for all locations located in California."
},
{
"role": "assistant",
"content": "SELECT name, address_line1, city FROM transportation.locations WHERE state_province = '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 transportation.locations ( location_id.text, name.text, type.text, address_line1.text, city.text, state_province.text, ... |
[
{
"role": "user",
"content": "Show the first name, last name, and email for guests residing in California."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM hospitality_technology.guests WHERE state_province = 'CA'"
},
{
"role": "user",
"content": "Only ... | You are an SQL statement expert. Given the table 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 insurance products with a base premium exceeding 500, showing the product name, type, and base premium."
},
{
"role": "assistant",
"content": "SELECT product_name, product_type, base_premium FROM insurance.insurance_products WHERE base_premium > 500;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, product_name character varying(150) NOT NULL,... |
[
{
"role": "user",
"content": "Show me all reservations with their guest IDs and room IDs where the total amount is greater than $300, along with the service names and prices of any services ordered for those reservations."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, r.guest_id... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i... |
[
{
"role": "user",
"content": "For each wallet, find the next wallet created by the same user. Return the user_id, the earlier wallet_id, the later wallet_id, and the time difference in minutes between their creation times."
},
{
"role": "assistant",
"content": "SELECT user_id,\n wallet_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 web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "For each vehicle, count how many maintenance logs exist."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id, v.make, v.model, COUNT(ml.log_id) AS maintenance_log_count FROM transportation.vehicles v JOIN transportation.maintenance_logs ml ON v.vehicle_id = 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 transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "Get the count of unread messages for each conversation participant. Show user_id, conversation_id, and unread_count."
},
{
"role": "assistant",
"content": "SELECT cp.user_id,\n cp.conversation_id,\n COUNT(m.message_id) AS unread_count\nFROM social_media.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi... |
[
{
"role": "user",
"content": "Show me all chronic diagnoses along with their descriptions and the patient IDs, sorted by diagnosis date in descending order."
},
{
"role": "assistant",
"content": "SELECT patient_id, description, diagnosis_date FROM healthcare.diagnoses WHERE is_chronic = true ORD... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses ( diagnosis_id text PRIMARY KEY, record_id text, patient_id text, doctor_id text, diagnosis_code t... |
[
{
"role": "user",
"content": "For each developer, find the next developer in the same country founded after them, and show both names and their founded years."
},
{
"role": "assistant",
"content": "SELECT d1.name AS developer,\n d1.founded_year,\n (SELECT d2.name\n FROM gaming... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "I want to list all claims with their claim_id, incident_date, and the customer's full name for claims where estimated_loss is above 10000."
},
{
"role": "assistant",
"content": "SELECT cl.claim_id, cl.incident_date, c.first_name || ' ' || c.last_name AS customer_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 insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "Show me each player's last_login and the end_time of their most recent game session."
},
{
"role": "assistant",
"content": "SELECT p.player_id,\n p.username,\n p.last_login,\n gs.last_end_time\nFROM gaming_technology.players p\nLEFT JOIN (\n SELEC... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "Show the payment ID, amount, and payment method for all payments made in USD with an amount greater than 50."
},
{
"role": "assistant",
"content": "SELECT payment_id, amount, payment_method\nFROM government_services.payments\nWHERE currency = 'USD' AND amount > 50;"... | You are an SQL statement expert. Given the table 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 users who currently have a 'pending' KYC status, showing their user ID and username."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username FROM users u JOIN kyc_audit k ON u.user_id = k.user_id WHERE k.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 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 projects by valuation that completed fundraising rounds in the last 12 months, along with their token symbol and price from the token_basic_info table."
},
{
"role": "assistant",
"content": "SELECT pfr.project_name, pfr.valuation, tbi.token_symbol,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE project_fundraising_record (",
"id character varying(32) NOT NULL, -- fundraising record id",
"project_id ch... |
[
{
"role": "user",
"content": "Show me all patients who have both a primary insurance plan and at least one completed appointment, along with their insurance policy numbers and the count of appointments."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, pi.pol... | You are an SQL statement expert. Given the table 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 the license plate, make, and current status of all vehicles acquired after January 1, 2021."
},
{
"role": "assistant",
"content": "SELECT license_plate, make, status \nFROM transportation.vehicles\nWHERE acquisition_date > '2021-01-01';"
},
{
"role": "u... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "How many unique email domains are there among all registered users?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT SUBSTRING(email FROM POSITION('@' IN email)+1)) AS unique_domains FROM blockchain.users;"
},
{
"role": "user",
"content": "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 blockchain.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email character va... |
[
{
"role": "user",
"content": "Show all contracts that share the same deployment date, along with their contract IDs and the corresponding deployment date."
},
{
"role": "assistant",
"content": "SELECT a.contract_id AS contract_id_1, b.contract_id AS contract_id_2, a.deployed_at::date AS deployme... | You are an SQL statement expert. Given the table 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": "Which developers have created games that include at least one item of rarity 'Legendary'? Show the developer_id and the item_name."
},
{
"role": "assistant",
"content": "SELECT d.developer_id, igi.item_name\nFROM gaming_technology.developers d\nJOIN gaming_technolog... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "Show me the usernames of all users who have placed orders for assets that have associated metadata with the key 'network'. Also include the asset name and symbol."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, a.name AS asset_name, a.symbol\nFROM... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
CREATE ... |
[
{
"role": "user",
"content": "Show me the average transaction amount per block, along with the block_id and the count of transactions in each block."
},
{
"role": "assistant",
"content": "SELECT block_id, AVG(amount) AS avg_amount, COUNT(*) AS transaction_count FROM blockchain.transactions GROUP... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.transactions ( transaction_id text, block_id text, sender_address text, receiver_address text, amount numeri... |
[
{
"role": "user",
"content": "List pairs of distinct routes that originate from the same location but go to different destinations. Show the route ID and route number for both routes and the common origin location ID."
},
{
"role": "assistant",
"content": "SELECT\n r1.route_id AS route1_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 transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"role": "user",
"content": "Show all currently available rooms along with their room numbers and the number of times each room has been reserved."
},
{
"role": "assistant",
"content": "SELECT rm.room_id, rm.room_number, COUNT(r.reservation_id) AS reservation_count\nFROM hospitality_technology.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room... |
[
{
"role": "user",
"content": "Retrieve the first and last names of passengers along with the total sum of fares they've paid for bookings with status 'Completed', ordered by the sum descending."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, SUM(b.fare) AS total_fare\nFR... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "Find projects that have both fundraising records and basic token information. Display the project name, fundraising round name, investment value, and the token's current price."
},
{
"role": "assistant",
"content": "SELECT T1.project_name, T1.rounds_name, T1.investm... | 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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character... |
[
{
"role": "user",
"content": "Which games released on 'Xbox Series X' have at least one achievement worth more than 50 points?"
},
{
"role": "assistant",
"content": "SELECT DISTINCT g.game_id, g.title, g.release_date\nFROM gaming_technology.games g\nJOIN gaming_technology.achievements a ON g.gam... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "For each wallet address, list the total amount of UTXOs associated with it along with its wallet_id."
},
{
"role": "assistant",
"content": "SELECT w.wallet_id,\n u.address,\n SUM(u.amount) AS total_amount\nFROM trading_platform.wallets w\nJOIN trading_pl... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
CREATE ... |
[
{
"role": "user",
"content": "List the number of completed transactions and the total amount per currency."
},
{
"role": "assistant",
"content": "SELECT currency, COUNT(*) AS transaction_count, SUM(amount) AS total_amount\nFROM financial_services.transactions\nWHERE status = 'COMPLETED'\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 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 players, listing their player_id, username, and registration_date."
},
{
"role": "assistant",
"content": "SELECT player_id, username, registration_date FROM gaming_technology.players;"
},
{
"role": "user",
"content": "Filter the list to only ... | You are an SQL statement expert. Given the table 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": "特定のプラットフォームID 'plat_123' に関連するメンテナンス記録を取得するのを手伝っていただけますか?また、記録のステータスも含めてください。"
},
{
"role": "assistant",
"content": "SMEMBERS platform:plat_123:maintenance\nHGETALL maintenance_record:<record_id>"
},
{
"role": "user",
"content": "ステータスが 'Completed' の記録だけ... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// Use Hashes for ticket details. Key format: ticket:<ticket_id>
// HSET ticket:tkt_1a2b ticket_i... |
[
{
"role": "user",
"content": "Show me all premium payments where the actual payment date was after the due date. Include the payment ID, amount paid, payment date, and due date."
},
{
"role": "assistant",
"content": "SELECT payment_id, amount_paid, payment_date, due_date FROM insurance.premium_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 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 fundraising rounds where the average investment amount exceeded $10M, and show how many projects participated in each round."
},
{
"role": "assistant",
"content": "SELECT rounds_name, COUNT(DISTINCT project_id) AS project_count, AVG(investment_value) AS avg... | You are an SQL statement expert. Given the table 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": "What is the count of customers for each state where the status is 'Active' and the created_at date is within the last 3 months?"
},
{
"role": "assistant",
"content": "SELECT state, COUNT(*) as customer_count FROM financial_services.customers WHERE status = 'Active' ... | You are an SQL statement expert. Given the table 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 the earliest scheduled_departure and the latest actual_arrival for each route_id."
},
{
"role": "assistant",
"content": "SELECT route_id, MIN(scheduled_departure) AS earliest_scheduled_departure, MAX(actual_arrival) AS latest_actual_arrival FROM transportation.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips ( trip_id text, route_id text, vehicle_id text, driver_id text, scheduled_departure timestamp, act... |
[
{
"role": "user",
"content": "List each user ID along with the total count of log entries and the total count of notifications associated with them."
},
{
"role": "assistant",
"content": "SELECT COALESCE(T1.user_id, T2.user_id) AS user_id, COUNT(DISTINCT T1.log_id) AS log_count, COUNT(DISTINCT T... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
CREATE ... |
[
{
"role": "user",
"content": "Count the total number of distinct specialties listed in the doctors table."
},
{
"role": "assistant",
"content": "SELECT count(DISTINCT specialty) FROM healthcare.doctors;"
}
] | You are an SQL statement expert. Given the table 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": "List all pairs of drivers who share the same hire_date, showing both driver IDs, first and last names, and the hire_date."
},
{
"role": "assistant",
"content": "SELECT d1.driver_id AS driver1_id,\n d1.first_name AS driver1_first_name,\n d1.last_name 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 transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens... |
[
{
"role": "user",
"content": "Show each user ID with the date of their first created wallet."
},
{
"role": "assistant",
"content": "SELECT user_id, MIN(created_at) AS first_wallet_date\nFROM trading_platform.wallets\nGROUP BY 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 trading_platform.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timesta... |
[
{
"role": "user",
"content": "List the first name, last name, and job title for all employees, along with the name of the agency they belong to."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T1.job_title, T2.agency_name FROM employees AS T1 JOIN agencies AS T2 ON 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 government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "How many users have verified profiles and private profiles enabled?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) \nFROM social_media.users u\nJOIN social_media.user_settings s ON u.user_id = s.user_id\nWHERE u.is_verified = true AND s.private_profile = tru... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "List the agency name, location name, address, and contact phone for all accessible service locations in the city of 'Seattle'."
},
{
"role": "assistant",
"content": "SELECT t1.agency_name, t2.location_name, t2.address, t2.contact_phone FROM government_services.agenc... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Show me the average, maximum, and minimum points for all achievements."
},
{
"role": "assistant",
"content": "SELECT AVG(points) AS average_points, MAX(points) AS maximum_points, MIN(points) AS minimum_points FROM gaming_technology.achievements;"
},
{
"role"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date... |
[
{
"role": "user",
"content": "List all players along with the number of game sessions they have started."
},
{
"role": "assistant",
"content": "SELECT p.username, COUNT(gs.session_id) AS session_count FROM gaming_technology.players p LEFT JOIN gaming_technology.game_sessions gs ON p.player_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 gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "Show me claim_id, incident_date, policy_number, and customer full name for all claims where settlement_amount is null."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.incident_date, p.policy_number, cu.first_name || ' ' || cu.last_name AS customer_full_n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "Show me all service orders for spa services (service_id LIKE 'SPA%') with their guest names and the staff who delivered the service, ordered by delivery timestamp."
},
{
"role": "assistant",
"content": "SELECT g.first_name, g.last_name, s.staff_id_delivered, so.deli... | You are an SQL statement expert. Given the table 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": "Find cases where an address received tokens in one transfer and then sent tokens in another. List the receive transfer_id, the send transfer_id, the address, and both transfer values."
},
{
"role": "assistant",
"content": "SELECT recv.transfer_id AS receive_transfer... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.token_transfers (
transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer
token... |
[
{
"role": "user",
"content": "Show all trades that occurred after '2024-06-01', including the trade ID, quantity, price, and the name and symbol of the asset traded."
},
{
"role": "assistant",
"content": "SELECT t.trade_id, t.quantity, t.price, a.name AS asset_name, a.symbol AS asset_symbol 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 trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "Could you produce a summary report listing each security's ticker_symbol, exchange, average close_price, and average volume based on market_data?"
},
{
"role": "assistant",
"content": "SELECT s.ticker_symbol, s.exchange, AVG(m.close_price) AS avg_close_price, AVG(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 financial_services.transactions ( transaction_id character varying(64) NOT NULL, account_id character varying(64) NOT N... |
[
{
"role": "user",
"content": "List prescription ID, medication ID, and the record ID for all prescriptions linked to medical records where the chief complaint contains 'cough'."
},
{
"role": "assistant",
"content": "SELECT T1.prescription_id, T1.medication_id, T1.record_id FROM healthcare.prescr... | You are an SQL statement expert. Given the table 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": "For each guest, calculate their average total price per order, and show the number of orders they have placed."
},
{
"role": "assistant",
"content": "SELECT guest_id, AVG(total_price) AS avg_total_price, COUNT(*) AS order_count FROM hospitality_technology.service_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 hospitality_technology.service_orders ( order_id text PRIMARY KEY, reservation_id text, guest_id text, service_id text,... |
[
{
"role": "user",
"content": "For each service category, show the category and the number of distinct citizens who have scheduled at least one appointment for a service in that category. Order the results by the number of citizens in descending order."
},
{
"role": "assistant",
"content": "SELEC... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "List all players who have never added any item to their inventory, showing their player_id and username."
},
{
"role": "assistant",
"content": "SELECT p.player_id, p.username\nFROM gaming_technology.players p\nLEFT JOIN gaming_technology.player_inventory pi ON p.pla... | You are an SQL statement expert. Given the table 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": "Count the total number of users who have enabled email notifications but disabled push notifications."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.user_settings WHERE email_notifications_enabled = TRUE AND push_notifications_enabled = FAL... | You are an SQL statement expert. Given the table 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": "For each narrative in smart_money_token_inflow, calculate the total usd_value and avg_price from buy transactions (type=1) and include the narrative's token count from narrative_info. Show narrative, chain, total_usd_value, avg_price, and token_num, ordered by total_usd_value 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_basic_info ( coin_id character varying(100) NOT NULL, -- the id of the token token_name character varying(100) NO... |
[
{
"role": "user",
"content": "Could you list each player and the title of the games for which they have acquired items?"
},
{
"role": "assistant",
"content": "SELECT DISTINCT pi.player_id, g.title FROM gaming_technology.player_inventory pi JOIN gaming_technology.games g ON pi.item_id = g.game_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 gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date... |
[
{
"role": "user",
"content": "Which exchanges hold the highest total USD value of tokens on the Ethereum chain, and what are their top 3 tokens by USD value?"
},
{
"role": "assistant",
"content": "SELECT exchange, token_symbol, usd_value FROM (SELECT exchange, token_symbol, usd_value, ROW_NUMBER... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE cex_token_balance ( snapshot_time text, chain text, address text, exchange text, token_address text, token_symbol text,... |
[
{
"role": "user",
"content": "Show me the earliest created smart contract for each creator address."
},
{
"role": "assistant",
"content": "SELECT DISTINCT ON (creator_address) creator_address, contract_id, timestamp\nFROM blockchain.smart_contracts\nORDER BY creator_address, timestamp ASC;"
},... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.smart_contracts ( contract_id text, creator_address text, code text, timestamp timestamp )
|
[
{
"role": "user",
"content": "Can you list the number of citizens registered each month in 2024? Please show the month and the citizen count."
},
{
"role": "assistant",
"content": "SELECT TO_CHAR(registration_date, 'YYYY-MM') AS registration_month, COUNT(*) AS citizen_count FROM government_servi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "Show me the full names of users and the total number of likes they have given to comments."
},
{
"role": "assistant",
"content": "SELECT u.full_name, COUNT(l.like_id) AS likes_given_to_comments\nFROM social_media.users u\nJOIN social_media.likes l ON u.user_id = l.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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "List each driver's first name, last name, and hire_date."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, hire_date\nFROM transportation.drivers;"
},
{
"role": "user",
"content": "Now include the number of drivers hired on the same 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 transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens... |
[
{
"role": "user",
"content": "Show me all customers who have missing contact information (either phone number or email is null), along with their state and city."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, state, city FROM insurance.customers WHERE phone_number IS NULL O... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "Count how many achievements were unlocked on each calendar day. Show the date and the count."
},
{
"role": "assistant",
"content": "SELECT DATE(unlocked_at) AS unlock_date, COUNT(*) AS achievement_count FROM gaming_technology.player_achievements GROUP BY unlock_date... | You are an SQL statement expert. Given the table 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 smart contracts created by addresses that have created more than 3 contracts, along with the count of contracts each creator has made."
},
{
"role": "assistant",
"content": "SELECT creator_address, COUNT(*) AS contract_count FROM blockchain.smart_contrac... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.smart_contracts ( contract_id text PRIMARY KEY, creator_address text, code text, timestamp timestamp )
|
[
{
"role": "user",
"content": "List each achievement with the very next achievement unlocked by the same player using a self-join. Show player_id, current_ach, current_unlocked_at, next_ach, and next_unlocked_at."
},
{
"role": "assistant",
"content": "SELECT pa1.player_id,\n pa1.achievement... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid, player_id uuid, achievement_id uuid, unlocked_at ti... |
[
{
"role": "user",
"content": "List pairs of documents uploaded by the same user for the same claim. Return uploaded_by, claim_id, document_id AS doc1_id, and the paired document_id AS doc2_id."
},
{
"role": "assistant",
"content": "SELECT cd1.uploaded_by,\n cd1.claim_id,\n cd1.docume... | You are an SQL statement expert. Given the table 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": "Find pairs of securities that belong to the same sector but have a different security type. Display the ticker symbol, security name, security type, and sector for both securities in each pair."
},
{
"role": "assistant",
"content": "SELECT a.ticker_symbol, a.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.securities ( security_id.text, ticker_symbol.text, isin_code.text, cusip_code.text, security_name.te... |
[
{
"role": "user",
"content": "List the full names of customers along with the count of their active policies, but only include those customers with at least 3 active policies."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, COUNT(p.policy_id) AS active_policy_count\nFROM... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE 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 the document ID, file name, document type, and the status of the claim it belongs to, for all documents uploaded by agents whose license state is 'NY'."
},
{
"role": "assistant",
"content": "SELECT cd.document_id, cd.file_name, cd.document_type, c.status 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.claim_documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"role": "user",
"content": "Show me all unique player IDs who have at least one item in their inventory with a quantity greater than 10."
},
{
"role": "assistant",
"content": "SELECT DISTINCT player_id FROM gaming_technology.player_inventory WHERE quantity > 10;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid, player_id uuid, item_id uuid, quantity integer, acquired_at tim... |
[
{
"role": "user",
"content": "Show me all game sessions that do not have a score recorded. List the session_id, player_id, game_id, and start_time."
},
{
"role": "assistant",
"content": "SELECT session_id, player_id, game_id, start_time FROM gaming_technology.game_sessions WHERE score 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 gaming_technology.game_sessions ( session_id uuid, player_id uuid, game_id uuid, server_id uuid, start_time timestamp w... |
[
{
"role": "user",
"content": "List all failed payments with their details."
},
{
"role": "assistant",
"content": "SELECT payment_id, application_id, citizen_id, service_id, amount, currency, payment_method, payment_provider_reference, payment_timestamp, status, notes FROM government_services.pay... | You are an SQL statement expert. Given the table 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.payments ( payment_id.text, application_id.text, citizen_id.text, service_id.text, amount.numeric, ... |
[
{
"role": "user",
"content": "Show me the total count of 'approval for all' events for each ERC1155 collection on Ethereum. I need contract_address, collection name, and approval_count, sorted by approval_count descending."
},
{
"role": "assistant",
"content": "SELECT e.contract_address,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "List the username, registration date, and address of all users who have created a wallet."
},
{
"role": "assistant",
"content": "SELECT u.username, u.created_at AS registration_date, w.address AS wallet_address\nFROM web3.users u\nJOIN web3.wallets w ON u.user_id = ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.