conversations listlengths 2 8 | system stringlengths 276 8.23k |
|---|---|
[
{
"role": "user",
"content": "List the first and last name of each citizen along with the city and state of the service location for their agency."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, sl.city, sl.state\nFROM government_services.citizens c\nJOIN government_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": "List all maintenance logs for vehicles that had 'Oil Change' service in the last 3 months, showing vehicle ID, service date, and cost."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE service_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 transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens... |
[
{
"role": "user",
"content": "How many trips are there for each driver?"
},
{
"role": "assistant",
"content": "SELECT driver_id, COUNT(*) AS trip_count FROM transportation.trips GROUP BY driver_id;"
},
{
"role": "user",
"content": "Can you also show the total number of completed trip... | You are an SQL statement expert. Given the table 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, -- unique identifier for a specific trip instance
... |
[
{
"role": "user",
"content": "Find pairs of routes where the destination of one route matches the origin of another. Show the first_route_number, first_description, second_route_number, and second_description."
},
{
"role": "assistant",
"content": "SELECT r1.route_number AS first_route_number, 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 transportation.routes (
route_id character varying(64) NOT NULL, -- unique identifier for the route
route_numb... |
[
{
"role": "user",
"content": "Find appointments that are longer than 30 minutes."
},
{
"role": "assistant",
"content": "SELECT * FROM legal_services.appointments WHERE end_time IS NOT NULL AND start_time IS NOT NULL AND end_time > start_time + INTERVAL '30 minutes'"
}
] | You are an SQL statement expert. Given the table 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": "Which staff members ordered more than 5 service orders in total? List their staff_id, full name, and the total number of orders they've placed."
},
{
"role": "assistant",
"content": "SELECT s.staff_id, s.first_name, s.last_name, COUNT(so.order_id) AS total_orders\nF... | You are an SQL statement expert. Given the table 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": "For each asset, show its name and symbol, and the total number of completed orders that have resulted in at least one trade."
},
{
"role": "assistant",
"content": "SELECT a.name, a.symbol, COUNT(DISTINCT o.order_id) AS completed_order_count\nFROM trading_platform.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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
CREATE ... |
[
{
"role": "user",
"content": "List all food and beverage services (category = 'Food & Beverage') with their names, prices, and units, where the price is less than $20."
},
{
"role": "assistant",
"content": "SELECT service_name, price, unit FROM hospitality_technology.services WHERE category = '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 hospitality_technology.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ... |
[
{
"role": "user",
"content": "Find all users who registered with a Yahoo email address, along with their registration dates."
},
{
"role": "assistant",
"content": "SELECT user_id, username, email, password_hash FROM blockchain.users WHERE email LIKE '%@yahoo.com';"
},
{
"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.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic... |
[
{
"role": "user",
"content": "For all NFT collections on the Ethereum blockchain, show me the collection name and the current floor price. Sort by floor price descending."
},
{
"role": "assistant",
"content": "SELECT name, floor_price FROM nft_collections WHERE blockchain = 'Ethereum' ORDER BY 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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "Show me all invoices where the amount paid is exactly equal to the total amount."
},
{
"role": "assistant",
"content": "SELECT * FROM legal_services.invoices WHERE amount_paid = total_amount;"
},
{
"role": "user",
"content": "Instead, show only the invoi... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the invoice
invo... |
[
{
"role": "user",
"content": "Show me all invoices where the notes field is not null. Display invoice number, client ID, and notes."
},
{
"role": "assistant",
"content": "SELECT invoice_number, client_id, notes FROM legal_services.invoices WHERE notes IS NOT NULL;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices ( invoice_id text, invoice_number text, client_id text, case_id text, issue_date date, due_date... |
[
{
"role": "user",
"content": "Which route numbers connect locations with a distance less than 80 km and more than 5 words in their description? Include the route type in the results."
},
{
"role": "assistant",
"content": "SELECT route_number, type FROM transportation.routes WHERE distance_km < 8... | You are an SQL statement expert. Given the table 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": "Which token has the highest net USD value difference between buys and sells? Show token_symbol, chain, narrative, average buy price, average sell price, and the net difference."
},
{
"role": "assistant",
"content": "WITH buys AS (\n SELECT token_address, token_symb... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE smart_money_token_inflow (",
"token_address character varying(100) NOT NULL, -- the token's address",
"token... |
[
{
"role": "user",
"content": "List all ERC20 tokens where the price is between $1 and $10, including their names, symbols, and contract addresses."
},
{
"role": "assistant",
"content": "SELECT tm.name, tm.symbol, tm.contract_address FROM token_metas tm JOIN token_prices_latest tpl ON tm.contract... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"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": "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 text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "List all posts that have received at least one like and at least one comment, showing the post_id and the total number of likes and comments each has."
},
{
"role": "assistant",
"content": "SELECT p.post_id, COUNT(DISTINCT l.like_id) AS like_count, COUNT(DISTINCT 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.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "How many claims were reported in the last 90 days?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM claims WHERE reported_date >= CURRENT_DATE - INTERVAL '90 days'"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c... |
[
{
"role": "user",
"content": "For each claim, show the corresponding product_type of the insurance product for the related policy."
},
{
"role": "assistant",
"content": "SELECT cl.claim_id, ip.product_type\nFROM insurance.claims cl\nJOIN insurance.policies p ON cl.policy_id = p.policy_id\nJOIN i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "For each patient, find the next appointment after each one. Return patient_id, appointment_id, next_appointment_id, and the waiting time in minutes between them."
},
{
"role": "assistant",
"content": "SELECT A.patient_id,\n A.appointment_id AS current_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.appointments ( appointment_id text PRIMARY KEY, patient_id text, doctor_id text, appointment_time timestamp,... |
[
{
"role": "user",
"content": "Find all medical records where the vitals JSON field contains a blood pressure reading with systolic higher than 140, and show the patient_id, record_date, and vitals."
},
{
"role": "assistant",
"content": "SELECT patient_id, record_date, vitals FROM healthcare.medi... | You are an SQL statement expert. Given the table 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": "I need to identify pairs of verified documents submitted by the same citizen. For each pair, display the citizen_id, the earlier document_id with its verification timestamp, and the later document_id with its verification timestamp."
},
{
"role": "assistant",
"conte... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz... |
[
{
"role": "user",
"content": "List the usernames and emails of all users who registered on '2023-03-15'."
},
{
"role": "assistant",
"content": "SELECT username, email FROM web3.users WHERE DATE(created_at) = '2023-03-15';"
},
{
"role": "user",
"content": "Instead of the list, can you... | You are an SQL statement expert. Given the table 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 users have posted content in the same location (latitude and longitude) on the same day? Show their usernames, post_ids, and the posting date."
},
{
"role": "assistant",
"content": "SELECT u1.username AS username1, u2.username AS username2, p1.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 text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "What is the current operational status of the train car with car_id 'CAR123'?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the current operational status of the train car with car_id 'CAR123'. The data in the train_cars table ... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.t... |
[
{
"role": "user",
"content": "What is the schedule of trains arriving at platform 1A at station XYZ on December 25th, 2023?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information about train schedules or specific arrival times as this data is not included in the platfo... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.p... |
[
{
"role": "user",
"content": "List the full names of customers along with the count of their active policies, but only include those customers with at least 3 active policies."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, COUNT(p.policy_id) AS active_policy_count\nFROM... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "Find all documents that are larger than 5MB. Show the document ID, claim ID, file name, and file size in bytes."
},
{
"role": "assistant",
"content": "SELECT document_id, claim_id, file_name, file_size_bytes\nFROM insurance.claim_documents\nWHERE file_size_bytes > 5... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara... |
[
{
"role": "user",
"content": "Find the average percentage share among all beneficiaries for each distinct relationship type."
},
{
"role": "assistant",
"content": "SELECT relationship, AVG(percentage_share) FROM insurance.policy_beneficiaries GROUP BY relationship ORDER BY relationship;"
}
] | You are an SQL statement expert. Given the table 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 all public reviews including the property name, guest full name, overall rating, and comment."
},
{
"role": "assistant",
"content": "SELECT T2.property_name, T3.first_name || ' ' || T3.last_name AS guest_full_name, T1.rating_overall, T1.comment FROM hospitality... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "List all pairs of cases that share the same court jurisdiction, including both case names and their common jurisdiction."
},
{
"role": "assistant",
"content": "SELECT c1.case_name AS case_name_1, c2.case_name AS case_name_2, c1.court_jurisdiction\nFROM legal_service... | You are an SQL statement expert. Given the table 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": "How many hashtags have been created in March 2024?"
},
{
"role": "assistant",
"content": "```sql\nSELECT COUNT(*) AS march_2024_hashtag_count\nFROM social_media.hashtags\nWHERE created_at >= '2024-03-01'\n AND created_at < '2024-04-01';\n```"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "Find the address that has the highest total amount across all its UTXOs."
},
{
"role": "assistant",
"content": "SELECT address FROM utxos GROUP BY address ORDER BY SUM(amount) DESC LIMIT 1;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "For projects that have completed more than one fundraising round, calculate the average investment value across all their recorded rounds. Display the project name and this average value."
},
{
"role": "assistant",
"content": "SELECT project_name, AVG(investment_val... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "List all documents uploaded for cases handled in the 'District Court' jurisdiction, showing the document name, case number, and upload timestamp."
},
{
"role": "assistant",
"content": "SELECT d.document_name, cs.case_number, d.upload_timestamp\nFROM legal_services.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 legal_services.clients (
client_id character varying(64) NOT NULL, -- unique identifier for the client
first_n... |
[
{
"role": "user",
"content": "For each driver, show their driver_id, first_name, last_name, along with any other driver whose license_expiry_date is earlier than theirs."
},
{
"role": "assistant",
"content": "SELECT d1.driver_id AS driver_id,\n d1.first_name,\n d1.last_name,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... |
[
{
"role": "user",
"content": "List all insurance products that have no active policies currently."
},
{
"role": "assistant",
"content": "SELECT ip.product_id, ip.product_name, ip.product_type FROM insurance.insurance_products ip LEFT JOIN insurance.policies p ON ip.product_id = p.product_id AND ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE 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 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": "Provide a count of citizens registered per calendar year."
},
{
"role": "assistant",
"content": "SELECT CAST(EXTRACT(YEAR FROM registration_date) AS INTEGER) AS registration_year, COUNT(*) AS citizen_count FROM government_services.citizens GROUP BY 1 ORDER BY 1;"
... | You are an SQL statement expert. Given the table 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": "I want to see the total sum of transaction amounts and their average amount for each transaction_type along with the total number of transactions, grouped by currency."
},
{
"role": "assistant",
"content": "SELECT transaction_type, currency, COUNT(*) AS total_transa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.transactions ( transaction_id text, account_id text, related_account_id text, transaction_type text,... |
[
{
"role": "user",
"content": "Show the number of lawyers hired in each year."
},
{
"role": "assistant",
"content": "SELECT EXTRACT(YEAR FROM hire_date) AS hire_year, COUNT(*) AS lawyer_count FROM legal_services.lawyers GROUP BY hire_year ORDER BY hire_year;"
},
{
"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 legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t... |
[
{
"role": "user",
"content": "List all patients who have been diagnosed with chronic conditions, including their diagnosis descriptions and dates."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, d.description, d.diagnosis_date FROM healthcare.patients p JOIN healthcare.d... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Show me all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and belong to the 'Technology' sector, along with their last_updated timestamp."
},
{
"role": "assistant",
"content": "SELECT security_id, ticker_symbol, securi... | You are an SQL statement expert. Given the table 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, ticker_symbol character varying(20) NOT NUL... |
[
{
"role": "user",
"content": "Show me each product_type along with the count of products for that type, but only include types where the average base_premium exceeds 500. Order the results by the product count in descending order."
},
{
"role": "assistant",
"content": "SELECT product_type,\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.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"role": "user",
"content": "List all auto loans (loan_id, principal_amount, interest_rate) where the current principal balance is less than 40% of the original principal amount, along with the account_id and the difference between principal_amount and current_principal_balance."
},
{
"role": "assi... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, account_id character varying(64) NOT NULL UNIQUE, lo... |
[
{
"role": "user",
"content": "List all patients who have insurance plans with group numbers, showing their patient IDs and the count of such plans per patient."
},
{
"role": "assistant",
"content": "SELECT patient_id, COUNT(*) AS plan_count FROM healthcare.patient_insurance WHERE group_number IS... | You are an SQL statement expert. Given the table 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": "Show me the user ID, wallet ID, address ID, and the transaction ID for transactions where the sender address is linked to an address associated with a wallet."
},
{
"role": "assistant",
"content": "SELECT DISTINCT w.user_id, w.wallet_id, w.address_id, t.transaction_... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp tim... |
[
{
"role": "user",
"content": "Can you show me the user IDs and their theme settings for all users who have enabled email notifications and have updated their settings in 2024?"
},
{
"role": "assistant",
"content": "SELECT user_id, theme FROM social_media.user_settings WHERE email_notifications_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 social_media.user_settings ( setting_id text PRIMARY KEY, user_id text, theme text, email_notifications_enabled bool, p... |
[
{
"role": "user",
"content": "List all insurance products that have 'auto' in their product type and are currently active, showing their product name and base premium."
},
{
"role": "assistant",
"content": "SELECT product_name, base_premium FROM insurance.insurance_products WHERE product_type LI... | You are an SQL statement expert. Given the table 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.