conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"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 diagnosis entries that are marked as chronic and have a status of 'Active'. Show diagnosis ID, patient ID, and description."
},
{
"role": "assistant",
"content": "SELECT diagnosis_id, patient_id, description FROM healthcare.diagnoses WHERE is_chronic = 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 healthcare.diagnoses (
diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry
... |
[
{
"role": "user",
"content": "Show me product_id, product_name, and base_premium for products created after '2023-01-01'."
},
{
"role": "assistant",
"content": "SELECT product_id,\n product_name,\n base_premium\nFROM insurance.insurance_products\nWHERE created_at > '2023-01-01';"
}... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, product_type text, description text, bas... |
[
{
"role": "user",
"content": "How many servers are in each region, and what's the average number of current players for those servers?"
},
{
"role": "assistant",
"content": "SELECT\n region,\n COUNT(server_id) AS server_count,\n AVG(current_players) AS average_current_players\nFROM gaming_tec... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.game_sessions ( session_id.uuid, player_id.uuid, game_id.uuid, server_id.uuid, start_time.timestamptz... |
[
{
"role": "user",
"content": "Show all users who have joined at least two group chats, with their usernames and the names of the group chats they joined."
},
{
"role": "assistant",
"content": "SELECT u.username, c.group_name\nFROM social_media.users u\nJOIN social_media.conversation_participants... | You are an SQL statement expert. Given the table 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": "List all accounts for customers who have at least one account with a balance over 10000 and another account with a balance under 1000. Show customer_id, account_id, account_type, balance, and currency."
},
{
"role": "assistant",
"content": "SELECT account_id , cust... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri... |
[
{
"role": "user",
"content": "List all guests who have stayed in rooms that allow smoking, including their full name and the relevant room number."
},
{
"role": "assistant",
"content": "SELECT DISTINCT g.guest_id, g.first_name, g.last_name, r.room_number\nFROM hospitality_technology.guests g\nJO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "Show me the count of approval-for-all events for each ERC1155 contract."
},
{
"role": "assistant",
"content": "SELECT contract_address, COUNT(*) AS approval_count FROM erc1155_approval_for_all GROUP BY contract_address;"
},
{
"role": "user",
"content": "... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ... |
[
{
"role": "user",
"content": "How many unique patients have been diagnosed with code_type 'ICD-10'?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT patient_id) FROM healthcare.diagnoses WHERE code_type = 'ICD-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 healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_ty... |
[
{
"role": "user",
"content": "List the usernames, emails, and group names for users who have sent messages in group chats and have enabled email notifications."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.username, T1.email, T4.group_name FROM social_media.users AS T1 JOIN social_me... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "Show the total trade amount for each account. Include the account_id and account_number."
},
{
"role": "assistant",
"content": "SELECT\n T1.account_id,\n T1.account_number,\n SUM(T2.total_amount) AS total_traded_amount\nFROM financial_services.accounts AS T1\nINN... | You are an SQL statement expert. Given the table 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": "For each open case, find the latest document uploaded: include case_number, document_name, and upload_timestamp."
},
{
"role": "assistant",
"content": "SELECT c.case_number,\n d.document_name,\n d.upload_timestamp\nFROM legal_services.cases c\nJOIN (\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, man... |
[
{
"role": "user",
"content": "List scheduled appointments, including the patient's full name, the doctor's full name, and the appointment time."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, d.first_name, d.last_name, a.appointment_time FROM healthcare.appointments AS 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 healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "List the usernames of users who are following user 'U500', and also show their theme setting."
},
{
"role": "assistant",
"content": "SELECT T1.username, T3.theme FROM social_media.users AS T1 JOIN social_media.follows AS T2 ON T1.user_id = T2.follower_user_id JOIN 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 social_media.users ( user_id.text, username.text, email.text, password_hash.text, full_name.text, profile_picture_url.t... |
[
{
"role": "user",
"content": "For Sui coins, can you show the coin_type and owner address for each coin where the balance is greater than 100000?"
},
{
"role": "assistant",
"content": "SELECT coin_type, owner FROM sui_coins WHERE CAST(balance AS NUMERIC) > 100000;"
},
{
"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 erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ... |
[
{
"role": "user",
"content": "Show me a list of all unique user IDs present in the wallet database."
},
{
"role": "assistant",
"content": "SELECT DISTINCT user_id FROM web3.wallets;"
},
{
"role": "user",
"content": "For each of those user IDs, how many wallets do they have? Show both... | 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 web3.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(6... |
[
{
"role": "user",
"content": "List all agents who have a commission rate above 0.1 and show their full names and agency names."
},
{
"role": "assistant",
"content": "SELECT agent_id, first_name || ' ' || last_name AS full_name, agency_name, commission_rate FROM insurance.agents WHERE commission_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"role": "user",
"content": "Show me all appointments for doctor 'doctor_100' in June 2024, including the appointment time and the patient ID."
},
{
"role": "assistant",
"content": "SELECT appointment_id, patient_id, appointment_time\nFROM healthcare.appointments\nWHERE doctor_id = 'doctor_100'... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments (
appointment_id character varying(64) NOT NULL, -- unique identifier for the appointment
... |
[
{
"role": "user",
"content": "Show me the first name, last name, and license number for all doctors whose specialty is 'Pediatrics'."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, license_number FROM healthcare.doctors WHERE specialty = 'Pediatrics';"
},
{
"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 healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"role": "user",
"content": "For each player, count how many unique games they have played."
},
{
"role": "assistant",
"content": "SELECT player_id, COUNT(DISTINCT game_id) AS unique_games_played FROM gaming_technology.game_sessions GROUP BY player_id;"
},
{
"role": "user",
"content... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date... |
[
{
"role": "user",
"content": "Find pairs of cases that share the same client and have the same status, but are different cases. Display the case name and case number for both cases in the pair, along with the shared client ID and shared status."
},
{
"role": "assistant",
"content": "SELECT T1.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 legal_services.cases ( case_id.text, case_number.text, case_name.text, client_id.text, lead_lawyer_id.text, case_type.t... |
[
{
"role": "user",
"content": "List distinct patient IDs who have received a diagnosis from a doctor with 'Cardiology' specialty."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.patient_id FROM healthcare.diagnoses AS T1 JOIN healthcare.doctors AS T2 ON T1.doctor_id = T2.doctor_id WHERE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "List all pairs of service orders for the same reservation, including both order IDs, the staff who ordered and delivered each, and the reservation ID."
},
{
"role": "assistant",
"content": "SELECT so1.reservation_id,\n so1.order_id AS order1_id,\n so1.st... | You are an SQL statement expert. Given the table 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 events with the name 'Transfer' that were emitted in the last 24 hours, including their contract IDs and transaction IDs, sorted by emitted timestamp in descending order."
},
{
"role": "assistant",
"content": "SELECT event_id, contract_id, transaction_id, e... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events ( event_id text PRIMARY KEY, contract_id text, event_name text, data text, emitted_at timestamp, transactio... |
[
{
"role": "user",
"content": "Show the wallet ID, user's username, and the creator address for all wallets whose address was used to deploy a smart contract."
},
{
"role": "assistant",
"content": "SELECT w.wallet_id, u.username, sc.creator_address\nFROM blockchain.wallets w\nJOIN blockchain.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 blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text... |
[
{
"role": "user",
"content": "How many patients have provided both a phone_number and emergency_contact_phone?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM healthcare.patients WHERE phone_number IS NOT NULL AND emergency_contact_phone 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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "Show all tokens where the total_supply is less than 10000, listing the token_id, token_symbol, and decimals."
},
{
"role": "assistant",
"content": "SELECT token_id, token_symbol, decimals FROM web3.tokens WHERE total_supply < 10000;"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.tokens ( token_id text PRIMARY KEY, contract_address text, token_name text, token_symbol text, decimals int, total... |
[
{
"role": "user",
"content": "Count the number of logs for each distinct action type."
},
{
"role": "assistant",
"content": "SELECT action, COUNT(*) AS log_count FROM trading_platform.logs GROUP BY action;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp )
|
[
{
"role": "user",
"content": "List the full names and email addresses of citizens who have submitted an application but have not uploaded any documents for that application. Display the citizen's full name, application_id, and submitted_at."
},
{
"role": "assistant",
"content": "SELECT c.first_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.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "Show all insurance plans where the plan name includes the word 'Care'."
},
{
"role": "assistant",
"content": "SELECT plan_id, plan_name, insurance_provider, plan_type\nFROM healthcare.insurance_plans\nWHERE plan_name ILIKE '%Care%';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_ty... |
[
{
"role": "user",
"content": "Find all patients who have been prescribed medications (mentioned in appointment notes) along with their doctors' names and the medication details mentioned."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, d.first_name AS docto... | You are an SQL statement expert. Given the table 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": "Retrieve all pairs of nodes that share the same port and were last seen on the same day. Include node_id, ip_address, and last_seen of both nodes."
},
{
"role": "assistant",
"content": "SELECT n1.node_id AS node_id1, n1.ip_address AS ip1, n1.last_seen AS last_seen1,... | You are an SQL statement expert. Given the table 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.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen timestamp )
|
[
{
"role": "user",
"content": "For each user, find the previous user by registration time. List current user_id and username, previous user_id and username, and the time difference in minutes between their registrations."
},
{
"role": "assistant",
"content": "SELECT u.user_id AS current_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.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email character varying(... |
[
{
"role": "user",
"content": "List all active products, showing their product ID, name, and type, ordered by their creation date."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name, product_type FROM insurance.insurance_products WHERE is_active = TRUE ORDER BY 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 insurance.insurance_products ( product_id text, product_name text, product_type text, description text, base_premium nu... |
[
{
"role": "user",
"content": "What is the average commission for trades executed on the 'NYSE' venue?"
},
{
"role": "assistant",
"content": "SELECT AVG(commission) FROM financial_services.trades WHERE execution_venue = 'NYSE';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.trades ( trade_id.text, account_id.text, security_id.text, order_id.text, trade_type.text, quantity.... |
[
{
"role": "user",
"content": "I would like to list each appointment along with any associated medical record's chief complaint, including the appointment_id, appointment_time, and chief_complaint. Include appointments even if there's no medical record."
},
{
"role": "assistant",
"content": "SELE... | You are an SQL statement expert. Given the table 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": "List all premium payments along with the full name of the agent who sold each policy and the name of the related insurance product."
},
{
"role": "assistant",
"content": "SELECT pp.payment_id, pp.amount_paid, pp.payment_date, a.first_name AS agent_first_name, a.last... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d... |
[
{
"role": "user",
"content": "For each ERC20 token, find the count of distinct historical holders and the sum of balances using erc20_balances_historical."
},
{
"role": "assistant",
"content": "SELECT contract_address,\n COUNT(DISTINCT wallet_address) AS holder_count,\n SUM(CAST(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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "For each service, show the service name, the property name where it is offered, its price, and the department responsible."
},
{
"role": "assistant",
"content": "SELECT s.service_name, p.property_name, s.price, s.department\nFROM hospitality_technology.services s\nJ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "Show me the total amount held and number of unique wallets for each ERC20 token with a symbol ending in 'X'."
},
{
"role": "assistant",
"content": "SELECT tm.symbol, SUM(CAST(ebh.amount AS DECIMAL)) AS total_amount, COUNT(DISTINCT ebh.wallet_address) AS unique_walle... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "List all upcoming appointments within the next 7 days along with each client's full name, email, appointment subject, and start_time."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, \n c.first_name || ' ' || c.last_name AS client_full_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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "List the document ID, document type, upload timestamp, and the full name of the employee who verified it for all documents that have been verified."
},
{
"role": "assistant",
"content": "SELECT d.document_id, d.document_type, d.upload_timestamp, CONCAT(e.first_name,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document i... |
[
{
"role": "user",
"content": "Show all claim documents for claims with an estimated loss greater than $50,000, including the claim ID, document_id, document type, and file name."
},
{
"role": "assistant",
"content": "SELECT cd.claim_id, cd.document_id, cd.document_type, cd.file_name\nFROM insura... | You are an SQL statement expert. Given the table 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, -- unique identifier for the claim
policy_id charac... |
[
{
"role": "user",
"content": "List all review IDs, comments, and overall ratings for reviews submitted for property 'P123'."
},
{
"role": "assistant",
"content": "SELECT review_id, comment, rating_overall FROM hospitality_technology.reviews WHERE property_id = 'P123';"
},
{
"role": "user... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.reviews ( review_id.text, property_id.text, reservation_id.text, guest_id.text, rating_overall.i... |
[
{
"role": "user",
"content": "Can you show me each doctor and the number of prescriptions they wrote for each patient they treated? Include the doctor's full name, the patient's full name, and the total count of prescriptions."
},
{
"role": "assistant",
"content": "SELECT d.first_name, d.last_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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "Which doctors do not have an email address listed? Please show their doctor ID, first name, last name, and the hospital they are affiliated with."
},
{
"role": "assistant",
"content": "SELECT doctor_id, first_name, last_name, hospital_affiliation_id FROM healthcare.... | You are an SQL statement expert. Given the table 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": "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": "Which token has the highest net USD value difference between buys and sells? Show token_symbol, chain, narrative, average buy price, average sell price, and the net difference."
},
{
"role": "assistant",
"content": "WITH buys AS (\n SELECT token_address, token_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 smart_money_token_inflow (",
"token_address character varying(100) NOT NULL, -- the token's address",
"token... |
[
{
"role": "user",
"content": "For each reservation, find the next reservation made by the same guest and calculate the gap in days between them."
},
{
"role": "assistant",
"content": "select r1.reservation_id as current_reservation_id, r2.reservation_id as next_reservation_id, r2.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.reservations ( reservation_id text PRIMARY KEY, property_id text, guest_id text, room_id text, r... |
[
{
"role": "user",
"content": "Show me all time entries from the last 90 days, including the entry description, hours spent, the name of the case, and the name of the client."
},
{
"role": "assistant",
"content": "SELECT T1.description, T1.hours_spent, T2.case_name, T3.first_name, T3.last_name FR... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries (
entry_id character varying(64) NOT NULL, -- unique identifier for the time entry
... |
[
{
"role": "user",
"content": "Show me all vehicles that are currently out of service (status = 'out_of_service'), including their make, model, and the reason (type field)."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, make, model, type FROM transportation.vehicles WHERE status = 'out... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "Show me all 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 text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "Show me the property ID, name, and creation date for all properties created after January 1, 2022."
},
{
"role": "assistant",
"content": "SELECT property_id, property_name, created_at FROM hospitality_technology.properties WHERE created_at >= '2022-01-01';"
},
{... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Show me the top 5 users with the most KYC audits, along with their latest audit status."
},
{
"role": "assistant",
"content": "SELECT user_id, status, COUNT(*) as audit_count FROM trading_platform.kyc_audit GROUP BY user_id, status ORDER BY audit_count DESC LIMIT 5;... | You are an SQL statement expert. Given the table 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.kyc_audit (
kyc_audit_id character varying(64) NOT NULL, -- unique identifier for the KYC audit
... |
[
{
"role": "user",
"content": "List all pairs of law firms that were founded on the same month and day, showing their names, and the shared founding date. Exclude firms founded on January 1st."
},
{
"role": "assistant",
"content": "SELECT t1.firm_name AS firm1_name, t2.firm_name AS firm2_name, 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 legal_services.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address t... |
[
{
"role": "user",
"content": "I want to list each security alongside another security issued by the same issuer."
},
{
"role": "assistant",
"content": "SELECT a.security_id, a.ticker_symbol, b.security_id AS other_security_id, b.ticker_symbol AS other_ticker, a.issuer_name\nFROM financial_servic... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu... |
[
{
"role": "user",
"content": "List the usernames and email addresses of users who have received at least five notifications."
},
{
"role": "assistant",
"content": "SELECT u.username, u.email\nFROM social_media.users u\nJOIN (\n SELECT recipient_user_id\n FROM social_media.notifications\n GROU... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "I want to know how many hashtags have been used for posts whose IDs correspond to conversation IDs. Return conversation_id and hashtag_count."
},
{
"role": "assistant",
"content": "SELECT cp.conversation_id, COUNT(ph.hashtag_id) AS hashtag_count\nFROM social_media.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 social_media.post_hashtags (
post_hashtag_id character varying(64) NOT NULL, -- unique identifier for the post-hash... |
[
{
"role": "user",
"content": "For each chain, find the token with the highest price and the token with the lowest price. List chain, high_price_token, max_price, low_price_token, and min_price."
},
{
"role": "assistant",
"content": "WITH max_prices AS (\n SELECT chain,\n token_symbol 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 token_dexpool_info (",
"pair_address character varying(512) NOT NULL, -- the id of dexpool",
"token_name cha... |
[
{
"role": "user",
"content": "List peer IDs and IP addresses for all peers whose IP address starts with '10.'."
},
{
"role": "assistant",
"content": "SELECT peer_id, ip_address FROM trading_platform.peers WHERE ip_address LIKE '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 trading_platform.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
CREATE ... |
[
{
"role": "user",
"content": "Show me all room types with a base rate over $200 and max occupancy of at least 4, along with their property IDs and amenities."
},
{
"role": "assistant",
"content": "SELECT room_type_id, property_id, amenities FROM hospitality_technology.room_types WHERE base_rate ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text, type_name text, description text, ... |
[
{
"role": "user",
"content": "How many unique items does each player have in their inventory right now?"
},
{
"role": "assistant",
"content": "SELECT player_id, COUNT(DISTINCT item_id) AS unique_items FROM gaming_technology.player_inventory GROUP 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_inventory ( inventory_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, ite... |
[
{
"role": "user",
"content": "List all contracts with status 'active' and include their deployment timestamp and network ID."
},
{
"role": "assistant",
"content": "SELECT address, deployed_at, network_id FROM web3.contracts WHERE status = 'active';"
},
{
"role": "user",
"content": "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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"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 all patients who have an active prescription for a medication manufactured by 'AstraZeneca', along with their policy number and the prescription ID."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, pi.policy_number, pr.prescription_id\nFROM healthcar... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id.text, medication_name.text, generic_name.text, manufacturer.text, ndc_code.text,... |
[
{
"role": "user",
"content": "Show me the name and founding date of every law firm."
},
{
"role": "assistant",
"content": "SELECT firm_name, founded_date\nFROM law_firms;"
},
{
"role": "user",
"content": "Also include the firm's phone number."
},
{
"role": "assistant",
"c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms (
firm_id character varying(64) NOT NULL, -- unique identifier for the law firm
firm_... |
[
{
"role": "user",
"content": "Show all trips, including the trip ID, vehicle license plate, and the vehicle's capacity."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, v.license_plate, v.capacity FROM transportation.trips t JOIN vehicles v ON t.vehicle_id = v.vehicle_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 transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"role": "user",
"content": "Show me all users who have unread notifications sent more than 3 days ago, along with the notification message and when it was sent."
},
{
"role": "assistant",
"content": "SELECT user_id, message, sent_at FROM trading_platform.notifications WHERE read_at IS NULL AND... | You are an SQL statement expert. Given the table 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.notifications ( notification_id.text, user_id.text, message.text, sent_at.timestamp, read_at.timestamp... |
[
{
"role": "user",
"content": "Retrieve review comments with their reservation's check-in and check-out dates."
},
{
"role": "assistant",
"content": "SELECT rv.comment, r.check_in_date, r.check_out_date\nFROM hospitality_technology.reviews rv\nJOIN hospitality_technology.reservations r ON rv.rese... | You are an SQL statement expert. Given the table 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 each claim_handler_id along with the number of claims they've handled and the total settlement_amount they've paid out."
},
{
"role": "assistant",
"content": "SELECT claim_handler_id,\n COUNT(*) AS total_claims,\n SUM(settlement_amount) AS total_set... | You are an SQL statement expert. Given the table 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, -- unique identifier for the claim
policy_id charac... |
[
{
"role": "user",
"content": "List all claims with settlement_amount greater than 10000. Include claim_id, customer_id, estimated_loss, settlement_amount, and police_report_number."
},
{
"role": "assistant",
"content": "SELECT claim_id,\n customer_id,\n estimated_loss,\n settle... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d... |
[
{
"role": "user",
"content": "Show me the token names and their contract addresses where the total supply is greater than 1 million, sorted by total supply in descending order."
},
{
"role": "assistant",
"content": "SELECT token_name, contract_address FROM web3.tokens WHERE total_supply > 100000... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.tokens ( token_id text, contract_address text, token_name text, token_symbol text, decimals integer, total_supply ... |
[
{
"role": "user",
"content": "Which customers have more than one active policy at the same time? Show the customer ID and the number of active policies."
},
{
"role": "assistant",
"content": "SELECT customer_id, COUNT(policy_id) AS active_policy_count\nFROM insurance.policies\nWHERE status = 'Ac... | You are an SQL statement expert. Given the table 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, -- unique identifier for the policy
customer_id ... |
[
{
"role": "user",
"content": "How many hidden achievements are there?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM gaming_technology.achievements WHERE hidden = true;"
},
{
"role": "user",
"content": "Also, what is the average point value of all achievements that are 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 gaming_technology.achievements ( achievement_id uuid PRIMARY KEY, game_id uuid, name text, description text, icon_url t... |
[
{
"role": "user",
"content": "Show me all customers (customer_id, first_name, last_name) who live in California (state = 'CA') and were born after 1990, along with their email addresses and risk profiles."
},
{
"role": "assistant",
"content": "SELECT customer_id, first_name, last_name, email, ri... | You are an SQL statement expert. Given the table 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": "List all staff members, the property name they work for, and the number of services offered at their property."
},
{
"role": "assistant",
"content": "SELECT s.staff_id, s.first_name, s.last_name, p.property_name, COUNT(sv.service_id) AS service_count\nFROM hospitali... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "List each patient's first_name, last_name, and the plan_name and policy_number of their primary insurance plan."
},
{
"role": "assistant",
"content": "SELECT p.first_name,\n p.last_name,\n ip.plan_name,\n pi.policy_number\nFROM healthcare.patients ... | You are an SQL statement expert. Given the table 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": "Which tokens on BSC and Polygon have a ROI higher than 2 this year? Show their symbols, ROI, and average cost."
},
{
"role": "assistant",
"content": "SELECT token_symbol, roi, avg_cost, chain FROM smart_money_token_performance WHERE (chain = 'BSC' OR chain = 'Polygo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, token_symbol character varying(100), pnl... |
[
{
"role": "user",
"content": "Find all users who have wallets but have never logged any actions, along with their wallet creation date."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, w.created_at AS wallet_created_at FROM trading_platform.users u JOIN 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.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "List all account types along with the number of distinct currencies they are available in."
},
{
"role": "assistant",
"content": "SELECT account_type, COUNT(DISTINCT currency) AS currency_count\nFROM financial_services.accounts\nGROUP BY account_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 financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac... |
[
{
"role": "user",
"content": "Provide the total count of addresses and the minimum balance recorded in the system."
},
{
"role": "assistant",
"content": "SELECT COUNT(*), MIN(balance) FROM blockchain.addresses;"
},
{
"role": "user",
"content": "Now, show me the address ID and public ... | 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.addresses ( address_id text, public_key text, balance numeric )
|
[
{
"role": "user",
"content": "For each chain, which token had the highest number of smart money addresses buying it this week? Show the token symbol and narrative too."
},
{
"role": "assistant",
"content": "SELECT chain, token_symbol, narrative, MAX(address_amount) AS max_buyers FROM smart_money... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the token's address token_symbol character... |
[
{
"role": "user",
"content": "List each property_name and the count of available rooms."
},
{
"role": "assistant",
"content": "SELECT p.property_name,\n COUNT(*) AS available_rooms_count\nFROM hospitality_technology.rooms r\nJOIN hospitality_technology.properties p\n ON r.property_id = p.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, room... |
[
{
"role": "user",
"content": "List all employees and the branch they work at, along with their job title and department."
},
{
"role": "assistant",
"content": "SELECT employee_id, first_name || ' ' || last_name AS full_name, job_title, department, branch_id\nFROM financial_services.employees;"
... | You are an SQL statement expert. Given the table 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": "List all room types with their type name, base rate, and the name of the property they belong to."
},
{
"role": "assistant",
"content": "SELECT rt.room_type_id, rt.type_name, rt.base_rate, p.property_name\nFROM hospitality_technology.room_types rt\nJOIN hospitality_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types (
room_type_id character varying(64) NOT NULL, -- unique identifier for the room ... |
[
{
"role": "user",
"content": "Show all DApps that have metadata linked to an asset with a key of 'category', including the DApp name, URL, and the associated asset_id."
},
{
"role": "assistant",
"content": "SELECT d.name, d.url, m.asset_id\nFROM trading_platform.dapps d\nJOIN trading_platform.me... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.utxos (
utxo_id character varying(64) NOT NULL, -- unique identifier for the UTXO
transaction... |
[
{
"role": "user",
"content": "List all SUI coins with status 'exists', including their coin_type, balance, and owner address."
},
{
"role": "assistant",
"content": "SELECT object_id, coin_type, balance, owner\nFROM sui_coins\nWHERE status = 'exists';"
},
{
"role": "user",
"content": ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "List all transactions along with the user ID and username of the sender, if available. Show transaction id, from_address, user id, and username."
},
{
"role": "assistant",
"content": "SELECT tx.transaction_id, tx.from_address, w.user_id, u.username\nFROM web3.transa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"role": "user",
"content": "For each user, show their username and the total number of completed orders they have placed, along with the name of the asset for each order."
},
{
"role": "assistant",
"content": "SELECT u.username, a.name AS asset_name, COUNT(o.order_id) AS completed_order_count\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Show the total payment amount per currency for payments that are either 'Pending' or 'Failed', grouped by currency_code."
},
{
"role": "assistant",
"content": "SELECT currency_code, SUM(amount) AS total_payment_amount\nFROM hospitality_technology.payments\nWHERE sta... | You are an SQL statement expert. Given the table 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 the top 5 tokens by USD value held on the Binance Smart Chain, along with their average price and total balance."
},
{
"role": "assistant",
"content": "SELECT token_symbol, AVG(price) AS average_price, SUM(balance) AS total_balance, SUM(usd_value) AS total_u... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE cex_token_balance ( snapshot_time text, chain text, address text, exchange text, token_address text, token_symbol text,... |
[
{
"role": "user",
"content": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 6 months, along with their narrative information if available."
},
{
"role": "assistant",
"content": "SELECT pfr.project_name, pfr.valuation, pfr.investment_date, ni.narrative, ni.... | You are an SQL statement expert. Given the table 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": "For each asset, calculate the total quantity and average price of orders that have status 'filled'."
},
{
"role": "assistant",
"content": "SELECT o.asset_id,\n SUM(o.quantity) AS total_quantity,\n AVG(o.price) AS average_price\nFROM trading_platform.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets (
wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet
user_... |
[
{
"role": "user",
"content": "Show me all wallet_ids and their corresponding user_id where the wallet's address has a balance below 100."
},
{
"role": "assistant",
"content": "SELECT w.wallet_id, w.user_id\nFROM blockchain.wallets w\nJOIN blockchain.addresses a ON w.address_id = a.address_id\nWH... | You are an SQL statement expert. Given the table 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 text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic... |
[
{
"role": "user",
"content": "Get each user's total 'buy' order value (quantity * price) as total_buy_value."
},
{
"role": "assistant",
"content": "SELECT u.user_id, SUM(o.quantity * o.price) AS total_buy_value\nFROM trading_platform.users u\nJOIN trading_platform.orders o ON u.user_id = o.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 trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "List the full name of citizens who have appointments scheduled for services in the 'Licensing' category."
},
{
"role": "assistant",
"content": "SELECT T1.full_name FROM government_services.citizens AS T1 JOIN government_services.appointments AS T2 ON T1.citizen_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 government_services.appointments ( appointment_id text PRIMARY KEY, citizen_id text, employee_id text, location_id text... |
[
{
"role": "user",
"content": "List all contracts along with the username of the deployer, showing contract_id, contract address, deployed_at, and the username. Order by deployed_at descending."
},
{
"role": "assistant",
"content": "SELECT c.contract_id,\n c.address AS 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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "Which vehicles have a total maintenance cost exceeding 10000 across all their maintenance logs?"
},
{
"role": "assistant",
"content": "SELECT vehicle_id, SUM(cost) AS total_maintenance_cost FROM transportation.maintenance_logs GROUP BY vehicle_id HAVING SUM(cost) > ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "List all post IDs and their corresponding hashtag names for posts that include media."
},
{
"role": "assistant",
"content": "SELECT ph.post_id, h.tag_name\nFROM social_media.post_hashtags ph\nJOIN social_media.hashtags h ON ph.hashtag_id = h.hashtag_id\nJOIN social_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ... |
[
{
"role": "user",
"content": "List all address IDs with a balance under 50, along with the count of transactions they have received."
},
{
"role": "assistant",
"content": "SELECT a.address_id, a.balance, COUNT(t.transaction_id) AS received_count\nFROM blockchain.addresses a\nLEFT JOIN blockchain... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.transactions ( transaction_id text, block_id text, sender_address text, receiver_address text, amount numeri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.