conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Compute the total and average amount_paid for completed premium payments, grouped by payment_method."
},
{
"role": "assistant",
"content": "SELECT payment_method, SUM(amount_paid) AS total_paid, AVG(amount_paid) AS average_paid\nFROM insurance.premium_payments\nWHER... | You are an SQL statement expert. Given the table 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": "List all cases that have an invoice issued in July 2024, showing the case name, case number, invoice number, and issue date."
},
{
"role": "assistant",
"content": "SELECT T1.case_name, T1.case_number, T2.invoice_number, T2.issue_date FROM legal_services.cases AS T1 ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE 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": "Can you show me a list of all players along with all in-game items they have access to, including the player_id, username, and item_name?"
},
{
"role": "assistant",
"content": "SELECT p.player_id, p.username, i.item_name\nFROM gaming_technology.players p\nCROSS 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.players ( player_id uuid, username text, email text, password_hash text, registration_date timestamp ... |
[
{
"role": "user",
"content": "I need a list of policies that will expire within the next 30 days, including the policy_number, end_date, the associated product_name, and the customer's first and last name."
},
{
"role": "assistant",
"content": "SELECT pl.policy_number,\n pl.end_date,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "List all pairs of lawyers with the same specialization."
},
{
"role": "assistant",
"content": "SELECT l1.lawyer_id AS lawyer1_id,\n l1.first_name AS lawyer1_first_name,\n l1.last_name AS lawyer1_last_name,\n l2.lawyer_id AS lawyer2_id,\n l2.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 legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph... |
[
{
"role": "user",
"content": "Calculate the average cost_per_unit for each fuel_type from the fuel_logs table."
},
{
"role": "assistant",
"content": "SELECT fuel_type,\n AVG(cost_per_unit) AS avg_cost_per_unit\nFROM transportation.fuel_logs\nGROUP BY fuel_type;"
},
{
"role": "user"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, qu... |
[
{
"role": "user",
"content": "Show me all contracts deployed on the 'ethereum' network along with their deployer addresses and the length of their ABI in characters, sorted by ABI length in descending order."
},
{
"role": "assistant",
"content": "SELECT address, deployer_address, LENGTH(abi) 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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "How many smart money addresses are in the top 100 rank?"
},
{
"role": "assistant",
"content": "SELECT count(address) FROM smart_money_profit WHERE rank <= 100"
},
{
"role": "user",
"content": "Okay, can you break that down by `chain`? Show the count for ... | You are an SQL statement expert. Given the table 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_profit ( address character varying(100) NOT NULL, rank INT, profit numeric(38,6), roi numeric(38,2), realiz... |
[
{
"role": "user",
"content": "List the first name, last name, prescription ID, diagnosis code, and diagnosis description for patients who have both an ongoing prescription and an active chronic diagnosis."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.first_name, T1.last_name, T2.pres... | You are an SQL statement expert. Given the table 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": "Show smart money addresses with an ROI greater than 3 and a realized ratio greater than 0.7. Display the address, chain, ROI, realized ratio, and most profitable token."
},
{
"role": "assistant",
"content": "SELECT address, chain, roi, realized_ratio, most_profit_to... | You are an SQL statement expert. Given the table 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 character varying(32) NOT NULL, -- the snapshot time of record, converted ... |
[
{
"role": "user",
"content": "Find all bookings along with the first and last name of the passenger and the trip_id, where the booking status is 'Cancelled'."
},
{
"role": "assistant",
"content": "SELECT b.booking_id, p.first_name, p.last_name, b.trip_id\nFROM transportation.bookings b\nJOIN tra... | You are an SQL statement expert. Given the table 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 lawyers have scheduled appointments at each location? Please list the lawyer_id, location, and the number of scheduled appointments per lawyer per location."
},
{
"role": "assistant",
"content": "SELECT lawyer_id, location, COUNT(*) AS scheduled_appointments\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.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ... |
[
{
"role": "user",
"content": "Show me all service orders placed before 2023-01-01, including order ID, guest ID, and order timestamp."
},
{
"role": "assistant",
"content": "SELECT order_id, guest_id, order_timestamp FROM hospitality_technology.service_orders WHERE order_timestamp < '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 hospitality_technology.service_orders ( order_id text, reservation_id text, guest_id text, service_id text, staff_id_or... |
[
{
"role": "user",
"content": "List all customers who share an address with another customer. Show both customer IDs, their full names, and the shared address."
},
{
"role": "assistant",
"content": "SELECT a.customer_id AS customer_id_a, a.first_name AS first_name_a, a.last_name AS last_name_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 financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "Show the route number and description for routes that have bookings associated with them."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.route_number, T1.description FROM transportation.routes AS T1 JOIN transportation.bookings AS T2 ON T1.route_id = T2.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.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ... |
[
{
"role": "user",
"content": "For each user with at least two wallets, calculate the average time difference in hours between consecutive wallet creations. Return user_id and avg_diff_hours."
},
{
"role": "assistant",
"content": "SELECT user_id, AVG(EXTRACT(EPOCH FROM (created_at - prev_created)... | You are an SQL statement expert. Given the table 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, -- unique identifier for the contract
address cha... |
[
{
"role": "user",
"content": "List user IDs of users who have private profiles and have liked any post or comment."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.user_id FROM social_media.user_settings AS T1 JOIN social_media.likes AS T2 ON T1.user_id = T2.user_id WHERE T1.private_pro... | You are an SQL statement expert. Given the table 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.likes ( like_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, post_id character ... |
[
{
"role": "user",
"content": "List the top 3 lawyers who have logged the highest total billable hours in June 2023. Provide their first_name, last_name, and the summed hours."
},
{
"role": "assistant",
"content": "SELECT l.first_name, l.last_name, SUM(te.hours_spent) AS total_hours\nFROM legal_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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "List all contracts that were deployed by the same deployer address on the same network, showing the contract IDs, deployer address, and network ID."
},
{
"role": "assistant",
"content": "SELECT c1.contract_id AS contract_id_1, c2.contract_id AS contract_id_2, c1.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 web3.contracts (
contract_id character varying(64) NOT NULL, -- unique identifier for the contract
address cha... |
[
{
"role": "user",
"content": "Show me the number of service orders placed for each service category."
},
{
"role": "assistant",
"content": "SELECT s.category, COUNT(so.order_id) AS order_count\nFROM hospitality_technology.service_orders so\nJOIN hospitality_technology.services s ON so.service_id... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"role": "user",
"content": "List the comment_id, comment content, and associated hashtag_id for each comment on posts that have at least one hashtag by joining comments and post_hashtags tables."
},
{
"role": "assistant",
"content": "SELECT cm.comment_id, cm.content, ph.hashtag_id\nFROM 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.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ... |
[
{
"role": "user",
"content": "For each prescription, find the next prescription for the same patient. Return current prescription_id, next_prescription_id, patient_id, and days between start dates."
},
{
"role": "assistant",
"content": "SELECT p1.patient_id,\n p1.prescription_id AS 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 healthcare.prescriptions ( prescription_id.text, record_id.text, patient_id.text, doctor_id.text, medication_id.text, d... |
[
{
"role": "user",
"content": "Count the number of appointments for each status."
},
{
"role": "assistant",
"content": "SELECT status, count(*) FROM government_services.appointments GROUP 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 government_services.appointments ( appointment_id character varying(64) NOT NULL, citizen_id character varying(64) NOT ... |
[
{
"role": "user",
"content": "Show me all cases that are associated with the court jurisdiction 'Federal Court'."
},
{
"role": "assistant",
"content": "SELECT * FROM legal_services.cases WHERE court_jurisdiction = 'Federal Court';"
},
{
"role": "user",
"content": "From these cases, 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 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": "Show me all service orders that have a status of 'Pending'."
},
{
"role": "assistant",
"content": "SELECT * FROM hospitality_technology.service_orders WHERE status = 'Pending';"
},
{
"role": "user",
"content": "For these pending service orders, list the ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "Show me all wallet addresses that have a private_key starting with '0x1' and belong to a user."
},
{
"role": "assistant",
"content": "SELECT address_id FROM blockchain.wallets WHERE private_key LIKE '0x1%' AND user_id IS NOT NULL;"
},
{
"role": "user",
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.wallets ( wallet_id text, user_id text, address_id text, private_key text )
|
[
{
"role": "user",
"content": "Find any two policies for the same customer whose coverage dates overlap. Return the customer ID, both policy numbers, and their start and end dates."
},
{
"role": "assistant",
"content": "SELECT p1.customer_id,\n p1.policy_number AS policy1_number,\n p1... | You are an SQL statement expert. Given the table 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": "Can you show me pairs of posts that were made at identical locations, including their post_ids and timestamps?"
},
{
"role": "assistant",
"content": "SELECT p1.post_id AS post1_id, p2.post_id AS post2_id, p1.created_at AS post1_time, p2.created_at AS post2_time\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 social_media.posts ( post_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi... |
[
{
"role": "user",
"content": "Show the distribution of total supply for tokens, grouped into ranges like < 1 million, 1 million to 1 billion, and > 1 billion. Count how many tokens fall into each range."
},
{
"role": "assistant",
"content": "SELECT CASE WHEN total_supply < 1000000 THEN '< 1 mill... | You are an SQL statement expert. Given the table 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 the number of completed transactions and the total amount per currency."
},
{
"role": "assistant",
"content": "SELECT currency, COUNT(*) AS transaction_count, SUM(amount) AS total_amount\nFROM financial_services.transactions\nWHERE status = 'COMPLETED'\nGROUP B... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad... |
[
{
"role": "user",
"content": "List all post IDs that match conversation IDs along with the time users joined those conversations."
},
{
"role": "assistant",
"content": "SELECT ph.post_id, cp.joined_at\nFROM social_media.post_hashtags ph\nJOIN social_media.conversation_participants cp\n ON ph.po... | You are an SQL statement expert. Given the table 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": "List all doctors who have not written any prescriptions. Return doctor_id, first_name, and last_name."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id, d.first_name, d.last_name FROM healthcare.doctors d LEFT JOIN healthcare.prescriptions p ON d.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.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "List all document IDs and document types for documents that have been verified by an employee, along with the verification timestamp and the ID of the verifying employee."
},
{
"role": "assistant",
"content": "SELECT document_id, document_type, verification_timestam... | You are an SQL statement expert. Given the table 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 text, application_id text, citizen_id text, document_type text, file_refere... |
[
{
"role": "user",
"content": "List all NFT collections where the floor price is greater than 0.5 ETH, including their names and contract addresses."
},
{
"role": "assistant",
"content": "SELECT name, contract_address FROM nft_collections WHERE CAST(floor_price AS decimal) > 0.5 AND floor_price_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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "List all active staff members who are managers, along with their hire dates and email addresses."
},
{
"role": "assistant",
"content": "SELECT staff_id, first_name, last_name, position, hire_date, work_email FROM hospitality_technology.staff WHERE is_active = true A... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "List all games released in 2023 along with their titles, platforms, and the names of their developers."
},
{
"role": "assistant",
"content": "SELECT g.game_id, g.title, g.platform, d.name AS developer_name\nFROM gaming_technology.games g\nJOIN gaming_technology.deve... | You are an SQL statement expert. Given the table 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": "What are the distinct categories of services offered by agencies within the 'State' jurisdiction level?"
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.category FROM government_services.services AS T1 JOIN government_services.agencies AS T2 ON T1.agency_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.agencies (
agency_id character varying(64) NOT NULL, -- unique identifier for the agency
ag... |
[
{
"role": "user",
"content": "List all reservations along with their guest's full name and the total amount, for reservations that have more than 2 adults."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, g.first_name || ' ' || g.last_name AS guest_full_name, r.total_amount\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 hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "Show me the top 3 tokens with the highest 7-day price change percentage. Display their symbol, chain, and 7d price change."
},
{
"role": "assistant",
"content": "SELECT token_symbol, chain, price_change_percentage_7d\nFROM token_basic_info\nORDER BY price_change_per... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "List the product_id, product_name, and base_premium for all products that are currently inactive."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name, base_premium\nFROM insurance.insurance_products\nWHERE 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.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"role": "user",
"content": "I need to list the top 5 ERC20 tokens by total supply, including symbol, contract_address, and name."
},
{
"role": "assistant",
"content": "SELECT tm.contract_address, tm.symbol, tm.name, CAST(tm.total_supply AS DECIMAL) AS total_supply\nFROM token_metas tm\nWHERE 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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "Show me the total fuel cost for each vehicle, grouped by fuel type."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, fuel_type, SUM(total_cost) AS total_fuel_cost FROM transportation.fuel_logs GROUP BY vehicle_id, fuel_type;"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.locations ( location_id character varying(64) NOT NULL, name character varying(255) NOT NULL, type chara... |
[
{
"role": "user",
"content": "Show me the block with the earliest timestamp and its corresponding previous block's difficulty level."
},
{
"role": "assistant",
"content": "SELECT b1.block_id, b1.timestamp, b2.difficulty AS previous_block_difficulty\nFROM blockchain.blocks b1\nLEFT JOIN blockchai... | You are an SQL statement expert. Given the table 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": "Show me all guests from California who are loyalty members, along with their email and phone number, ordered by last name."
},
{
"role": "assistant",
"content": "SELECT guest_id, first_name, last_name, email, phone_number FROM hospitality_technology.guests WHERE 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.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"role": "user",
"content": "Show me all active insurance products with a base premium less than $200, sorted by product type."
},
{
"role": "assistant",
"content": "SELECT * FROM insurance.insurance_products WHERE is_active = true AND base_premium < 200 ORDER BY product_type;"
},
{
"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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"role": "user",
"content": "Show me all police report documents uploaded in the last month, along with their claim IDs and file sizes in MB."
},
{
"role": "assistant",
"content": "SELECT claim_id, file_size_bytes / (1024 * 1024) AS file_size_mb FROM insurance.claim_documents WHERE document_typ... | You are an SQL statement expert. Given the table 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": "Please list the first name, last name, and specialty for all doctors in the system."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, specialty FROM healthcare.doctors;"
},
{
"role": "user",
"content": "Refine this query to only show 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.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch... |
[
{
"role": "user",
"content": "List all pairs of token transfers that share the same sender and recipient addresses, but have different transfer IDs. Show the shared from_address, shared to_address, and both transfer IDs."
},
{
"role": "assistant",
"content": "SELECT t1.from_address, t1.to_addres... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address text, to_address text, value numeric, ... |
[
{
"role": "user",
"content": "List all notifications that are related to group conversations, showing notification ID, recipient user ID, and the associated group name."
},
{
"role": "assistant",
"content": "SELECT n.notification_id, n.recipient_user_id, c.group_name FROM social_media.notificati... | You are an SQL statement expert. Given the table 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.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_grou... |
[
{
"role": "user",
"content": "List all law firms that share the same address with another firm, showing both firm names and the address."
},
{
"role": "assistant",
"content": "SELECT f1.firm_name AS firm_a, f2.firm_name AS firm_b, f1.address\nFROM law_firms f1\nJOIN law_firms f2\n ON f1.address... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms (
firm_id character varying(64) NOT NULL, -- unique identifier for the law firm
firm_... |
[
{
"role": "user",
"content": "I’d like to see a list of appointments along with any prescriptions made on the same day. Include appointment_id, prescription_id, medication_name, and appointment_time."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, p.prescription_id, m.medication_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi... |
[
{
"role": "user",
"content": "List all guests who have opted out of communication, including their first name, last name, and email."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM hospitality_technology.guests WHERE communication_consent = false;"
},
{
"r... | You are an SQL statement expert. Given the table 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": "I need to find all bookings for a specific schedule with schedule_id 'sched_1122' and include the passenger and ticket details."
},
{
"role": "assistant",
"content": "SMEMBERS schedule:sched_1122:bookings\nHGETALL booking:book_*\nHGETALL passenger:pass_*\nSMEMBERS b... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// Use Hashes for platform details. Key format: platform:<platform_id>
// HSET platform:plat_123 ... |
[
{
"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": "Show the name, symbol, and type of each asset, along with the total number of orders placed for each asset."
},
{
"role": "assistant",
"content": "SELECT a.name, a.symbol, a.type, COUNT(o.order_id) AS order_count\nFROM trading_platform.assets a\nLEFT JOIN trading_pl... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
CREATE ... |
[
{
"role": "user",
"content": "List the name and type for all insurance products with a base premium over 5000."
},
{
"role": "assistant",
"content": "SELECT product_name, product_type FROM insurance.insurance_products WHERE base_premium > 5000;"
},
{
"role": "user",
"content": "Can y... | You are an SQL statement expert. Given the table 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": "List the total transaction amount per day for the last week."
},
{
"role": "assistant",
"content": "SELECT date_trunc('day', transaction_date) AS day, SUM(amount) AS total_amount\nFROM financial_services.transactions\nWHERE transaction_date >= CURRENT_DATE - INTERVA... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.transactions ( transaction_id character varying(64) NOT NULL, account_id character varying(64) NOT N... |
[
{
"role": "user",
"content": "Retrieve all reservations with status 'Cancelled' and show the reservation_id, property_name, and room_type_name."
},
{
"role": "assistant",
"content": "SELECT res.reservation_id,\n p.property_name,\n rt.type_name AS room_type_name\nFROM hospitality_tech... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Show me the route ID, route number, and route type for all transportation routes."
},
{
"role": "assistant",
"content": "SELECT route_id, route_number, type FROM transportation.routes;"
},
{
"role": "user",
"content": "Filter this list to only include 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 transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati... |
[
{
"role": "user",
"content": "List all individual token holdings by CEX addresses on the 'Arbitrum' chain with a USD value greater than $100,000. Show the exchange, token symbol, and USD value."
},
{
"role": "assistant",
"content": "SELECT exchange, token_symbol, usd_value FROM cex_token_balance... | You are an SQL statement expert. Given the table 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": "For each relationship type among policy beneficiaries, show the average percentage_share and the count of unique beneficiaries. Please order the results with the highest average percentage_share first."
},
{
"role": "assistant",
"content": "SELECT relationship, AVG(... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id.text, policy_id.text, customer_id.text, first_name.text, last_name.text... |
[
{
"role": "user",
"content": "Show me all reviews with ratings of 5 stars, including the property name and review date."
},
{
"role": "assistant",
"content": "SELECT r.review_id, p.property_name, r.review_date FROM hospitality_technology.reviews r JOIN hospitality_technology.properties p ON r.pr... | You are an SQL statement expert. Given the table 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 each case ID with its latest uploaded document. I want to see the case ID, document name, version, and upload timestamp for the most recently uploaded document in each case."
},
{
"role": "assistant",
"content": "SELECT d.case_id, d.document_name, d.version,... | You are an SQL statement expert. Given the table 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.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... |
[
{
"role": "user",
"content": "Retrieve the guest_id, first_name, last_name, and loyalty_member_id for all guests who have communication_consent enabled."
},
{
"role": "assistant",
"content": "SELECT guest_id, first_name, last_name, loyalty_member_id\nFROM hospitality_technology.guests\nWHERE com... | You are an SQL statement expert. Given the table 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": "Can you fetch all claims reported in the past 30 days, including claim_id, incident_date, reported_date, and estimated_loss?"
},
{
"role": "assistant",
"content": "SELECT claim_id, incident_date, reported_date, estimated_loss\nFROM insurance.claims\nWHERE reported_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 insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara... |
[
{
"role": "user",
"content": "List all customers who have policies with a coverage limit above 500000, showing their first name, last name, and the policy number."
},
{
"role": "assistant",
"content": "SELECT t1.first_name, t1.last_name, t2.policy_number FROM insurance.customers AS t1 JOIN insur... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
[
{
"role": "user",
"content": "For each loan type, show the total outstanding principal balance and the number of active loans."
},
{
"role": "assistant",
"content": "SELECT loan_type, SUM(current_principal_balance) AS total_outstanding_balance, COUNT(*) AS active_loan_count FROM 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.loans ( loan_id text, account_id text, loan_type text, principal_amount numeric, current_principal_b... |
[
{
"role": "user",
"content": "Show me the total billable hours per lawyer from the time_entries table."
},
{
"role": "assistant",
"content": "SELECT lawyer_id, SUM(hours_spent) AS total_hours\nFROM legal_services.time_entries\nWHERE is_billable = TRUE\nGROUP BY lawyer_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 legal_services.clients (
client_id character varying(64) NOT NULL, -- unique identifier for the client
first_n... |
[
{
"role": "user",
"content": "What is the count of customers for each state where the status is 'Active' and the created_at date is within the last 3 months?"
},
{
"role": "assistant",
"content": "SELECT state, COUNT(*) as customer_count FROM financial_services.customers WHERE status = 'Active' ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "List all accounts having both a loan and at least one transaction in the last 7 days. Show account_id, account_type, and the total number of transactions in that period."
},
{
"role": "assistant",
"content": "SELECT a.account_id, a.account_type, COUNT(t.transaction_... | You are an SQL statement expert. Given the table 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 pairs of time entries for the same case that were worked on the same date by different lawyers. Include both entry IDs, the case ID, the work date, and both lawyer IDs."
},
{
"role": "assistant",
"content": "SELECT t1.entry_id AS entry1_id, t2.entry_id AS e... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billi... |
[
{
"role": "user",
"content": "List all spa services available at properties in New York, along with their prices and property names."
},
{
"role": "assistant",
"content": "SELECT s.service_name, s.price, p.property_name FROM hospitality_technology.services s JOIN hospitality_technology.propertie... | You are an SQL statement expert. Given the table 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 the appointment ID, start time, and the case number for all appointments that are linked to a case."
},
{
"role": "assistant",
"content": "SELECT T1.appointment_id, T1.start_time, T2.case_number FROM legal_services.appointments AS T1 JOIN legal_services.cases 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 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": "Find all medical records associated with an appointment, and show the record_id, appointment_id, and the record_date."
},
{
"role": "assistant",
"content": "SELECT record_id, appointment_id, record_date\nFROM healthcare.medical_records\nWHERE appointment_id IS NOT N... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "List all distinct currency types used in payments."
},
{
"role": "assistant",
"content": "SELECT DISTINCT currency\nFROM government_services.payments;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "How many distinct users have ever participated in a conversation?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT user_id) AS distinct_participant_count\nFROM 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.follows ( follow_id.text, follower_user_id.text, following_user_id.text, created_at.timestamp )
CREATE TAB... |
[
{
"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": "I want to find each user’s total count of completed orders and the last action they logged."
},
{
"role": "assistant",
"content": "SELECT\n o.user_id,\n COUNT(*) AS completed_order_count,\n MAX(l.logged_at) AS last_log_time,\n (SELECT action\n FROM trading_pla... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan... |
[
{
"role": "user",
"content": "List all employees and their managers, showing the full name for both the employee and their manager."
},
{
"role": "assistant",
"content": "SELECT e.first_name || ' ' || e.last_name AS employee_name, m.first_name || ' ' || m.last_name AS manager_name FROM 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.transactions ( transaction_id character varying(64) NOT NULL, account_id character varying(64) NOT N... |
[
{
"role": "user",
"content": "Calculate the total payment amount grouped by payment_method."
},
{
"role": "assistant",
"content": "SELECT payment_method, SUM(amount) AS total_amount\nFROM hospitality_technology.payments\nGROUP BY payment_method;"
},
{
"role": "user",
"content": "Now ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat... |
[
{
"role": "user",
"content": "Show me the content and creation time of comments made on posts authored by the user with ID 'user_X'."
},
{
"role": "assistant",
"content": "SELECT T1.content, T1.created_at FROM social_media.comments AS T1 JOIN social_media.posts AS T2 ON T1.post_id = T2.post_id 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 social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "Give me the total billed amount for each invoice in 2024."
},
{
"role": "assistant",
"content": "SELECT invoice_id, SUM(hours_spent * billing_rate) AS total_billed_amount FROM legal_services.time_entries WHERE is_billed = TRUE AND EXTRACT(YEAR FROM date_worked) = 20... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries ( entry_id text PRIMARY KEY, case_id text, lawyer_id text, date_worked date, hours_spent nu... |
[
{
"role": "user",
"content": "How many unique email domains are there among all registered users?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT SUBSTRING(email FROM POSITION('@' IN email)+1)) AS unique_domains FROM blockchain.users;"
},
{
"role": "user",
"content": "Ca... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email character va... |
[
{
"role": "user",
"content": "Show me all active policies for customers who live in New York, along with their total premium payments made so far, and include the agent's full name."
},
{
"role": "assistant",
"content": "SELECT p.policy_id, p.policy_number, p.start_date, p.end_date, p.premium_am... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "List all law firms, showing their name, website, and the ID of their managing partner."
},
{
"role": "assistant",
"content": "SELECT firm_name, website, managing_partner_id FROM law_firms;"
},
{
"role": "user",
"content": "Only include firms where the ma... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "Could you list users who commented on posts tagged with hashtag 'H202', including each user’s email and the total number of comments they made?"
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, u.email, COUNT(c.comment_id) AS comment_count\nFROM 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": "List all customers (customer_id, first_name, last_name, email) who have a risk_profile of 'High' and an email address ending with '@gmail.com', along with their city and state information."
},
{
"role": "assistant",
"content": "SELECT customer_id, first_name, last_n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ... |
[
{
"role": "user",
"content": "Show the policy_id, policy_number, and premium_amount for all policies with a coverage_limit less than 100,000."
},
{
"role": "assistant",
"content": "SELECT policy_id, policy_number, premium_amount\nFROM insurance.policies\nWHERE coverage_limit < 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 insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d... |
[
{
"role": "user",
"content": "Which chain has the highest average ROI among all tokens in smart_money_token_performance? Show the chain and the average ROI."
},
{
"role": "assistant",
"content": "SELECT chain, AVG(roi) AS avg_roi\nFROM smart_money_token_performance\nGROUP BY chain\nORDER BY avg_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id text, project_id text, project_name text, rounds_name text, investment_value numeric, i... |
[
{
"role": "user",
"content": "Show the total number of contracts grouped by their status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) AS contract_count FROM web3.contracts GROUP BY status;"
},
{
"role": "user",
"content": "Can you also filter to only include 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 web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,... |
[
{
"role": "user",
"content": "How many medical records does each doctor have? Show doctor_id and record_count."
},
{
"role": "assistant",
"content": "SELECT doctor_id,\n COUNT(*) AS record_count\nFROM healthcare.medical_records\nGROUP BY doctor_id;"
},
{
"role": "user",
"conten... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records ( record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, appoi... |
[
{
"role": "user",
"content": "List the full names of patients who have ever been prescribed a medication manufactured by 'Novartis'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT p.first_name, p.last_name\nFROM healthcare.patients p\nJOIN healthcare.prescriptions pr ON p.patient_id = pr... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "List the total number of 'login' and 'logout' actions per user."
},
{
"role": "assistant",
"content": "SELECT user_id, SUM(CASE WHEN action = 'login' THEN 1 ELSE 0 END) AS login_count, SUM(CASE WHEN action = 'logout' THEN 1 ELSE 0 END) AS logout_count FROM trading_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 trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp )
|
[
{
"role": "user",
"content": "Show the full names and emails of staff members who have delivered at least one service order."
},
{
"role": "assistant",
"content": "SELECT DISTINCT s.first_name, s.last_name, s.work_email\nFROM hospitality_technology.staff s\nJOIN hospitality_technology.service_or... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "Show me the wallet addresses and their creation dates for wallets created in the last 30 days, sorted by creation date in descending order."
},
{
"role": "assistant",
"content": "SELECT address, created_at FROM web3.wallets WHERE created_at >= NOW() - INTERVAL '30 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 web3.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
|
[
{
"role": "user",
"content": "Give me a breakdown of available services by unit, with the count of services and the average price, grouped by property."
},
{
"role": "assistant",
"content": "SELECT property_id, unit, COUNT(*) AS service_count, AVG(price) AS avg_price 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.services ( service_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL... |
[
{
"role": "user",
"content": "Show the names and cities of all service locations, along with the agency ID, for locations whose postal code starts with '10'."
},
{
"role": "assistant",
"content": "SELECT location_name, city, agency_id FROM government_services.service_locations WHERE postal_code ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.service_locations (
location_id character varying(64) NOT NULL, -- unique identifier for the ph... |
[
{
"role": "user",
"content": "I'd like to see a list of users who have enabled email notifications."
},
{
"role": "assistant",
"content": "SELECT user_id FROM social_media.user_settings WHERE email_notifications_enabled = true;"
},
{
"role": "user",
"content": "Also, include those us... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.post_hashtags ( post_hashtag_id character varying(64) NOT NULL, post_id character varying(64) NOT NULL, ha... |
[
{
"role": "user",
"content": "List all users who have set their location to 'Berlin'."
},
{
"role": "assistant",
"content": "SELECT user_id, username, email, full_name, location\nFROM social_media.users\nWHERE location = 'Berlin';"
}
] | You are an SQL statement expert. Given the table 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": "List the full names of employees whose direct manager themselves report to another manager. Also show the direct manager's full name."
},
{
"role": "assistant",
"content": "SELECT E.first_name, E.last_name, M.first_name AS manager_first_name, M.last_name AS manager_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.employees ( employee_id text, agency_id text, first_name text, last_name text, job_title text, depa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.