conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "What is the reason behind the cost variation for maintenance of asset_id 'ASSET456' over the past year?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the reasons behind cost variations for maintenance. The data in the maintenan... | 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 train_station_management.m... |
[
{
"role": "user",
"content": "Show me all reservations with more than 2 adults that are confirmed (status = 'Confirmed'), including their check-in dates and total amounts, along with the guest's first and last name."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, r.check_in_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 hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i... |
[
{
"role": "user",
"content": "Show me all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and amount."
},
{
"role": "assistant",
"content": "SELECT wallet_address, token_id, amount FROM nft_holders WHERE contract_type = 'ERC1155' AND CAST(amount AS decimal... | You are an SQL statement expert. Given the table 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": "Show all claims along with the total percentage share of beneficiaries for the related policy. Include claim_id, policy_id, incident_date, and total_share."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.policy_id, c.incident_date, SUM(pb.percentage_shar... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara... |
[
{
"role": "user",
"content": "Find the total quantity dispensed and the number of refills allowed for each dosage type."
},
{
"role": "assistant",
"content": "SELECT dosage, SUM(quantity_dispensed) AS total_quantity_dispensed, SUM(refills_allowed) AS total_refills_allowed FROM healthcare.prescri... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, record_id character varying(64) NOT NULL, pa... |
[
{
"role": "user",
"content": "Show all reservations where the check_out_date is before today and status is 'Confirmed'."
},
{
"role": "assistant",
"content": "SELECT reservation_id,\n guest_id,\n check_out_date\nFROM hospitality_technology.reservations\nWHERE check_out_date < CURRENT... | You are an SQL statement expert. Given the table 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.reservations ( reservation_id text PRIMARY KEY, property_id text, guest_id text, room_id text, r... |
[
{
"role": "user",
"content": "Show me all claims handled by agents who were hired in the last 3 years, along with the agent's full name and agency."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.policy_id, c.incident_date, c.status, CONCAT(a.first_name, ' ', a.last_name) AS agent_na... | You are an SQL statement expert. Given the table 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": "Show all notifications of type 'comment' with the content of the corresponding comment and the author's username."
},
{
"role": "assistant",
"content": "SELECT n.notification_id,\n n.recipient_user_id,\n c.content AS comment_content,\n u.username\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "For block '0xbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeefbeef', what is its timestamp and difficulty, and what is the timestamp and difficulty of its previous block?"
},
{
"role": "assistant",
"content": "SELECT t1.timestamp AS current_block_timestam... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonc... |
[
{
"role": "user",
"content": "Count the total number of employees who have a direct manager assigned."
},
{
"role": "assistant",
"content": "SELECT COUNT(employee_id) FROM government_services.employees WHERE manager_employee_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 government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth... |
[
{
"role": "user",
"content": "List all hashtags that have never been associated with any post, showing hashtag_id and tag_name."
},
{
"role": "assistant",
"content": "SELECT h.hashtag_id, h.tag_name\nFROM social_media.hashtags h\nLEFT JOIN social_media.post_hashtags ph ON h.hashtag_id = ph.hasht... | You are an SQL statement expert. Given the table 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": "Find all assets that have metadata linking them to a DApp (where metadata value is a DApp ID), showing asset name, symbol, and the linked DApp name. Assume the metadata key used is 'linked_dapp_id'."
},
{
"role": "assistant",
"content": "SELECT a.name AS asset_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 trading_platform.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address ch... |
[
{
"role": "user",
"content": "Show me all premium payments made via credit card in the last 30 days, along with their policy IDs and payment amounts, sorted by payment date in descending order."
},
{
"role": "assistant",
"content": "SELECT policy_id, amount_paid, payment_date FROM insurance.prem... | You are an SQL statement expert. Given the table 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.premium_payments ( payment_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, custo... |
[
{
"role": "user",
"content": "Please list the first name, last name, and date of birth for all female patients who were created in the year 2023."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, date_of_birth FROM healthcare.patients WHERE gender = 'Female' AND created_at >= ... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "Please provide the passenger_id, first_name, last_name, booking_id, and booking_time for all bookings where seat_number is 'A1'."
},
{
"role": "assistant",
"content": "SELECT p.passenger_id, p.first_name, p.last_name, b.booking_id, b.booking_time\nFROM transportatio... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text... |
[
{
"role": "user",
"content": "Show me claims handled by agents whose commission rate is greater than 0.1, including the claim ID, incident date, and estimated loss."
},
{
"role": "assistant",
"content": "SELECT T1.claim_id, T1.incident_date, T1.estimated_loss FROM insurance.claims AS T1 JOIN ins... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d... |
[
{
"role": "user",
"content": "For each game, can you show the total number of players who have unlocked at least one achievement in that game, as well as the game's genre?"
},
{
"role": "assistant",
"content": "SELECT g.game_id, g.title, g.genre, COUNT(DISTINCT pa.player_id) AS player_count\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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "Find the top 5 ERC20 tokens by number of approval events in `erc20_approval`. Show `contract_address`, `symbol`, and `total_approvals`."
},
{
"role": "assistant",
"content": "SELECT ea.contract_address,\n tm.symbol,\n COUNT(*) AS total_approvals\nFROM er... | You are an SQL statement expert. Given the table 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": "Find all transactions where the from_address is the same as the to_address, indicating self-transactions, and show the transaction_id, value, and gas_used."
},
{
"role": "assistant",
"content": "SELECT transaction_id, value, gas_used FROM web3.transactions WHERE fro... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction
fr... |
[
{
"role": "user",
"content": "For each policy, find the latest payment date. Show the policy_id and the maximum payment_date."
},
{
"role": "assistant",
"content": "SELECT policy_id, MAX(payment_date) AS latest_payment_date FROM insurance.premium_payments GROUP BY policy_id;"
},
{
"role"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_id text, payment_date timestamp, amo... |
[
{
"role": "user",
"content": "For each security, find any other security within the same sector that has a later last_updated timestamp. Return a.ticker_symbol, b.ticker_symbol, and b.last_updated."
},
{
"role": "assistant",
"content": "SELECT a.ticker_symbol AS symbol_a, b.ticker_symbol AS symb... | You are an SQL statement expert. Given the table 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": "For each customer, calculate the average number of days between their consecutive premium payments."
},
{
"role": "assistant",
"content": "SELECT t.customer_id,\n AVG(t.days_diff) AS avg_days_between\nFROM (\n SELECT p1.customer_id,\n EXTRACT(DAY 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 insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_id text, payment_date timestamp, amo... |
[
{
"role": "user",
"content": "List all active staff members (is_active = true) along with their position and hire date, ordered by hire date from newest to oldest."
},
{
"role": "assistant",
"content": "SELECT staff_id, first_name, last_name, position, hire_date FROM hospitality_technology.staff... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room... |
[
{
"role": "user",
"content": "List the doctor ID, last name, and the date they were updated, for all doctors updated in the year 2024."
},
{
"role": "assistant",
"content": "SELECT doctor_id, last_name, updated_at FROM healthcare.doctors WHERE updated_at >= '2024-01-01' AND updated_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 healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch... |
[
{
"role": "user",
"content": "Which room types have a base rate above 250 USD, and what are their maximum occupancies?"
},
{
"role": "assistant",
"content": "SELECT room_type_id, type_name, base_rate, max_occupancy\nFROM hospitality_technology.room_types\nWHERE base_rate > 250;"
},
{
"ro... | You are an SQL statement expert. Given the table 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": "What is the average age of customers created in the last year?"
},
{
"role": "assistant",
"content": "SELECT AVG(DATE_PART('year', CURRENT_DATE) - DATE_PART('year', date_of_birth)) FROM financial_services.customers WHERE created_at >= CURRENT_DATE - INTERVAL '1 year... | You are an SQL statement expert. Given the table 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": "For each medical record, display the record date, doctor full name, and medication name for any prescription linked to that record."
},
{
"role": "assistant",
"content": "SELECT mr.record_date, d.first_name || ' ' || d.last_name AS doctor_full_name, m.medication_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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "What is the total market cap for all tokens listed on the 'Polygon' chain?"
},
{
"role": "assistant",
"content": "SELECT SUM(market_cap) FROM token_dexpool_info WHERE chain = 'Polygon';"
},
{
"role": "user",
"content": "Only sum the market cap for tokens... | You are an SQL statement expert. Given the table 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": "List all cryptocurrency assets that have been traded more than 50 times but have an average trade quantity less than 10."
},
{
"role": "assistant",
"content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) AS trade_count, AVG(t.quantity) AS avg_quantity 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 trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "Show me all completed trips with their driver's full name and the route description, ordered by actual arrival time in descending order."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, CONCAT(d.first_name, ' ', d.last_name) AS driver_name, r.description AS ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ... |
[
{
"role": "user",
"content": "What is the total payment amount for each currency recorded in the payments table?"
},
{
"role": "assistant",
"content": "SELECT currency , sum(amount) FROM government_services.payments GROUP BY currency"
},
{
"role": "user",
"content": "Now, only show ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Show me all electric vehicles along with their depot location details, including the depot's timezone."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id, v.make, v.model, v.year, l.name AS depot_name, l.city, l.timezone FROM transportation.vehicles v JOIN 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 transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text... |
[
{
"role": "user",
"content": "Find projects from the project_fundraising_record table that have completed both a 'Seed' fundraising round and a 'Series A' fundraising round."
},
{
"role": "assistant",
"content": "SELECT pf_seed.project_name FROM project_fundraising_record pf_seed JOIN project_fu... | You are an SQL statement expert. Given the table 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": "Show all token symbols along with the names of any other tokens on the same contract address."
},
{
"role": "assistant",
"content": "SELECT t1.token_symbol, t2.token_name AS other_token_name, t1.contract_address\nFROM web3.tokens t1\nJOIN web3.tokens t2\n ON t1.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 web3.tokens (
token_id character varying(64) NOT NULL, -- unique identifier for the token
contract_address cha... |
[
{
"role": "user",
"content": "List all users whose email contains the word 'block', along with their username and registration timestamp."
},
{
"role": "assistant",
"content": "SELECT user_id, username, email, created_at\nFROM web3.users\nWHERE email ILIKE '%block%';"
},
{
"role": "user"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
|
[
{
"role": "user",
"content": "For each doctor, show the doctor ID and the latest record date among all medical records they created."
},
{
"role": "assistant",
"content": "SELECT doctor_id, MAX(record_date) AS latest_record_date\nFROM healthcare.medical_records\nGROUP BY doctor_id;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "Show the number of delivered service orders for each unique status value."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) AS delivered_order_count\nFROM hospitality_technology.service_orders\nWHERE staff_id_delivered IS NOT NULL\nGROUP BY status;"
}... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.service_orders ( order_id.text, reservation_id.text, guest_id.text, service_id.text, staff_id_or... |
[
{
"role": "user",
"content": "Find all documents that have a description and list their document ID, file name, and description."
},
{
"role": "assistant",
"content": "SELECT document_id, file_name, description FROM insurance.claim_documents WHERE description IS NOT NULL AND description != '';"
... | You are an SQL statement expert. Given the table 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": "List all drivers who have operated trips using Electric vehicles. Include driver ID, full name, and the number of Electric trips they've operated."
},
{
"role": "assistant",
"content": "SELECT d.driver_id, d.first_name || ' ' || d.last_name AS full_name, COUNT(*) AS... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "Provide a list of all unique genders present in the citizens table."
},
{
"role": "assistant",
"content": "SELECT DISTINCT gender FROM government_services.citizens;"
},
{
"role": "user",
"content": "How many citizens belong to each 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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Give me a list of employees (first and last name) along with the count of appointments they have scheduled."
},
{
"role": "assistant",
"content": "SELECT e.first_name, e.last_name, COUNT(a.appointment_id) AS appointment_count\nFROM government_services.employees e\nL... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth... |
[
{
"role": "user",
"content": "Show the names and phone numbers of all law firms whose website ends with '.org'."
},
{
"role": "assistant",
"content": "SELECT firm_name, phone\nFROM legal_services.law_firms\nWHERE website LIKE '%.org';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms ( firm_id text PRIMARY KEY, firm_name text, address text, phone text, website text, founded_da... |
[
{
"role": "user",
"content": "I want to list all insurance plans along with the number of medical records that have a record_date in 2024. Display plan_id, plan_name, and the total medical records."
},
{
"role": "assistant",
"content": "SELECT ip.plan_id, ip.plan_name, COUNT(mr.record_id) AS tot... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "Show me the top 5 users by the total number of trades they participated in as sellers, along with their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT t.seller_id, w.address, COUNT(t.trade_id) AS total_trades FROM trading_platform.trades t JOIN trad... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address ch... |
[
{
"role": "user",
"content": "For each user, how many wallets have they created?"
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(*) AS wallet_count FROM trading_platform.wallets GROUP BY user_id;"
},
{
"role": "user",
"content": "Actually, I want to see only users with 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 trading_platform.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "For each vehicle that has both maintenance and fuel log records, show the vehicle_id, make, model, count of maintenance_logs as maintenance_count, and count of fuel_logs as fuel_count."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id, v.make, v.model,\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.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "Which users have commented on posts created by the users they follow? Please show the commenter user_ids and the followed user_ids."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.user_id AS commenter_user_id, f.following_user_id AS followed_user_id FROM so... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ... |
[
{
"role": "user",
"content": "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 developers founded before 2010 along with the number of games they have created."
},
{
"role": "assistant",
"content": "SELECT d.name, d.founded_year, COUNT(g.game_id) AS total_games\nFROM gaming_technology.developers d\nLEFT JOIN gaming_technology.games 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.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea... |
[
{
"role": "user",
"content": "For each achievement, show its name, the game_id it belongs to, and the number of distinct players who have played a session for that game."
},
{
"role": "assistant",
"content": "SELECT a.name, a.game_id, COUNT(DISTINCT gs.player_id) AS players_with_sessions\nFROM 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.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "Count the number of medical records created for each doctor, and list the doctor_id alongside their record count."
},
{
"role": "assistant",
"content": "SELECT doctor_id, COUNT(*) AS record_count FROM healthcare.medical_records GROUP BY doctor_id;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records ( record_id text PRIMARY KEY, patient_id text, appointment_id text, doctor_id text, record_d... |
[
{
"role": "user",
"content": "List each doctor and the total number of unique patients for appointments that have been completed. Return doctor_id, first_name, last_name, and patient_count."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id,\n d.first_name,\n d.last_name,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number... |
[
{
"role": "user",
"content": "List the first name and last name of employees who have verified documents, along with the document type they verified and the verification status."
},
{
"role": "assistant",
"content": "SELECT e.first_name, e.last_name, d.document_type, d.verification_status FROM 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 government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth... |
[
{
"role": "user",
"content": "Show the total payment amount and number of payments processed by each staff member, including their full names."
},
{
"role": "assistant",
"content": "SELECT st.staff_id, st.first_name, st.last_name, COUNT(p.payment_id) AS payment_count, SUM(p.amount) AS total_amou... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id.text, first_name.text, last_name.text, email.text, phone_number.text, date_of_... |
[
{
"role": "user",
"content": "Show me the total transaction amount by transaction_type for all transactions processed by employees in the 'Trading' department, along with their department name."
},
{
"role": "assistant",
"content": "SELECT t.transaction_type, SUM(t.amount) AS total_amount, e.dep... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the trans... |
[
{
"role": "user",
"content": "Show me all medical records where the treatment_plan includes 'physical therapy' along with the patient_id and record_date, sorted by most recent first."
},
{
"role": "assistant",
"content": "SELECT patient_id, record_date, treatment_plan FROM healthcare.medical_rec... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "Show the booking ID, first and last name of the passenger, and the status of each booking."
},
{
"role": "assistant",
"content": "SELECT b.booking_id, p.first_name, p.last_name, b.status\nFROM transportation.bookings b\nJOIN transportation.passengers p ON b.passenge... | You are an SQL statement expert. Given the table 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": "For each claim, show the claim ID, policy ID, and the product name of the insurance product that applies to the policy."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.policy_id, ip.product_name FROM insurance.claims c JOIN insurance.insurance_products 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 insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ... |
[
{
"role": "user",
"content": "Show me all trips that were delayed by more than 30 minutes, including their vehicle_id, driver_id, and the delay time in minutes."
},
{
"role": "assistant",
"content": "SELECT trip_id, vehicle_id, driver_id, EXTRACT(EPOCH FROM (actual_departure - scheduled_departur... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var... |
[
{
"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": "Show me all patients who have scheduled appointments with doctors specializing in Cardiology, along with their appointment times and the doctors' full names."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, a.appointment_time, 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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "I need to find the average maintenance cost per service type."
},
{
"role": "assistant",
"content": "SELECT service_type, AVG(cost) AS avg_cost\nFROM transportation.maintenance_logs\nGROUP BY service_type;"
},
{
"role": "user",
"content": "Can you filter... | You are an SQL statement expert. Given the table 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": "Show the document ID, file name, and the first 100 characters of the description for claim documents that have a description."
},
{
"role": "assistant",
"content": "SELECT document_id, file_name, SUBSTRING(description FROM 1 FOR 100) FROM insurance.claim_documents 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 insurance.claim_documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"role": "user",
"content": "List all sender and receiver address pairs that have exchanged more than 2 transactions with each other, along with the total amount transferred between them."
},
{
"role": "assistant",
"content": "SELECT sender_address, receiver_address, COUNT(*) AS transaction_cou... | You are an SQL statement expert. Given the table 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": "Show me all patients who have received at least two different medications prescribed by doctors working at the same hospital. Include the patient full name, the medication names, and the shared hospital_affiliation_id."
},
{
"role": "assistant",
"content": "SELECT 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 healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "For each security exchange, what is the average daily high price and the total volume recorded in market data for securities listed on that exchange over the past 6 months? Include the exchange name."
},
{
"role": "assistant",
"content": "SELECT T2.exchange, AVG(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 financial_services.market_data (
data_point_id bigserial NOT NULL, -- auto-incrementing primary key
security_id... |
[
{
"role": "user",
"content": "For each customer, show their full name, email, and the total trade amount they have made, joining customers to trades via account_id."
},
{
"role": "assistant",
"content": "SELECT c.customer_id, c.first_name, c.last_name, c.email, SUM(t.total_amount) AS total_trade... | You are an SQL statement expert. Given the table 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 all invoices that were paid within 7 days of their issue date. Show invoice number, issue date, payment date, and total amount."
},
{
"role": "assistant",
"content": "SELECT invoice_number, issue_date, payment_date, total_amount FROM legal_services.invoices WHE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph... |
[
{
"role": "user",
"content": "For each employee, retrieve their full name and the number of appointments scheduled for them in the next 7 days, including employees with no appointments."
},
{
"role": "assistant",
"content": "SELECT e.first_name || ' ' || e.last_name AS full_name,\n COUNT(a... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_e... |
[
{
"role": "user",
"content": "List each narrative along with the token that has the highest current price and the token that has the lowest current price from the token_basic_info table."
},
{
"role": "assistant",
"content": "WITH ranked_high AS (\n SELECT narrative, token_symbol, price,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri... |
[
{
"role": "user",
"content": "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": "For each player, count the total number of achievements they've unlocked."
},
{
"role": "assistant",
"content": "SELECT player_id,\n COUNT(*) AS total_achievements\nFROM gaming_technology.player_achievements\nGROUP BY player_id;"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_achievements (
player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique id... |
[
{
"role": "user",
"content": "List all policy beneficiaries with their relationship and the date they were added, ordered by added_at descending."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, relationship, added_at\nFROM insurance.policy_beneficiaries\nORDER BY added_at DE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "Provide a count of players for each registered country."
},
{
"role": "assistant",
"content": "SELECT country_code, COUNT(*) FROM gaming_technology.players GROUP BY country_code;"
},
{
"role": "user",
"content": "Filter the results to only show countries... | You are an SQL statement expert. Given the table 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 me the top 3 tokens by USD value inflow where smart money was buying (type = 1), along with their token symbol and narrative."
},
{
"role": "assistant",
"content": "SELECT token_symbol, narrative, usd_value FROM smart_money_token_inflow WHERE type = 1 ORDER BY ... | You are an SQL statement expert. Given the table 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 the product_id and product_name for insurance products that are not currently active."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name FROM insurance.insurance_products WHERE is_active = FALSE;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
[
{
"role": "user",
"content": "List the IDs of citizens who have received notifications related to more than one distinct type of entity."
},
{
"role": "assistant",
"content": "SELECT citizen_id FROM government_services.notifications WHERE related_entity_type IS NOT NULL AND related_entity_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 government_services.notifications ( notification_id text PRIMARY KEY, citizen_id text, application_id text, message_sub... |
[
{
"role": "user",
"content": "Show me all premium payments made via credit card in the last 30 days, along with their policy IDs and payment amounts."
},
{
"role": "assistant",
"content": "SELECT payment_id, policy_id, amount_paid FROM insurance.premium_payments WHERE payment_method = 'credit_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 insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_id text, payment_date timestamp, amo... |
[
{
"role": "user",
"content": "Show me all passengers who have made more than 3 bookings, along with their total fare spent and booking count."
},
{
"role": "assistant",
"content": "SELECT p.passenger_id, p.first_name, p.last_name, COUNT(b.booking_id) AS booking_count, SUM(b.fare) AS total_fare F... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var... |
[
{
"role": "user",
"content": "List all pairs of active services in the same category where one service’s standard fee is higher than the other’s. Display the category, the higher-fee service name with its fee, and the lower-fee service name with its fee."
},
{
"role": "assistant",
"content": "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 government_services.services ( service_id text, agency_id text, service_name text, description text, category text, eli... |
[
{
"role": "user",
"content": "List the user ID, username, and wallet address for all users who have at least one unspent UTXO associated with any of their wallets."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.user_id, T1.username, T2.address FROM trading_platform.users AS T1 JOIN tr... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Show me all appointments that have both a non-null location and notes, along with their appointment_id, client_id, lawyer_id, and start_time."
},
{
"role": "assistant",
"content": "SELECT appointment_id, client_id, lawyer_id, start_time FROM legal_services.appointme... | You are an SQL statement expert. Given the table 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.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ... |
[
{
"role": "user",
"content": "List all securities (security_id, ticker_symbol, security_name) that have a currency of 'EUR' and were last updated within the last 30 days, along with their exchange and sector information."
},
{
"role": "assistant",
"content": "SELECT security_id, ticker_symbol, 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 financial_services.securities (
security_id character varying(64) NOT NULL, -- unique identifier for the security
... |
[
{
"role": "user",
"content": "Show me all policies that expired in the last 60 days, along with their product IDs and premium amounts."
},
{
"role": "assistant",
"content": "SELECT policy_id, product_id, premium_amount, end_date FROM insurance.policies WHERE status = 'expired' AND end_date >= CU... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ... |
[
{
"role": "user",
"content": "List all reservations made by guests from 'US', showing the reservation ID, guest first name, last name, and the property name."
},
{
"role": "assistant",
"content": "SELECT T1.reservation_id, T2.first_name, T2.last_name, T3.property_name FROM hospitality_technology... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "List all users who have followed someone and also left a comment on any of their posts. Show the follower's user_id, the followed user's user_id, and the comment_id."
},
{
"role": "assistant",
"content": "SELECT DISTINCT f.follower_user_id, f.following_user_id, c.co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "For each sector, could you show the sum of volume and the average close price from market_data, including the sector name?"
},
{
"role": "assistant",
"content": "SELECT s.sector, SUM(md.volume) AS total_volume, AVG(md.close_price) AS avg_close_price\nFROM financial_... | You are an SQL statement expert. Given the table 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": "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": "List the usernames and user IDs of all users whose bio contains the word 'developer'."
},
{
"role": "assistant",
"content": "SELECT user_id, username\nFROM social_media.users\nWHERE bio ILIKE '%developer%';"
}
] | You are an SQL statement expert. Given the table 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": "Show me all drivers hired in 2023, including their full name and email address."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM transportation.drivers WHERE hire_date >= '2023-01-01' AND hire_date < '2024-01-01';"
},
{
"role":... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... |
[
{
"role": "user",
"content": "I want a summary of each asset showing the total number of trades executed and the average trade price, including asset name and symbol."
},
{
"role": "assistant",
"content": "SELECT a.asset_id,\n a.name,\n a.symbol,\n COUNT(t.trade_id) AS trades_c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
CREATE ... |
[
{
"role": "user",
"content": "Can you show me the total amount paid by each citizen for each service? Please display the citizen_id, service_id, and the total amount."
},
{
"role": "assistant",
"content": "SELECT citizen_id, service_id, SUM(amount) AS total_amount\nFROM government_services.payme... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, application_id text, citizen_id text, service_id text, amou... |
[
{
"role": "user",
"content": "Show me a list of all bus routes, including their route numbers, type, and the names of both the origin and destination locations."
},
{
"role": "assistant",
"content": "SELECT r.route_number, r.type, lo.name AS origin_name, ld.name AS destination_name\nFROM transpo... | You are an SQL statement expert. Given the table 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 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": "List all events and any token transfers that occurred in the same transaction, showing event_id, event_name, transfer_id, and token_symbol."
},
{
"role": "assistant",
"content": "SELECT\n e.event_id,\n e.event_name,\n tt.transfer_id,\n tk.token_symbol\nFROM web3... | You are an SQL statement expert. Given the table 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": "I want to see each server's name, region, and the number of game sessions that have been started on that server."
},
{
"role": "assistant",
"content": "SELECT s.server_name, s.region, COUNT(gs.session_id) AS session_count\nFROM gaming_technology.servers s\nLEFT 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 gaming_technology.developers ( developer_id uuid NOT NULL DEFAULT gen_random_uuid(), name character varying(150) NOT NU... |
[
{
"role": "user",
"content": "List the employee's first and last name along with the appointment ID and scheduled start time for all appointments associated with the citizen who has the national ID number 'A123456789'."
},
{
"role": "assistant",
"content": "SELECT e.first_name, e.last_name, a.ap... | You are an SQL statement expert. Given the table 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 each patient's full name along with the name of every doctor they've had an appointment with."
},
{
"role": "assistant",
"content": "SELECT p.first_name || ' ' || p.last_name AS patient_full_name, d.first_name || ' ' || d.last_name AS doctor_full_name\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 healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "Show the total number of bookings grouped by payment_transaction_id."
},
{
"role": "assistant",
"content": "SELECT payment_transaction_id, COUNT(*) AS booking_count FROM transportation.bookings GROUP BY payment_transaction_id;"
},
{
"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 transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "Show me all active customers from California who were born before 1980, along with their contact information."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, phone_number, email, address_line1, address_line2, city, state, zip_code FROM insurance... | You are an SQL statement expert. Given the table 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,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.