conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Show me all loans with a term longer than 36 months, including their loan_id, account_id, and principal_amount."
},
{
"role": "assistant",
"content": "SELECT loan_id, account_id, principal_amount FROM financial_services.loans WHERE term_months > 36;"
},
{
"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 financial_services.loans ( loan_id text, account_id text, loan_type text, principal_amount numeric, current_principal_b... |
[
{
"role": "user",
"content": "List all loans originated after '2023-01-01' with a loan type of 'Auto'."
},
{
"role": "assistant",
"content": "SELECT * FROM financial_services.loans WHERE origination_date > '2023-01-01' AND loan_type = 'Auto'"
},
{
"role": "user",
"content": "Sort the... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.loans ( loan_id.text, account_id.text, loan_type.text, principal_amount.numeric, current_principal_b... |
[
{
"role": "user",
"content": "Show me the top 5 projects by valuation that have completed fundraising rounds in the last 6 months, along with their token symbol and current price from the token_basic_info table."
},
{
"role": "assistant",
"content": "SELECT pfr.project_name, pfr.valuation, tbi.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 project_fundraising_record (",
"id character varying(32) NOT NULL, -- fundraising record id",
"project_id ch... |
[
{
"role": "user",
"content": "List all distinct email domains found in the user email addresses."
},
{
"role": "assistant",
"content": "SELECT DISTINCT SUBSTRING(email, INSTR(email, '@') + 1) AS email_domain FROM web3.users;"
},
{
"role": "user",
"content": "For each domain, show the... | 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 the application ID, citizen ID, assigned employee's full name, and total amount paid for each approved application."
},
{
"role": "assistant",
"content": "SELECT a.application_id,\n a.citizen_id,\n e.first_name || ' ' || e.last_name AS employee_name... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_e... |
[
{
"role": "user",
"content": "Show the total payment amount per currency for payments that are either 'Pending' or 'Failed', grouped by currency_code."
},
{
"role": "assistant",
"content": "SELECT currency_code, SUM(amount) AS total_payment_amount\nFROM hospitality_technology.payments\nWHERE sta... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.reservations ( reservation_id text PRIMARY KEY, property_id text, guest_id text, room_id text, r... |
[
{
"role": "user",
"content": "Get each user's ID, the count of wallets they own, and the total amount of their unspent UTXOs across all wallets."
},
{
"role": "assistant",
"content": "SELECT w.user_id,\n COUNT(DISTINCT w.wallet_id) AS wallet_count,\n COA... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets (
wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet
user_... |
[
{
"role": "user",
"content": "Show me the top 5 users who have been involved in trades as both buyers and sellers, along with their email addresses and the count of trades they participated in each role."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, \n COUNT(DISTINCT CA... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "What is the average project valuation for each round name in 2023?"
},
{
"role": "assistant",
"content": "SELECT rounds_name, AVG(valuation) AS avg_valuation\nFROM project_fundraising_record\nWHERE investment_date LIKE '2023-%'\nGROUP BY rounds_name;"
},
{
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "List all pairs of law firms founded in the same year, showing both firm names and their shared founding year."
},
{
"role": "assistant",
"content": "SELECT lf1.firm_name AS firm1, lf2.firm_name AS firm2, EXTRACT(YEAR FROM lf1.founded_date) AS founded_year\nFROM lega... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms ( firm_id text PRIMARY KEY, firm_name text, address text, phone text, website text, founded_da... |
[
{
"role": "user",
"content": "For each contract, can you show the number of different types of events it has emitted along with the contract ID?"
},
{
"role": "assistant",
"content": "SELECT contract_id, COUNT(DISTINCT event_name) AS distinct_event_types FROM web3.events GROUP BY contract_id;"
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"role": "user",
"content": "List all insurance products with their product name and base premium, where the product description contains the word 'accident'."
},
{
"role": "assistant",
"content": "SELECT product_name, base_premium FROM insurance.insurance_products WHERE description ILIKE '%acc... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ... |
[
{
"role": "user",
"content": "List all pairs of wallet addresses that were created by the same user but on different dates. Show both wallet IDs, their addresses, the user ID, and their creation dates."
},
{
"role": "assistant",
"content": "SELECT w1.wallet_id AS wallet_id_1, w1.address AS addre... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
|
[
{
"role": "user",
"content": "List all unique actions that have been logged in the system."
},
{
"role": "assistant",
"content": "SELECT DISTINCT action FROM trading_platform.logs;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "List all contracts along with the number of tokens deployed at each contract address."
},
{
"role": "assistant",
"content": "SELECT c.contract_id, c.address AS contract_address, COUNT(t.token_id) AS token_count\nFROM web3.contracts c\nLEFT JOIN web3.tokens t ON c.ad... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id text PRIMARY KEY, address text, abi text, bytecode text, deployer_address text, deployed_a... |
[
{
"role": "user",
"content": "What is the current job satisfaction level or feedback from staff members working at a specific train station?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on job satisfaction levels or feedback from staff members as this data is... | 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.s... |
[
{
"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": "List all pairs of transactions within the same block where the from_address of one transaction is the to_address of another transaction. Show both transaction_ids, the block_number, from_address, and to_address."
},
{
"role": "assistant",
"content": "SELECT t1.trans... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price... |
[
{
"role": "user",
"content": "Which service locations do not have a contact phone specified? Show the location_id and location_name."
},
{
"role": "assistant",
"content": "SELECT location_id, location_name\nFROM government_services.service_locations\nWHERE contact_phone IS NULL OR contact_phone ... | You are an SQL statement expert. Given the table 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": "For each customer, show the number of open accounts and their combined balance, joining the accounts table with itself on customer_id for demonstration."
},
{
"role": "assistant",
"content": "SELECT a.customer_id, COUNT(a.account_id) AS open_accounts_count, SUM(a.ba... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts (
account_id character varying(64) NOT NULL, -- unique identifier for the account
c... |
[
{
"role": "user",
"content": "What is the overall average ROI and average PNL for all smart money token performance records?"
},
{
"role": "assistant",
"content": "SELECT AVG(roi) AS overall_average_roi, AVG(pnl) AS overall_average_pnl FROM smart_money_token_performance;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_performance ( token_address text, token_symbol text, pnl numeric, net_flow numeric, avg_cost numeric,... |
[
{
"role": "user",
"content": "Provide the average high price for securities on each exchange, using market data from the last 6 months."
},
{
"role": "assistant",
"content": "SELECT s.exchange, AVG(md.high_price) AS average_high_price FROM financial_services.market_data AS md JOIN financial_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 financial_services.accounts (
account_id character varying(64) NOT NULL, -- unique identifier for the account
c... |
[
{
"role": "user",
"content": "Show me all employees (employee_id, first_name, last_name) who work in the 'Investment' department and have processed trades (trade_id, security_id) in the last month, along with the trade details."
},
{
"role": "assistant",
"content": "SELECT e.employee_id, e.first... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac... |
[
{
"role": "user",
"content": "Can you show me all pairs of customers living in the same city but with different last names? Show both customer IDs, both full names, and their city."
},
{
"role": "assistant",
"content": "SELECT a.customer_id AS customer_id_a, CONCAT(a.first_name, ' ', a.last_name... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"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": "List all loans (loan_id, loan_type, principal_amount) that have a current principal balance less than 25% of the original principal amount, along with their account_id and the difference between principal_amount and current_principal_balance."
},
{
"role": "assistant",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.loans ( loan_id text, account_id text, loan_type text, principal_amount numeric, current_principal_b... |
[
{
"role": "user",
"content": "Find claim IDs that have more than 5 documents of type 'PHOTO'."
},
{
"role": "assistant",
"content": "SELECT claim_id FROM insurance.claim_documents WHERE document_type = 'PHOTO' GROUP BY claim_id HAVING COUNT(*) > 5;"
},
{
"role": "user",
"content": "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 insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ... |
[
{
"role": "user",
"content": "Provide a count of KYC audits for each unique status present in the table."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) FROM kyc_audit 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 trading_platform.kyc_audit (
kyc_audit_id character varying(64) NOT NULL, -- unique identifier for the KYC audit
... |
[
{
"role": "user",
"content": "Find all pairs of tokens that have the same contract_address but different token_symbols. Show both token_ids, each token's symbol, and the shared contract_address."
},
{
"role": "assistant",
"content": "SELECT t1.token_id AS token_id_1, t2.token_id AS token_id_2, 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 web3.tokens ( token_id text PRIMARY KEY, contract_address text, token_name text, token_symbol text, decimals int, total... |
[
{
"role": "user",
"content": "Show the first name, last name, and contact information for beneficiaries added before 2023."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, contact_info FROM insurance.policy_beneficiaries WHERE added_at < '2023-01-01';"
},
{
"role": "u... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text... |
[
{
"role": "user",
"content": "For each status, show the total number of service orders and the average total price, grouped by status and the staff member who delivered the service."
},
{
"role": "assistant",
"content": "SELECT status, staff_id_delivered, COUNT(*) AS order_count, AVG(total_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 hospitality_technology.service_orders ( order_id text PRIMARY KEY, reservation_id text, guest_id text, service_id text,... |
[
{
"role": "user",
"content": "List all claim IDs that have both an 'Accident Report' and a 'Damage Assessment' document, and show the earliest upload timestamp for each type."
},
{
"role": "assistant",
"content": "SELECT a.claim_id,\n MIN(a.uploaded_at) AS accident_report_date,\n MIN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claim_documents ( document_id.text, claim_id.text, document_type.text, file_name.text, file_path.text, file_s... |
[
{
"role": "user",
"content": "Show me all active vehicles with their make, model, and depot location details, along with their last maintenance service type and date."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id, v.make, v.model, v.depot_id, ml.service_type, ml.service_date FROM tr... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "Show me all diesel fuel logs where the quantity is more than 100 liters, including the vehicle ID and total cost."
},
{
"role": "assistant",
"content": "SELECT fuel_log_id, vehicle_id, quantity, total_cost FROM transportation.fuel_logs WHERE fuel_type = 'diesel' 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 transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, qu... |
[
{
"role": "user",
"content": "For each open case, find the latest document uploaded: include case_number, document_name, and upload_timestamp."
},
{
"role": "assistant",
"content": "SELECT c.case_number,\n d.document_name,\n d.upload_timestamp\nFROM legal_services.cases c\nJOIN (\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, man... |
[
{
"role": "user",
"content": "Show me all fuel logs where the location is 'LOC456', including the vehicle ID, fuel type, and quantity."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, fuel_type, quantity FROM transportation.fuel_logs WHERE location_id = 'LOC456';"
},
{
"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.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, qu... |
[
{
"role": "user",
"content": "List all appointments that took place at 'Central Office', showing appointment_id, client_id, and subject."
},
{
"role": "assistant",
"content": "SELECT appointment_id, client_id, subject FROM legal_services.appointments WHERE location = 'Central Office';"
},
{
... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, client_id character varying(64) NOT NULL, ... |
[
{
"role": "user",
"content": "Find all prescriptions for patients who have at least one appointment scheduled in the future. Show the prescription ID, patient ID, medication name, and the earliest future appointment time for that patient."
},
{
"role": "assistant",
"content": "SELECT pr.prescrip... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"role": "user",
"content": "Show me all patients who have been prescribed medications along with their doctor's name and the medication details, ordered by the prescription date."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, d.first_name AS doctor_first_name, d.last_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Which narratives have more than 20 tokens? Show the narrative, token number, and trend rank."
},
{
"role": "assistant",
"content": "SELECT narrative, token_num, trend_rank FROM narrative_info WHERE token_num > 20;"
},
{
"role": "user",
"content": "Add th... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative text, top_3_coins text, price_change_percentage_1h numeric, price_change_percentage_24h nume... |
[
{
"role": "user",
"content": "Show me all invoice numbers together with the client IDs and related case IDs for invoices issued after March 1st, 2024."
},
{
"role": "assistant",
"content": "SELECT invoice_number, client_id, case_id FROM legal_services.invoices WHERE issue_date > '2024-03-01';"
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices (
invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice
invo... |
[
{
"role": "user",
"content": "Show me the top 5 users with the highest number of wallet addresses."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(*) AS wallet_count FROM blockchain.wallets WHERE user_id IS NOT NULL GROUP BY user_id ORDER BY wallet_count DESC LIMIT 5;"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.wallets ( wallet_id text, user_id text, address_id text, private_key text )
|
[
{
"role": "user",
"content": "Find all citizens who have both uploaded at least one document and made at least one payment. Show their citizen ID, full name, and contact email."
},
{
"role": "assistant",
"content": "SELECT c.citizen_id, c.first_name || ' ' || c.last_name AS full_name, c.contact_... | You are an SQL statement expert. Given the table 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": "Find all users who created accounts in the last 30 days and show their usernames and email addresses, sorted by creation date in descending order."
},
{
"role": "assistant",
"content": "SELECT username, email FROM web3.users WHERE created_at >= NOW() - INTERVAL '30 ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email character varying(... |
[
{
"role": "user",
"content": "List all contracts along with the username of the deployer, showing contract_id, contract address, deployed_at, and the username. Order by deployed_at descending."
},
{
"role": "assistant",
"content": "SELECT c.contract_id,\n c.address AS contract_address,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "Find pairs of documents within the same case that were uploaded on the same day but by different lawyers. Show the case_id, upload_date, document_id and uploader_id for both documents in the pair."
},
{
"role": "assistant",
"content": "SELECT d1.case_id, DATE(d1.upl... | You are an SQL statement expert. Given the table 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": "I need a list showing the name of each law firm and the full name of every lawyer employed by that firm."
},
{
"role": "assistant",
"content": "SELECT T1.firm_name, T2.first_name, T2.last_name FROM law_firms AS T1 JOIN lawyers AS T2 ON T1.firm_id = T2.firm_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 legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"role": "user",
"content": "List all rooms along with their room number, room type name, and the base rate for that room type."
},
{
"role": "assistant",
"content": "SELECT T1.room_number, T2.type_name, T2.base_rate FROM rooms AS T1 JOIN room_types AS T2 ON T1.room_type_id = T2.room_type_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.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "What is the maintenance schedule for platform 3 at station DEF for the next month?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to the maintenance schedule for platforms. The data I have only includes static information about platform de... | 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 all fuel logs for vehicle 'VHCL123', including the fuel type, quantity, and total cost."
},
{
"role": "assistant",
"content": "SELECT fuel_log_id, fuel_type, quantity, total_cost FROM transportation.fuel_logs WHERE vehicle_id = 'VHCL123';"
},
{
"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.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, qu... |
[
{
"role": "user",
"content": "List all tokens with a price below $1 and a 24-hour trading volume over $5 million."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, price, total_volume FROM token_basic_info WHERE price < 1 AND total_volume::numeric > 5000000;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_basic_info ( coin_id character varying(100) NOT NULL, token_name character varying(100) NOT NULL, token_symbol ch... |
[
{
"role": "user",
"content": "Show me all patients who have a primary insurance plan from 'Blue Cross', along with their insurance policy numbers and the plan types."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, pi.policy_number, ip.plan_type FROM healthc... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "I want to see, for each guest, the total number of payments they have made and the timestamp of their latest payment."
},
{
"role": "assistant",
"content": "SELECT p.guest_id,\n COUNT(p.payment_id) AS payment_count,\n t.last_ts\nFROM hospitality_technolo... | You are an SQL statement expert. Given the table 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.payments ( payment_id character varying(64) NOT NULL, reservation_id character varying(64), gues... |
[
{
"role": "user",
"content": "Show the staff_id, full name, and position for all staff hired before 2015."
},
{
"role": "assistant",
"content": "SELECT staff_id, CONCAT(first_name, ' ', last_name) AS full_name, position\nFROM hospitality_technology.staff\nWHERE hire_date < '2015-01-01';"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.staff (
staff_id character varying(64) NOT NULL, -- unique identifier for the staff member
... |
[
{
"role": "user",
"content": "Find all users who have deployed contracts on the 'ethereum' network, along with the count of contracts they've deployed and the most recent deployment timestamp."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, COUNT(c.contract_id) AS contract_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 web3.contracts ( contract_id text PRIMARY KEY, address text, abi text, bytecode text, deployer_address text, deployed_a... |
[
{
"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 the username and wallet address for all users who possess at least one wallet."
},
{
"role": "assistant",
"content": "SELECT T1.username, T2.address FROM web3.users AS T1 JOIN web3.wallets AS T2 ON T1.user_id = T2.user_id;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_address.text, deployed_at.timestamp,... |
[
{
"role": "user",
"content": "Show me the subject and start times of all appointments along with the corresponding lawyer IDs for each client."
},
{
"role": "assistant",
"content": "SELECT client_id, lawyer_id, subject, start_time FROM legal_services.appointments;"
}
] | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, client_id character varying(64) NOT NULL, ... |
[
{
"role": "user",
"content": "List all ERC20 tokens where the total supply is less than 100,000, including their names and symbols."
},
{
"role": "assistant",
"content": "SELECT name, symbol, total_supply FROM token_metas WHERE is_erc20 = 1 AND CAST(total_supply AS decimal) < 100000;"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE 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 active agents who have a commission rate above the company average, along with their agency names and contact information."
},
{
"role": "assistant",
"content": "SELECT a.agent_id, a.first_name, a.last_name, a.agency_name, a.contact_email, a.contact_phon... | You are an SQL statement expert. Given the table 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.agents ( agent_id text, first_name text, last_name text, agency_name text, license_number text, license_state... |
[
{
"role": "user",
"content": "List all developers founded before the year 2000, showing their name, country, and the year they were founded."
},
{
"role": "assistant",
"content": "SELECT name, country, founded_year FROM gaming_technology.developers WHERE founded_year < 2000;"
},
{
"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 gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "List all patients who have an active prescription for a medication manufactured by 'AstraZeneca', along with their policy number and the prescription ID."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, pi.policy_number, pr.prescription_id\nFROM healthcar... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id.text, medication_name.text, generic_name.text, manufacturer.text, ndc_code.text,... |
[
{
"role": "user",
"content": "List all pairs of users who follow each other, including their usernames."
},
{
"role": "assistant",
"content": "SELECT\n u1.username AS user_a,\n u2.username AS user_b\nFROM\n social_media.follows f1\n JOIN social_media.follows f2\n ON f1.follower_user_id = ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "Can you find all appointments where the duration is less than 20 minutes and the status is not 'Cancelled'? For each, show the appointment_id, appointment_time, status, and doctor_id."
},
{
"role": "assistant",
"content": "SELECT appointment_id, appointment_time, st... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments (
appointment_id character varying(64) NOT NULL, -- unique identifier for the appointment
... |
[
{
"role": "user",
"content": "Show me a list of appointments, including their subject and start time, along with the case number for the related case."
},
{
"role": "assistant",
"content": "SELECT T1.subject, T1.start_time, T2.case_number FROM appointments AS T1 JOIN cases AS T2 ON T1.case_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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Show me all claims along with the related customer's full name and the policy number for incidents that occurred in 2024."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.incident_date, c.description, cu.first_name || ' ' || cu.last_name AS customer_full_... | You are an SQL statement expert. Given the table 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": "List all in-game items with their name, type, and rarity."
},
{
"role": "assistant",
"content": "SELECT item_name, item_type, rarity FROM gaming_technology.in_game_items;"
},
{
"role": "user",
"content": "Filter this list to include only items with 'Rare... | You are an SQL statement expert. Given the table 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": "Can you list each player along with the number of rare items they currently have in their inventory, and also show the total quantity of these rare items?"
},
{
"role": "assistant",
"content": "SELECT p.username, COUNT(DISTINCT pi.item_id) AS num_rare_items, COALESC... | You are an SQL statement expert. Given the table 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 pairs of distinct medications manufactured by the same company, showing med1.medication_id, med1.medication_name, med2.medication_id, med2.medication_name, and the manufacturer."
},
{
"role": "assistant",
"content": "SELECT m1.medication_id AS med1_id, m1.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, medication_name.text, generic_name.text, manufacturer.text, ndc_code.text,... |
[
{
"role": "user",
"content": "Show me the top 5 projects by valuation that completed fundraising rounds in the last 12 months, along with their latest round name and investment value."
},
{
"role": "assistant",
"content": "SELECT project_name, rounds_name, investment_value, valuation FROM projec... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "List all vehicles and their last maintenance service date along with the odometer reading, including only those that have not had a fuel refill in the past 30 days."
},
{
"role": "assistant",
"content": "SELECT m.vehicle_id,\n m.last_service_date,\n m.la... | You are an SQL statement expert. Given the table 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, route_number character varying(32) NOT NULL UNIQUE, de... |
[
{
"role": "user",
"content": "Count how many fundraising rounds each project has. Show project_name and round_count."
},
{
"role": "assistant",
"content": "SELECT\n project_name,\n COUNT(*) AS round_count\nFROM project_fundraising_record\nGROUP BY project_name;"
},
{
"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 project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "Can you show me the total number of items acquired by each player, along with the title of each game and the player's ID?"
},
{
"role": "assistant",
"content": "SELECT pi.player_id, g.title AS game_title, SUM(pi.quantity) AS total_items_acquired\nFROM gaming_technol... | You are an SQL statement expert. Given the table 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 NOT NULL DEFAULT gen_random_uuid(), title character varying(200) NOT NULL, devel... |
[
{
"role": "user",
"content": "List each passenger's first_name, last_name along with another passenger's first_name and last_name who share the same loyalty_program_id. Label them as member and peer."
},
{
"role": "assistant",
"content": "SELECT p1.first_name AS member_first, p1.last_name AS mem... | You are an SQL statement expert. Given the table 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.passengers ( passenger_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"role": "user",
"content": "What are the qualifications or training history of the staff member who performed the maintenance with record_id 'REC123'?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information about the qualifications or training history of staff members... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.m... |
[
{
"role": "user",
"content": "I need a report showing each security's ticker_symbol along with the total sum of trade total_amount and the count of trades executed in the last three months."
},
{
"role": "assistant",
"content": "SELECT s.ticker_symbol, SUM(t.total_amount) AS total_trade_amount, ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad... |
[
{
"role": "user",
"content": "For each player, show the player_id and the count of inventory items they acquired with a quantity greater than 1."
},
{
"role": "assistant",
"content": "SELECT player_id, COUNT(inventory_id) AS items_qty_gt_1_count FROM gaming_technology.player_inventory WHERE quan... | You are an SQL statement expert. Given the table 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 user ID and the total count of wallets associated with each user who owns at least one wallet."
},
{
"role": "assistant",
"content": "SELECT T1.user_id, COUNT(T2.wallet_id) FROM trading_platform.users AS T1 JOIN trading_platform.wallets AS T2 ON T1.user_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Count the number of policies by their status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) AS policy_count\nFROM insurance.policies\nGROUP BY status;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "Show the count of vehicles for each type."
},
{
"role": "assistant",
"content": "SELECT type, COUNT(*) AS vehicle_count FROM transportation.vehicles GROUP BY type;"
},
{
"role": "user",
"content": "Only include types where the vehicle count is greater th... | You are an SQL statement expert. Given the table 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": "For each policy, get the policy_number, total_paid_amount, and beneficiary_count."
},
{
"role": "assistant",
"content": "SELECT p.policy_number,\n SUM(pp.amount_paid) AS total_paid_amount,\n COUNT(b.beneficiary_id) AS beneficiary_count\nFROM insurance.po... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
[
{
"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": "I want a list of each department's top 3 longest-tenured active employees, showing their full names, hire_date, and their manager’s full names."
},
{
"role": "assistant",
"content": "WITH ranked AS (\n SELECT\n e.department,\n e.employee_id,\n e.first_name... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.trades ( trade_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL, securit... |
[
{
"role": "user",
"content": "Show the invoice_id and total hours logged for each invoice."
},
{
"role": "assistant",
"content": "SELECT invoice_id, SUM(hours_spent) AS total_hours FROM legal_services.time_entries WHERE invoice_id IS NOT NULL GROUP BY invoice_id;"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries ( entry_id text PRIMARY KEY, case_id text, lawyer_id text, date_worked date, hours_spent nu... |
[
{
"role": "user",
"content": "Show me all active customers from New York who were born before 1980, along with their contact information."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, phone_number, email, address_line1, city, state, zip_code FROM insurance.customers 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 insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "List all policies where the premium_amount exceeds the base_premium of its insurance product. Display the policy_number, premium_amount, product_name, and base_premium. Sort the results by premium_amount descending."
},
{
"role": "assistant",
"content": "SELECT p.po... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "Show the document ID, claim ID, and file name for all documents with a MIME type starting with 'image/'."
},
{
"role": "assistant",
"content": "SELECT document_id, claim_id, file_name FROM insurance.claim_documents WHERE mime_type LIKE 'image/%';"
},
{
"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.claim_documents ( document_id character varying(64) NOT NULL, claim_id character varying(64) NOT NULL, docume... |
[
{
"role": "user",
"content": "I need a list of users who have commented on their own posts. For each, return user_id, username, and the total number of such comments, ordered by comment count descending."
},
{
"role": "assistant",
"content": "SELECT u.user_id,\n u.username,\n COUNT(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 text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "What is the total amount of all payments recorded?"
},
{
"role": "assistant",
"content": "SELECT SUM(amount) FROM government_services.payments;"
},
{
"role": "user",
"content": "Now only include payments with status 'Completed'."
},
{
"role": "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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Show me the top 3 narratives by 24-hour trading volume, along with their 1-hour and 24-hour price change percentages."
},
{
"role": "assistant",
"content": "SELECT narrative.text, price_change_percentage_1h.numeric, price_change_percentage_24h.numeric FROM narrative... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume... |
[
{
"role": "user",
"content": "Find all transactions where the from_address is the same as the to_address, indicating self-transactions, and show the transaction_id, value, and gas_used."
},
{
"role": "assistant",
"content": "SELECT transaction_id, value, gas_used FROM web3.transactions WHERE fro... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id character varying(64) NOT NULL, from_address character varying(128) NOT NULL, to_add... |
[
{
"role": "user",
"content": "Count how many achievements were unlocked on each calendar day. Show the date and the count."
},
{
"role": "assistant",
"content": "SELECT DATE(unlocked_at) AS unlock_date, COUNT(*) AS achievement_count FROM gaming_technology.player_achievements GROUP BY unlock_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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "Show me wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address."
},
{
"role": "assistant",
"content": "SELECT nh.wallet_address, nh.token_id, nh.contract_address FROM nft_holders nh JOIN token_metas tm ON nh.cont... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "Show each user ID with the date of their first created wallet."
},
{
"role": "assistant",
"content": "SELECT user_id, MIN(created_at) AS first_wallet_date\nFROM trading_platform.wallets\nGROUP BY user_id;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timesta... |
[
{
"role": "user",
"content": "I need to get the inventory quantity and location for a specific batch number. Can you help with that?"
},
{
"role": "assistant",
"content": "HGETALL inv:<inventory_record_id>"
},
{
"role": "user",
"content": "Can you also show me the component ID associ... | 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. Key pattern: 'inv:<inventory_record_id>'. Example: HSET inv:INVREC500 component_id "c... |
[
{
"role": "user",
"content": "List all items with a cost_amount greater than 5000. Show item name, rarity, and cost amount."
},
{
"role": "assistant",
"content": "SELECT item_name, rarity, cost_amount FROM gaming_technology.in_game_items WHERE cost_amount > 5000;"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.in_game_items ( item_id.uuid, game_id.uuid, item_name.text, item_type.text, description.text, rarity.... |
[
{
"role": "user",
"content": "List each hashtag's tag_name alongside the next tag_name alphabetically."
},
{
"role": "assistant",
"content": "SELECT h1.tag_name AS current_tag, (\n SELECT MIN(tag_name)\n FROM social_media.hashtags\n WHERE tag_name > h1.tag_name\n) AS next_tag\nFROM social_med... | You are an SQL statement expert. Given the table 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.hashtags ( hashtag_id character varying(64) NOT NULL, tag_name character varying(100) NOT NULL UNIQUE, cre... |
[
{
"role": "user",
"content": "Get a list of all policies that have at least two beneficiaries with a percentage_share greater than 20%. Include policy_id, policy_number, and beneficiary_count."
},
{
"role": "assistant",
"content": "SELECT p.policy_id, p.policy_number, COUNT(pb.beneficiary_id) AS... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "Show me the policy number, premium amount, start date, and status for all policies with a deductible of exactly 1000."
},
{
"role": "assistant",
"content": "SELECT policy_number, premium_amount, start_date, status \nFROM insurance.policies \nWHERE deductible = 1000;... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies (
policy_id character varying(64) NOT NULL, -- unique identifier for the policy
customer_id ... |
[
{
"role": "user",
"content": "Which achievements were unlocked by the same player at exactly the same timestamp?"
},
{
"role": "assistant",
"content": "SELECT a.player_id,\n a.achievement_id AS ach1,\n b.achievement_id AS ach2,\n a.unlocked_at\nFROM gaming_technology.player_ach... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid, player_id uuid, achievement_id uuid, unlocked_at ti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.