conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "List the policy number, product name, and base premium for all policies sold by agents whose license state is 'TX'."
},
{
"role": "assistant",
"content": "SELECT p.policy_number, ip.product_name, ip.base_premium\nFROM insurance.policies p\nJOIN insurance.insurance_p... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "Show me the top 5 NFT collections with the highest floor price on Ethereum, along with their names and symbols, but only include collections with more than 10,000 tokens."
},
{
"role": "assistant",
"content": "SELECT name, symbol, floor_price FROM nft_collections WH... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "Can you show me all routes where the origin_location_id is the same as the destination_location_id? List their route_id, route_number, and type."
},
{
"role": "assistant",
"content": "SELECT route_id, route_number, type\nFROM transportation.routes\nWHERE origin_loca... | You are an SQL statement expert. Given the table 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 securities (security_id, ticker_symbol, security_name) that have a currency of 'EUR' and were last updated within the last 30 days, along with their exchange and sector information."
},
{
"role": "assistant",
"content": "SELECT security_id, ticker_symbol, s... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities (
security_id character varying(64) NOT NULL, -- unique identifier for the security
... |
[
{
"role": "user",
"content": "Show me the usernames of users who have the word 'explorer' in their bio."
},
{
"role": "assistant",
"content": "SELECT username\nFROM social_media.users\nWHERE bio ILIKE '%explorer%';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "List all guests with their loyalty_member_id and communication consent status."
},
{
"role": "assistant",
"content": "SELECT guest_id,\n first_name,\n last_name,\n loyalty_member_id,\n communication_consent\nFROM hospitality_technology.guests... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, la... |
[
{
"role": "user",
"content": "I need to find all pairs of medications that share the same manufacturer. For each pair, show the first medication's ID and name, the second medication's ID and name, and the manufacturer."
},
{
"role": "assistant",
"content": "SELECT m1.medication_id AS med1_id,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id text, medication_name text, generic_name text, manufacturer text, ndc_code text,... |
[
{
"role": "user",
"content": "List the names of services that have been scheduled at accessible service locations."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.service_name FROM government_services.services AS T1 JOIN government_services.appointments AS T2 ON T1.service_id = T2.serv... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth... |
[
{
"role": "user",
"content": "Provide a count of appointments grouped by their current 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.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Show me the total market cap and the total smart money inflow USD value for each narrative. Join the `token_basic_info` and `smart_money_token_inflow` tables based on narrative."
},
{
"role": "assistant",
"content": "WITH Narratives AS ( SELECT DISTINCT narrative FR... | 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 token_basic_info ( coin_id text, token_name text, token_symbol text, token_address t... |
[
{
"role": "user",
"content": "What is the total estimated_loss and average settlement_amount for all claims with status 'Approved'?"
},
{
"role": "assistant",
"content": "SELECT SUM(estimated_loss) AS total_estimated_loss,\n AVG(settlement_amount) AS average_settlement\nFROM insurance.clai... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d... |
[
{
"role": "user",
"content": "For each policy, find the latest payment date. Show the policy_id and the maximum payment_date."
},
{
"role": "assistant",
"content": "SELECT policy_id, MAX(payment_date) AS latest_payment_date FROM insurance.premium_payments GROUP BY policy_id;"
},
{
"role"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_id text, payment_date timestamp, amo... |
[
{
"role": "user",
"content": "Show me all players who do not have a last_login recorded. List their player_id, username, and registration_date."
},
{
"role": "assistant",
"content": "SELECT player_id, username, registration_date FROM gaming_technology.players WHERE last_login IS NULL;"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "Show me the name of each narrative and its 24-hour price change percentage."
},
{
"role": "assistant",
"content": "SELECT narrative, price_change_percentage_24h FROM narrative_info"
},
{
"role": "user",
"content": "Now, filter the list to only include na... | 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 token_basic_info ( coin_id.text, token_name.text, token_symbol.text, token_address.t... |
[
{
"role": "user",
"content": "Find consecutive pairs of trips for each vehicle based on the scheduled departure time."
},
{
"role": "assistant",
"content": "WITH RankedTrips AS (\n SELECT\n trip_id,\n vehicle_id,\n scheduled_departure,\n origin_location_id,\n destination_location... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var... |
[
{
"role": "user",
"content": "Can you list the number of appointments scheduled by each citizen, showing their first and last name?"
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, COUNT(a.appointment_id) AS appointment_count\nFROM government_services.citizens c\nLEFT JOI... | You are an SQL statement expert. Given the table 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": "List all users and the total value of all transactions they have initiated. Show user_id, username, and total_transaction_value."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, COALESCE(SUM(t.value), 0) AS total_transaction_value\nFROM web3.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.contracts (
contract_id character varying(64) NOT NULL, -- unique identifier for the contract
address cha... |
[
{
"role": "user",
"content": "Show all doctors whose license number starts with 'MD', including their ID, first name, and last name."
},
{
"role": "assistant",
"content": "SELECT doctor_id, first_name, last_name FROM healthcare.doctors WHERE license_number LIKE 'MD%';"
},
{
"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 healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch... |
[
{
"role": "user",
"content": "List each group conversation with its group name and the number of verified users who have posted in it."
},
{
"role": "assistant",
"content": "SELECT c.conversation_id, c.group_name, COUNT(DISTINCT u.user_id) AS verified_posters\nFROM social_media.conversations c\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "What is the number of active staff members in each position?"
},
{
"role": "assistant",
"content": "SELECT position,\n COUNT(*) AS staff_count\nFROM hospitality_technology.staff\nWHERE is_active = true\nGROUP BY position;"
},
{
"role": "user",
"con... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, fir... |
[
{
"role": "user",
"content": "List all payments processed in the last 90 days, showing payment ID, amount, currency, method, and status."
},
{
"role": "assistant",
"content": "SELECT payment_id, amount, currency_code, payment_method, status FROM hospitality_technology.payments WHERE payment_time... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "List the diagnosis ID, description, and diagnosis date for all non-chronic diagnoses recorded for patient 'pat123'."
},
{
"role": "assistant",
"content": "SELECT diagnosis_id, description, diagnosis_date FROM healthcare.diagnoses WHERE patient_id = 'pat123' AND is_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 healthcare.diagnoses ( diagnosis_id text, record_id text, patient_id text, doctor_id text, diagnosis_code text, code_ty... |
[
{
"role": "user",
"content": "List the plan name and contact phone for all insurance plans of type 'HMO'."
},
{
"role": "assistant",
"content": "SELECT plan_name, contact_phone\nFROM healthcare.insurance_plans\nWHERE plan_type = 'HMO';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.insurance_plans ( plan_id text PRIMARY KEY, plan_name text, insurance_provider text, plan_type text, contact... |
[
{
"role": "user",
"content": "Show the diagnosis codes, descriptions, and their corresponding insurance plan names for all chronic diagnoses."
},
{
"role": "assistant",
"content": "SELECT d.diagnosis_code, d.description, ip.plan_name\nFROM healthcare.diagnoses d\nJOIN healthcare.insurance_plans ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_ty... |
[
{
"role": "user",
"content": "What is the total number of unique manufacturers listed in the medications table?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT manufacturer) FROM healthcare.medications;"
},
{
"role": "user",
"content": "Could you also show the count of m... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id text PRIMARY KEY, medication_name text, generic_name text, manufacturer text, nd... |
[
{
"role": "user",
"content": "List all pairs of overlapping reservations for the same room, including both reservation IDs, room ID, and each reservation's check-in and check-out dates."
},
{
"role": "assistant",
"content": "SELECT r1.reservation_id AS reservation1_id,\n r2.reservation_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.reservations ( reservation_id.text, property_id.text, guest_id.text, room_id.text, room_type_id.... |
[
{
"role": "user",
"content": "How many users registered on each date?"
},
{
"role": "assistant",
"content": "SELECT DATE(created_at) AS registration_date, COUNT(*) AS user_count FROM web3.users GROUP BY DATE(created_at) ORDER BY registration_date;"
},
{
"role": "user",
"content": "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 web3.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
|
[
{
"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": "What are the maintenance costs for a specific aircraft model like the Airbus A320?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to data regarding maintenance costs for specific aircraft models such as the Airbus A320. The information in ... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.aircraft_mod... |
[
{
"role": "user",
"content": "Show me all premium payments made via credit card in the last 30 days, along with their payment amounts and transaction references."
},
{
"role": "assistant",
"content": "SELECT payment_id, amount_paid, transaction_reference FROM insurance.premium_payments WHERE pay... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.premium_payments ( payment_id.text, policy_id.text, customer_id.text, payment_date.timestamp, amount_paid.num... |
[
{
"role": "user",
"content": "Count users whose email address ends with '.com'."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM web3.users WHERE email LIKE '%.com';"
},
{
"role": "user",
"content": "Now, show me the username and email for those users instead of just the c... | 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.users ( user_id.text, username.text, email.text, password_hash.text, created_at... |
[
{
"role": "user",
"content": "List all addresses that have created smart contracts, showing the address ID and its current balance."
},
{
"role": "assistant",
"content": "SELECT T1.address_id, T1.balance FROM blockchain.addresses AS T1 JOIN blockchain.smart_contracts AS T2 ON T1.address_id = T2.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks (
block_id character varying(64) NOT NULL, -- unique identifier for the block
previous_block... |
[
{
"role": "user",
"content": "List the usernames of users who have joined a conversation and sent at least one message in it. Include the conversation_id for each."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, cp.conversation_id\nFROM social_media.conversation_participants 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.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ... |
[
{
"role": "user",
"content": "Show me the name of each property and the full name of the staff member assigned as its manager."
},
{
"role": "assistant",
"content": "SELECT T1.property_name, T2.first_name, T2.last_name FROM hospitality_technology.properties AS T1 JOIN hospitality_technology.staf... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "For each service category, count the number of appointments scheduled in the next 7 days. Return the category and appointment count."
},
{
"role": "assistant",
"content": "SELECT s.category, COUNT(a.appointment_id) AS upcoming_appointments\nFROM government_services.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services ( service_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "Show me policies that have at least one overdue premium payment, including policy_number, customer full name, agent_id, due_date, and days overdue."
},
{
"role": "assistant",
"content": "SELECT p.policy_number,\n c.first_name || ' ' || c.last_name AS customer_... | You are an SQL statement expert. Given the table 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": "Show the total balance for each SUI coin across all owners. Group by coin_type."
},
{
"role": "assistant",
"content": "SELECT coin_type,\n SUM(CAST(balance AS DECIMAL)) AS total_balance\nFROM sui_coins\nGROUP BY coin_type;"
},
{
"role": "user",
"co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "Find all transactions where the amount is greater than 1000 and the receiver_address starts with '0x1'."
},
{
"role": "assistant",
"content": "SELECT * FROM blockchain.transactions WHERE amount > 1000 AND receiver_address LIKE '0x1%';"
},
{
"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.transactions ( transaction_id text PRIMARY KEY, block_id text, sender_address text, receiver_address text, a... |
[
{
"role": "user",
"content": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 12 months, along with their token symbol and price from the token_basic_info table."
},
{
"role": "assistant",
"content": "SELECT pfr.project_name, pfr.valuation, tbi.token_symbol,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE project_fundraising_record (",
"id character varying(32) NOT NULL, -- fundraising record id",
"project_id ch... |
[
{
"role": "user",
"content": "Show me all Sui NFTs with status 'exists', including their object_id, name, owner, and collection_type."
},
{
"role": "assistant",
"content": "SELECT object_id, name, owner, collection_type FROM sui_nfts WHERE status = 'exists';"
},
{
"role": "user",
"co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "How many policies were canceled in the previous month, grouped by cancellation reason?"
},
{
"role": "assistant",
"content": "SELECT cancellation_reason,\n COUNT(*) AS canceled_count\nFROM insurance.policies\nWHERE cancellation_date BETWEEN date_trunc('month',... | You are an SQL statement expert. Given the table 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 a summary of all clients with the total number of invoices they've received and the sum of total_amount for those invoices."
},
{
"role": "assistant",
"content": "SELECT cl.client_id,\n CONCAT(cl.first_name, ' ', cl.last_name) AS client_name,\n 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.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "Count the total number of distinct specialties listed in the doctors table."
},
{
"role": "assistant",
"content": "SELECT count(DISTINCT specialty) FROM healthcare.doctors;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"role": "user",
"content": "Display the name and type of each location, as well as the earliest and latest maintenance service_date for vehicles assigned to that location (assuming vehicle_id matches location_id)."
},
{
"role": "assistant",
"content": "SELECT l.name, l.type,\n MIN(m.serv... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_pro... |
[
{
"role": "user",
"content": "Find all smart contracts created by addresses that have sent more than 1000 transactions."
},
{
"role": "assistant",
"content": "SELECT sc.* FROM blockchain.smart_contracts sc JOIN (SELECT sender_address FROM blockchain.transactions GROUP BY sender_address HAVING CO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.transactions ( transaction_id character varying(64) NOT NULL, block_id character varying(64) NOT NULL, sende... |
[
{
"role": "user",
"content": "Show all patient insurance records including the policy number, effective date, and the name of the associated insurance plan."
},
{
"role": "assistant",
"content": "SELECT T1.policy_number, T1.effective_date, T2.plan_name FROM healthcare.patient_insurance AS T1 JOI... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patient_insurance (
patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p... |
[
{
"role": "user",
"content": "Can you provide the total number of cars associated with a specific train with train_id 'train_789'?"
},
{
"role": "assistant",
"content": "SCARD train:train_789:cars"
}
] | 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": "Show me all active customers from California who were born before 1980, along with their contact information."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, phone_number, email, address_line1, city, zip_code FROM insurance.customers WHERE state... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "Show me all trips that were completed with vehicles manufactured after 2020, including the vehicle make and model."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, v.make, v.model FROM transportation.trips t JOIN transportation.vehicles v ON t.vehicle_id = v... | You are an SQL statement expert. Given the table 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": "List all patients who have a current prescription that was prescribed by a doctor with a specialty of 'Endocrinology'. Show patient full name, prescription ID, medication name, and prescription date."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.firs... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id text, patient_id text, doctor_id text, appointment_time timestamp, duration_mi... |
[
{
"role": "user",
"content": "List all inactive customers from California, showing their full names and the date they were created."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, created_at FROM insurance.customers WHERE state = 'California' AND status = 'Inactive';"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "Could you provide a report showing each in-game item's name and the total quantity currently held in player inventories?"
},
{
"role": "assistant",
"content": "SELECT ii.item_name, SUM(pi.quantity) AS total_held FROM gaming_technology.player_inventory pi JOIN gaming... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea... |
[
{
"role": "user",
"content": "Show me each participant in group chats with their username, conversation ID, join date, and last read date."
},
{
"role": "assistant",
"content": "SELECT cp.conversation_id, u.username, cp.joined_at, cp.last_read_at\nFROM social_media.conversation_participants cp\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "List all documents along with the document type and the case name they are associated with."
},
{
"role": "assistant",
"content": "SELECT d.document_name, d.document_type, c.case_name\nFROM legal_services.documents d\nJOIN legal_services.cases c ON d.case_id = c.cas... | You are an SQL statement expert. Given the table 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": "For each vehicle, find the vehicle acquired immediately before it in the same depot. Show current vehicle_id, acquisition_date, previous_vehicle_id, and previous_acquisition_date."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id,\n v.acquisition_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 transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"role": "user",
"content": "Show me service orders and any associated review comments for reservation ID 'RES007'. List the order ID, service ID, quantity, total price from the order, and the review comment if available."
},
{
"role": "assistant",
"content": "SELECT so.order_id, 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.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i... |
[
{
"role": "user",
"content": "Show the first name, last name, and job title for all employees working for agencies with a jurisdiction level of 'State'."
},
{
"role": "assistant",
"content": "SELECT e.first_name, e.last_name, e.job_title FROM government_services.employees e JOIN government_servi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_e... |
[
{
"role": "user",
"content": "List the number of bookings for each day."
},
{
"role": "assistant",
"content": "SELECT DATE(booking_time) AS booking_date, COUNT(*) AS booking_count\nFROM transportation.bookings\nGROUP BY DATE(booking_time);\n"
},
{
"role": "user",
"content": "Now only... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.bookings ( booking_id.text, passenger_id.text, trip_id.text, seat_number.text, booking_time.timestamp, s... |
[
{
"role": "user",
"content": "List all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and have a daily trading volume exceeding 1 million shares, along with the employee details (employee_id, first_name, last_name) who last updated these securities."
},
{
... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, customer_id text, account_number text, account_type text, ba... |
[
{
"role": "user",
"content": "List all claims along with the first and last names of the agent who is currently handling each claim."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.policy_id, c.incident_date, a.first_name AS agent_first_name, a.last_name AS agent_last_name\nFROM insu... | You are an SQL statement expert. Given the table 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": "Find reservations where the same guest has overlapping stays in the same property."
},
{
"role": "assistant",
"content": "SELECT r1.reservation_id AS res1,\n r2.reservation_id AS res2,\n r1.guest_id,\n r1.property_id\nFROM hospitality_technology.re... | You are an SQL statement expert. Given the table 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, property_id text, guest_id text, room_id text, room_type_id ... |
[
{
"role": "user",
"content": "How many posts are marked with 'unlisted' visibility?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.posts WHERE visibility = 'unlisted';"
}
] | You are an SQL statement expert. Given the table 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": "List the names of active services and their categories provided by agencies with a 'Federal' jurisdiction level."
},
{
"role": "assistant",
"content": "SELECT T1.service_name, T1.category FROM government_services.services AS T1 JOIN government_services.agencies AS T... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Which insurance products have 'comprehensive' in their coverage details? Show the product_id and product_name."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name FROM insurance.insurance_products WHERE coverage_details ILIKE '%comprehensive%';"
... | You are an SQL statement expert. Given the table 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": "For each maintenance log, find the upcoming scheduled service by joining on next_service_due_date matching another log's service_date. Show l1.log_id, l1.vehicle_id, l1.service_date, l2.log_id AS upcoming_log_id, and l2.service_date AS upcoming_service_date."
},
{
"role... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id text, vehicle_id text, service_date date, odometer_reading integer, service_ty... |
[
{
"role": "user",
"content": "Find all wallets that were created on the same day and list their wallet IDs, addresses, and the creation date."
},
{
"role": "assistant",
"content": "SELECT w1.wallet_id, w1.address, w1.created_at::date AS creation_date FROM web3.wallets w1 JOIN (SELECT 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 web3.wallets (
wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet
user_id character... |
[
{
"role": "user",
"content": "Which games released on 'Xbox Series X' have at least one achievement worth more than 50 points?"
},
{
"role": "assistant",
"content": "SELECT DISTINCT g.game_id, g.title, g.release_date\nFROM gaming_technology.games g\nJOIN gaming_technology.achievements a ON g.gam... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "Find all patients who have never had a medical record entry. Show patient_id, first_name, and last_name."
},
{
"role": "assistant",
"content": "SELECT p.patient_id,\n p.first_name,\n p.last_name\nFROM healthcare.patients p\nLEFT JOIN healthcare.medical_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 healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "Find pairs of events within the same transaction that have the same event name but were emitted by different contracts. List the transaction ID, the shared event name, the IDs of both events, and the IDs of their respective contracts."
},
{
"role": "assistant",
"con... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "List all bookings with the first and last name of the passenger and trip_id."
},
{
"role": "assistant",
"content": "SELECT b.booking_id, b.trip_id, p.first_name, p.last_name\nFROM transportation.bookings b\nJOIN transportation.passengers p ON b.passenger_id = p.pass... | You are an SQL statement expert. Given the table 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": "List the document name, upload timestamp, and the full name of the lawyer who uploaded it, for all documents associated with case number 'CASE123'."
},
{
"role": "assistant",
"content": "SELECT T1.document_name , T1.upload_timestamp , T2.full_name FROM legal_servi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "What are the safety ratings or crash statistics for the Boeing 787 Dreamliner?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to safety ratings or crash statistics for specific aircraft models like the Boeing 787 Dreamliner. My data is lim... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.aircraft_mod... |
[
{
"role": "user",
"content": "Show the symbol and current balance for all ERC20 tokens held by wallet '0x...abc'."
},
{
"role": "assistant",
"content": "SELECT T2.symbol, T1.amount FROM erc20_balances AS T1 INNER JOIN token_metas AS T2 ON T1.contract_address = T2.contract_address WHERE T1.wallet... | 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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text,... |
[
{
"role": "user",
"content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens with decimals equal to 18."
},
{
"role": "assistant",
"content": "SELECT name, contract_address, total_supply FROM token_metas 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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "I want to get the number of servers and the average current players for each game, including the game title."
},
{
"role": "assistant",
"content": "SELECT g.title,\n COUNT(s.server_id) AS server_count,\n AVG(s.current_players) AS avg_current_players\nFRO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "Show me all trips that were delayed by more than 30 minutes, along with their vehicle and driver details, and include the origin and destination city names."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, t.vehicle_id, t.driver_id, t.scheduled_departure, 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.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var... |
[
{
"role": "user",
"content": "Which centralized exchange holds the highest total USD value of tokens on the Ethereum chain, and what is the total value?"
},
{
"role": "assistant",
"content": "SELECT exchange, SUM(usd_value) AS total_usd_value FROM cex_token_balance WHERE chain = 'Ethereum' GROUP... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE cex_token_balance (",
"snapshot_time character varying(32) NOT NULL, -- the snapshot time of record, converted ... |
[
{
"role": "user",
"content": "Find all medical records where the treatment plan includes 'physical therapy' and the patient has an active primary insurance plan, showing the patient ID, record date, and insurance provider details."
},
{
"role": "assistant",
"content": "SELECT mr.patient_id, mr.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 healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "Show me all active managers along with the count of staff members they supervise, ordered by the supervised staff count in descending order."
},
{
"role": "assistant",
"content": "SELECT s1.staff_id, s1.first_name, s1.last_name, COUNT(s2.staff_id) AS supervised_staf... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id.text, first_name.text, last_name.text, email.text, phone_number.text, date_of_... |
[
{
"role": "user",
"content": "Give me the list of DApp names and URLs whose description contains any asset symbol from the assets table."
},
{
"role": "assistant",
"content": "SELECT DISTINCT d.name, d.url\nFROM trading_platform.dapps d\nJOIN trading_platform.assets a ON d.description ILIKE '%' ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.assets (
asset_id character varying(64) NOT NULL, -- unique identifier for the asset
name cha... |
[
{
"role": "user",
"content": "List all past appointments, including the scheduled time, the name of the service, and the name of the location where they took place."
},
{
"role": "assistant",
"content": "SELECT T1.scheduled_start_time, T2.service_name, T3.location_name FROM government_services.a... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "List the name, city, and country of all locations where at least one vehicle is currently assigned (i.e., depot_id matches location_id)."
},
{
"role": "assistant",
"content": "SELECT l.name, l.city, l.country\nFROM transportation.locations l\nJOIN transportation.veh... | You are an SQL statement expert. Given the table 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 all log IDs and service dates for maintenance logs where the next service due date is not recorded."
},
{
"role": "assistant",
"content": "SELECT log_id , service_date FROM transportation.maintenance_logs WHERE next_service_due_date IS NULL"
},
{
"role... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "Compute the total invoiced amount and average payment delay (in days) by status for invoices issued between 2024-01-01 and 2024-06-30."
},
{
"role": "assistant",
"content": "SELECT status,\n SUM(total_amount) AS total_invoiced,\n AVG(EXTRACT(day FROM (pa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_... |
[
{
"role": "user",
"content": "I want to list each public post along with its content, the author's username, and the total number of comments it has received. Order the results by comment count descending."
},
{
"role": "assistant",
"content": "SELECT p.post_id,\n u.username,\n p.con... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "For each game, which server has hosted the most sessions?"
},
{
"role": "assistant",
"content": "SELECT game_id, server_id, COUNT(*) AS session_count FROM gaming_technology.game_sessions GROUP BY game_id, server_id;"
},
{
"role": "user",
"content": "I wa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.game_sessions ( session_id uuid, player_id uuid, game_id uuid, server_id uuid, start_time timestamp w... |
[
{
"role": "user",
"content": "What is the average investment value for projects that completed Series A funding rounds?"
},
{
"role": "assistant",
"content": "SELECT AVG(investment_value) AS average_investment FROM project_fundraising_record WHERE rounds_name = 'Series 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 project_fundraising_record (",
"id character varying(32) NOT NULL, -- fundraising record id",
"project_id ch... |
[
{
"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": "List appointment_id, appointment_time, patient\\u2019s full name, and doctor\\u2019s specialty for all appointments scheduled in the next 7 days."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, a.appointment_time, p.first_name || ' ' || p.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 healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "How many lawyers who are partners were hired in each year? Show the hire year and the count."
},
{
"role": "assistant",
"content": "SELECT strftime('%Y', hire_date) AS hire_year , count(lawyer_id) FROM legal_services.lawyers WHERE is_partner = true GROUP BY hire_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers (
lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer
first_n... |
[
{
"role": "user",
"content": "Find all smart contracts where the code length is greater than 1000 characters."
},
{
"role": "assistant",
"content": "SELECT contract_id, creator_address, LENGTH(code) AS code_length FROM blockchain.smart_contracts WHERE LENGTH(code) > 1000;"
},
{
"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 blockchain.smart_contracts ( contract_id.text, creator_address.text, code.text, timestamp.timestamp )
|
[
{
"role": "user",
"content": "Show me all maintenance logs for 'Oil Change' services performed in the last 3 months, including the vehicle ID, service date, and cost."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE service_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.maintenance_logs (
log_id character varying(64) NOT NULL, -- unique identifier for the maintenance ... |
[
{
"role": "user",
"content": "For each group conversation, get the latest message's sender_user_id and sent_at, including conversation_id and group_name."
},
{
"role": "assistant",
"content": "SELECT c.conversation_id, c.group_name, m.sender_user_id, m.sent_at\nFROM social_media.conversations 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.posts ( post_id text PRIMARY KEY, user_id text, content text, media_url text, media_type text, created_at ... |
[
{
"role": "user",
"content": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 6 months, along with their latest round name and investment value."
},
{
"role": "assistant",
"content": "SELECT project_name, rounds_name, investment_value, valuation FROM project... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE project_fundraising_record (",
"id character varying(32) NOT NULL, -- fundraising record id",
"project_id ch... |
[
{
"role": "user",
"content": "Show me all properties in California with a star rating above 3.5, along with their room types and base rates."
},
{
"role": "assistant",
"content": "SELECT p.property_name, p.city, p.star_rating, rt.type_name, rt.base_rate FROM hospitality_technology.properties p J... | You are an SQL statement expert. Given the table 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": "Which posts have been tagged with more than 3 hashtags? Return the post_id and the number of hashtags."
},
{
"role": "assistant",
"content": "SELECT post_id, COUNT(hashtag_id) AS hashtag_count\nFROM social_media.post_hashtags\nGROUP BY post_id\nHAVING COUNT(hashtag_... | You are an SQL statement expert. Given the table 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": "How many unique wallets hold each NFT (by contract_address and token_id) currently?"
},
{
"role": "assistant",
"content": "SELECT contract_address, token_id, COUNT(DISTINCT wallet_address) AS holder_count\nFROM nft_holders\nGROUP BY contract_address, token_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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "I need the total traded value (quantity * price) for each buyer and asset symbol for trades after '2024-06-01'. List buyer_id, asset symbol, and total_value."
},
{
"role": "assistant",
"content": "SELECT t.buyer_id, m.value AS asset_symbol, SUM(t.quantity * t.price)... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, user_id character varying(64) NOT NULL, wallet_id ch... |
[
{
"role": "user",
"content": "List all insurance plans where the plan_type is 'EPO', showing plan_id, plan_name, and insurance_provider."
},
{
"role": "assistant",
"content": "SELECT plan_id, plan_name, insurance_provider\nFROM healthcare.insurance_plans\nWHERE plan_type = 'EPO';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "For each user, show their username, email, and the number of posts they've created that contain at least one hashtag. Only include users who have created such posts."
},
{
"role": "assistant",
"content": "SELECT u.username, u.email, COUNT(DISTINCT p.post_id) AS post... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.