conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Provide each patient's most recent medical-record doctor's full name along with their primary insurance plan name. Return patient_id, first_name, last_name, primary_plan_name, doctor_first_name, doctor_last_name."
},
{
"role": "assistant",
"content": "SELECT p.patie... | You are an SQL statement expert. Given the table 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": "Give me a list of all developers and how many achievements exist for each developer's games."
},
{
"role": "assistant",
"content": "SELECT d.name AS developer_name, COUNT(a.achievement_id) AS num_achievements\nFROM gaming_technology.developers d\nLEFT JOIN gaming_te... | You are an SQL statement expert. Given the table 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 NOT NULL DEFAULT gen_random_uuid(), name character varying(150) NOT NU... |
[
{
"role": "user",
"content": "Find all unique diagnosis codes that are associated with more than one doctor, and show how many doctors are linked to each code."
},
{
"role": "assistant",
"content": "SELECT diagnosis_code, COUNT(DISTINCT doctor_id) AS doctor_count FROM healthcare.diagnoses GROUP ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_ty... |
[
{
"role": "user",
"content": "Can you list the top 5 addresses by total profit in the smart_money_profit table for the Polygon chain, along with their ROI, rank, and the most profitable token?"
},
{
"role": "assistant",
"content": "SELECT address, profit, roi, rank, most_profit_token\nFROM smart... | You are an SQL statement expert. Given the table 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 users with private profiles who have disabled push notifications, including their user_id and email_notifications_enabled status."
},
{
"role": "assistant",
"content": "SELECT user_id,\n email_notifications_enabled\nFROM social_media.user_settings\nWH... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.conversations ( conversation_id.text, created_at.timestamp, last_message_at.timestamp, is_group_chat.boole... |
[
{
"role": "user",
"content": "Provide a count of locations for each country listed in the table."
},
{
"role": "assistant",
"content": "SELECT country, COUNT(*) FROM transportation.locations GROUP BY country"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.locations ( location_id.text, name.text, type.text, address_line1.text, city.text, state_province.text, ... |
[
{
"role": "user",
"content": "For each passenger, list their email along with the total amount spent on fares across all their bookings."
},
{
"role": "assistant",
"content": "SELECT p.passenger_id, p.email, SUM(b.fare) AS total_fare_spent\nFROM transportation.passengers p\nJOIN transportation.b... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.passengers (
passenger_id character varying(64) NOT NULL, -- unique identifier for the passenger
... |
[
{
"role": "user",
"content": "Give me a count of all notifications sent to each user."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(*) AS notification_count\nFROM trading_platform.notifications\nGROUP BY user_id;"
},
{
"role": "user",
"content": "Now, only show users w... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address ch... |
[
{
"role": "user",
"content": "Show me the subjects and start times of all appointments for a specific client, along with the assigned lawyer ID."
},
{
"role": "assistant",
"content": "SELECT subject, start_time, lawyer_id FROM legal_services.appointments WHERE client_id = 'CLIENT123';"
},
{
... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, client_id text, lawyer_id text, case_id text, start_time... |
[
{
"role": "user",
"content": "Count how many insurance plans exist for each plan type."
},
{
"role": "assistant",
"content": "SELECT plan_type, COUNT(*) AS plan_count\nFROM healthcare.insurance_plans\nGROUP BY plan_type;"
},
{
"role": "user",
"content": "Now filter to only show plan ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.insurance_plans ( plan_id.text, plan_name.text, insurance_provider.text, plan_type.text, contact_phone.text,... |
[
{
"role": "user",
"content": "Find users with push_notifications_enabled set to false who have unread notifications. Show their username and the count of unread notifications."
},
{
"role": "assistant",
"content": "SELECT u.username, COUNT(n.notification_id) AS unread_count FROM social_media.use... | You are an SQL statement expert. Given the table 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": "Provide a list of all log entries recorded since the start of 2024, including the user ID, action, and the exact time the log occurred."
},
{
"role": "assistant",
"content": "SELECT user_id, action, logged_at FROM logs WHERE logged_at >= '2024-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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
CREATE ... |
[
{
"role": "user",
"content": "How many distinct addresses achieved a realized_ratio higher than 0.9 last month?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT address) FROM smart_money_profit WHERE realized_ratio > 0.9;"
},
{
"role": "user",
"content": "Can you also bre... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_profit ( address character varying(100) NOT NULL, -- the user's address rank INT, -- the rank of the addres... |
[
{
"role": "user",
"content": "What is the average age of customers by risk_profile for those in status 'Active'?"
},
{
"role": "assistant",
"content": "SELECT risk_profile,\n AVG(DATE_PART('year', AGE(CURRENT_DATE, date_of_birth))) AS avg_age\nFROM financial_services.customers\nWHERE statu... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "Show me the make and model of vehicles used on routes longer than 150 kilometers, and include the route number."
},
{
"role": "assistant",
"content": "SELECT v.make, v.model, r.route_number \nFROM transportation.trips t\nJOIN transportation.vehicles v ON t.vehicle_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 transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "I need a list of trip_id, status, and the corresponding vehicle's license_plate and fuel_type for trips that haven't yet begun."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, t.status, v.license_plate, v.fuel_type\nFROM transportation.trips t\nJOIN transpo... | You are an SQL statement expert. Given the table 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 reservations made by guests whose last name starts with 'S', along with the first and last name of the guest, and the property ID."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, g.first_name, g.last_name, r.property_id FROM hospitality_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 hospitality_technology.guests ( guest_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, la... |
[
{
"role": "user",
"content": "For each agency that is a parent, how many direct child agencies does it have? Show the parent agency name and the count."
},
{
"role": "assistant",
"content": "SELECT parent.agency_name AS parent_agency_name, COUNT(child.agency_id) AS child_agency_count FROM govern... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... |
[
{
"role": "user",
"content": "List the token symbol, token ID, and name for all tokens whose contract address matches the address of a deployed contract, and also show the deployment status."
},
{
"role": "assistant",
"content": "SELECT t.token_symbol, t.token_id, t.token_name, c.status AS contr... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts (
contract_id character varying(64) NOT NULL, -- unique identifier for the contract
address cha... |
[
{
"role": "user",
"content": "Show each agency's name, jurisdiction level, and the count of its active services in the 'Healthcare' category."
},
{
"role": "assistant",
"content": "SELECT a.agency_name, a.jurisdiction_level, COUNT(s.service_id) AS active_healthcare_services\nFROM 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 PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "List all appointments and diagnoses associated with doctor 'doctor_123'. Show appointment_id, appointment_time, reason, diagnosis_id, diagnosis_code, description, and diagnosis_date."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, a.appointment_time,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id.text, patient_id.text, doctor_id.text, appointment_time.timestamp, duration_mi... |
[
{
"role": "user",
"content": "List the document ID, file name, document type, and upload date for all documents."
},
{
"role": "assistant",
"content": "SELECT document_id, file_name, document_type, uploaded_at FROM insurance.claim_documents;"
},
{
"role": "user",
"content": "From 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 insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ... |
[
{
"role": "user",
"content": "Show me the top 3 narratives by trend rank, along with their 7-day price change percentage and total volume."
},
{
"role": "assistant",
"content": "SELECT narrative, price_change_percentage_7d, volume_24h FROM narrative_info ORDER BY trend_rank ASC LIMIT 3;"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri... |
[
{
"role": "user",
"content": "What is the average interest rate for all home loans (loan_type = 'Home') with a term of 30 years (term_months = 360)?"
},
{
"role": "assistant",
"content": "SELECT AVG(interest_rate) FROM financial_services.loans WHERE loan_type = 'Home' AND term_months = 360;"
}... | You are an SQL statement expert. Given the table 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 room number, floor, and the name of the property for all rooms located in properties in Texas."
},
{
"role": "assistant",
"content": "SELECT T1.room_number, T1.floor, T2.property_name FROM hospitality_technology.rooms AS T1 JOIN hospitality_technology.pr... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "For each day, can you show me the total number of unique players and total number of sessions per server?"
},
{
"role": "assistant",
"content": "SELECT server_id, date_trunc('day', start_time) AS session_day, COUNT(DISTINCT player_id) AS unique_players, COUNT(sessio... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.game_sessions ( session_id.uuid, player_id.uuid, game_id.uuid, server_id.uuid, start_time.timestamptz... |
[
{
"role": "user",
"content": "Show me the usernames and the group names for each user who has sent at least one message in a group chat."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, c.group_name\nFROM social_media.users u\nJOIN social_media.conversation_participants cp ON 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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "Show a combination of all chronic diagnoses and all insurance plans of type 'HMO'. Display the diagnosis description and the plan name."
},
{
"role": "assistant",
"content": "SELECT T1.description, T2.plan_name FROM healthcare.diagnoses AS T1 CROSS JOIN healthcare.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 healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_i... |
[
{
"role": "user",
"content": "Show me claims handled by agents whose commission rate is greater than 0.1, including the claim ID, incident date, and estimated loss."
},
{
"role": "assistant",
"content": "SELECT T1.claim_id, T1.incident_date, T1.estimated_loss FROM insurance.claims AS T1 JOIN ins... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d... |
[
{
"role": "user",
"content": "List all combinations of manufacturers and generic names. For each combination, display the manufacturer, generic_name, and the number of medications."
},
{
"role": "assistant",
"content": "SELECT manufacturer, generic_name, COUNT(*) AS medication_count 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.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,... |
[
{
"role": "user",
"content": "List all ERC20 token contract addresses with more than 200 approval events recorded in the erc20_approval table."
},
{
"role": "assistant",
"content": "SELECT contract_address, COUNT(*) as approval_count FROM erc20_approval GROUP BY contract_address HAVING COUNT(*) ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"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": "Who are the top 3 agents with the highest commission rate? Show their full names and commission rates."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, commission_rate\nFROM insurance.agents\nORDER BY commission_rate DESC\nLIMIT 3;"
},
{
... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name chara... |
[
{
"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": "Find all smart contracts created by addresses that have sent more than 1000 transactions."
},
{
"role": "assistant",
"content": "SELECT sc.* FROM blockchain.smart_contracts sc JOIN (SELECT sender_address FROM blockchain.transactions GROUP BY sender_address HAVING CO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.transactions ( transaction_id character varying(64) NOT NULL, block_id character varying(64) NOT NULL, sende... |
[
{
"role": "user",
"content": "I need the total traded value (quantity * price) for each buyer and asset symbol for trades after '2024-06-01'. List buyer_id, asset symbol, and total_value."
},
{
"role": "assistant",
"content": "SELECT t.buyer_id, m.value AS asset_symbol, SUM(t.quantity * t.price)... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.orders ( order_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, wallet_id ch... |
[
{
"role": "user",
"content": "Show me the total billable hours per lawyer from the time_entries table."
},
{
"role": "assistant",
"content": "SELECT lawyer_id, SUM(hours_spent) AS total_hours\nFROM legal_services.time_entries\nWHERE is_billable = TRUE\nGROUP BY lawyer_id;"
},
{
"role": "... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients (
client_id character varying(64) NOT NULL, -- unique identifier for the client
first_n... |
[
{
"role": "user",
"content": "Show me the number of game servers in each region and the average maximum number of players they can accommodate. Exclude any servers that are currently offline."
},
{
"role": "assistant",
"content": "SELECT region, COUNT(server_id) AS server_count, AVG(max_players)... | You are an SQL statement expert. Given the table 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(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "List all billable but unbilled time entries including entry_id, lawyer_id, case_id, date_worked, hours_spent, and billing_rate."
},
{
"role": "assistant",
"content": "SELECT entry_id, lawyer_id, case_id, date_worked, hours_spent, billing_rate\nFROM legal_services.ti... | You are an SQL statement expert. Given the table 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 vehicles that are due for their next service before the end of this month, along with their last service date and type."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, service_date AS last_service_date, service_type FROM transportation.maintena... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id text PRIMARY KEY, vehicle_id text, service_date date, odometer_reading int, se... |
[
{
"role": "user",
"content": "Count the number of tokens for each contract address."
},
{
"role": "assistant",
"content": "SELECT contract_address, COUNT(*) AS token_count FROM web3.tokens GROUP BY contract_address;"
},
{
"role": "user",
"content": "Only show contracts that have more... | You are an SQL statement expert. Given the table 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": "List all passengers with their first name, last name, and email."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM transportation.passengers;"
},
{
"role": "user",
"content": "Can you also include their phone number in the 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.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "List all tokens together with the deployment status of the contract that created them, showing token_id, token_symbol, and contract status."
},
{
"role": "assistant",
"content": "SELECT t.token_id, t.token_symbol, c.status AS contract_status\nFROM web3.tokens t\nJOI... | You are an SQL statement expert. Given the table 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": "For each medical record, find the number of diagnoses it has and display record_id, patient_id, and diagnosis_count, but include only records with at least two diagnoses."
},
{
"role": "assistant",
"content": "SELECT m.record_id,\n m.patient_id,\n COUNT(... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records ( record_id text PRIMARY KEY, patient_id text, appointment_id text, doctor_id text, record_d... |
[
{
"role": "user",
"content": "Show me the top 5 users who placed the most orders in the last 7 days, along with the total quantity of assets they ordered."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(order_id) AS total_orders, SUM(quantity) AS total_quantity FROM trading_platform... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.orders ( order_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, wallet_id ch... |
[
{
"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": "List the names and descriptions of all DApps."
},
{
"role": "assistant",
"content": "SELECT name, description FROM trading_platform.dapps;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.utxos ( utxo_id text, transaction_id text, output_index integer, address text, amount numeric, spent b... |
[
{
"role": "user",
"content": "Find all medications that have been prescribed to patients with chronic diagnoses, showing the medication name and the count of patients prescribed each medication."
},
{
"role": "assistant",
"content": "SELECT m.medication_name, COUNT(DISTINCT d.patient_id) AS pati... | You are an SQL statement expert. Given the table 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, patient_id character varying(64) NOT NULL, doc... |
[
{
"role": "user",
"content": "For each wallet that currently holds more than 5000 units of any ERC20 token, show the wallet address and contract address."
},
{
"role": "assistant",
"content": "SELECT contract_address, wallet_address, CAST(amount AS numeric) AS amount\nFROM erc20_balances\nWHERE ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc20_balances ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, amou... |
[
{
"role": "user",
"content": "List the username and email of users who have disabled push notifications."
},
{
"role": "assistant",
"content": "SELECT u.username, u.email\nFROM social_media.users u\nJOIN social_media.user_settings s ON u.user_id = s.user_id\nWHERE s.push_notifications_enabled = ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "For each player, list the total number of 'Legendary' rarity items they have in their inventory, along with the titles of the respective games those items belong to."
},
{
"role": "assistant",
"content": "SELECT pi.player_id, g.game_id, g.title, COUNT(*) AS legendar... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time... |
[
{
"role": "user",
"content": "For each narrative and chain, calculate the total USD buy and sell values, and show only those where buys exceed sells. Display narrative, chain, total_buy_usd, total_sell_usd, and buy_sell_difference."
},
{
"role": "assistant",
"content": "WITH buy_agg AS (\n SELE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE smart_money_token_inflow (",
"token_address character varying(100) NOT NULL, -- the token's address",
"token... |
[
{
"role": "user",
"content": "Could you show me the usernames of users who have received likes on their posts, along with the total number of likes each user's posts have received?"
},
{
"role": "assistant",
"content": "SELECT T1.username, count(T3.like_id) AS total_likes_received FROM social_me... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "List all pairs of employees who work in the same department but at different branches. For each pair, show the employee_id and branch_id for both members."
},
{
"role": "assistant",
"content": "SELECT a.employee_id AS employee_id_a, a.branch_id AS branch_id_a, b.emp... | You are an SQL statement expert. Given the table 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 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": "Show all patients who do not have an email address on file. Return patient_id, first and last name, and phone number."
},
{
"role": "assistant",
"content": "SELECT patient_id, first_name, last_name, phone_number\nFROM healthcare.patients\nWHERE email IS NULL;"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Show me the full names and email addresses of users who have received notifications of type 'mention', and the notification creation time."
},
{
"role": "assistant",
"content": "SELECT u.full_name, u.email, n.created_at\nFROM social_media.notifications n\nJOIN socia... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "List all in-game items that cost more than 1000, showing their name and cost amount."
},
{
"role": "assistant",
"content": "SELECT item_name, cost_amount FROM gaming_technology.in_game_items WHERE cost_amount > 1000;"
},
{
"role": "user",
"content": "Now... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games (
game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game
ti... |
[
{
"role": "user",
"content": "I need the total amount and count of payments for each policy."
},
{
"role": "assistant",
"content": "SELECT policy_id,\n COUNT(*) AS payment_count,\n SUM(amount_paid) AS total_paid\nFROM insurance.premium_payments\nGROUP BY policy_id;"
},
{
"rol... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.premium_payments (
payment_id character varying(64) NOT NULL, -- unique identifier for the payment
po... |
[
{
"role": "user",
"content": "List pairs of distinct routes where the origin of one route is the destination of the other, and the destination of the first route is the origin of the second. Include the route IDs and numbers for both routes in each pair."
},
{
"role": "assistant",
"content": "SE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati... |
[
{
"role": "user",
"content": "List all active staff members who are managers, along with their hire dates and email addresses."
},
{
"role": "assistant",
"content": "SELECT staff_id, first_name, last_name, position, hire_date, work_email FROM hospitality_technology.staff WHERE is_active = true A... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Show me all customers (customer_id, first_name, last_name) who have both a personal loan (loan_type = 'Personal') and a high risk profile (risk_profile = 'High'), along with their loan details (loan_id, principal_amount)."
},
{
"role": "assistant",
"content": "SELEC... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"role": "user",
"content": "Provide a list of user ID, wallet ID, and details (contract ID, creator address, timestamp) for smart contracts created by addresses associated with wallets."
},
{
"role": "assistant",
"content": "SELECT w.user_id, w.wallet_id, sc.contract_id, sc.creator_address, sc... | 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, previous_block_id.text, timestamp.timestamp, nonc... |
[
{
"role": "user",
"content": "Identify agents who have sold overlapping policies. Return agent_id, policy_number1, policy_number2, and their coverage dates."
},
{
"role": "assistant",
"content": "SELECT p1.agent_id,\n p1.policy_number AS policy_number1,\n p2.policy_number AS policy_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.policies (
policy_id character varying(64) NOT NULL, -- unique identifier for the policy
customer_id ... |
[
{
"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 each patient and doctor pair that have both an active chronic diagnosis and at least one prescription recorded in the same medical record. Include patient_id, doctor_id, diagnosis_date, prescription_date, and medication_id."
},
{
"role": "assistant",
"conten... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_ty... |
[
{
"role": "user",
"content": "How many posts have a media file attached?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM social_media.posts WHERE media_url 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 social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "Find all appointments at location_id 'LOC123' where the reason contains 'follow-up' and the status is 'Scheduled', showing appointment_time and patient_id."
},
{
"role": "assistant",
"content": "SELECT appointment_time, patient_id FROM healthcare.appointments WHERE ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id text PRIMARY KEY, patient_id text, doctor_id text, appointment_time timestamp,... |
[
{
"role": "user",
"content": "List all law firms whose website is missing or not provided."
},
{
"role": "assistant",
"content": "SELECT firm_id, firm_name, address, phone, founded_date, managing_partner_id\nFROM legal_services.law_firms\nWHERE website IS NULL OR website = '';"
}
] | You are an SQL statement expert. Given the table 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": "Can you list all appointments along with the scheduled start time, purpose, and booking method, as well as the employee ID and location ID for each appointment?"
},
{
"role": "assistant",
"content": "SELECT appointment_id, scheduled_start_time, purpose, booking_meth... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.appointments ( appointment_id text, citizen_id text, employee_id text, location_id text, service_id... |
[
{
"role": "user",
"content": "Could you list all games, show their title and genre, and also include the total number of achievements for each game?"
},
{
"role": "assistant",
"content": "SELECT g.title, g.genre, COUNT(a.achievement_id) AS total_achievements FROM gaming_technology.games g LEFT J... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date... |
[
{
"role": "user",
"content": "Show me all reviews that have a staff response, including review_id, property_id, guest_id, and the response_staff_id."
},
{
"role": "assistant",
"content": "SELECT review_id, property_id, guest_id, response_staff_id\nFROM hospitality_technology.reviews\nWHERE respo... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, property_id character varying(64) ... |
[
{
"role": "user",
"content": "Which countries have the highest number of developer companies founded after 2005? Please show country, the number of developers, and order by developer count descending."
},
{
"role": "assistant",
"content": "SELECT country, COUNT(*) AS developer_count\nFROM gaming... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_... |
[
{
"role": "user",
"content": "Show me all active managers along with the count of staff members they supervise, ordered by the supervised staff count in descending order."
},
{
"role": "assistant",
"content": "SELECT s1.staff_id, s1.first_name, s1.last_name, COUNT(s2.staff_id) AS supervised_staf... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.guests ( guest_id.text, first_name.text, last_name.text, email.text, phone_number.text, date_of_... |
[
{
"role": "user",
"content": "I need to find patients who received prescriptions within 7 days after their latest appointment. Show patient_id, first and last name, appointment_time, prescription_date, and medication_name."
},
{
"role": "assistant",
"content": "WITH latest_appt AS (\n SELECT pa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "List the full name and bar number of all lawyers who were hired before 2015."
},
{
"role": "assistant",
"content": "SELECT first_name || ' ' || last_name AS lawyer_full_name, bar_number\nFROM legal_services.lawyers\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 legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "Show me a list of all cases and include the case number, case name, and the court jurisdiction for each case, as well as the lead lawyer's ID and the case status."
},
{
"role": "assistant",
"content": "SELECT case_number, case_name, court_jurisdiction, lead_lawyer_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 legal_services.cases ( case_id character varying(64) NOT NULL, case_number character varying(100) UNIQUE, case_name tex... |
[
{
"role": "user",
"content": "What is the total balance across all savings accounts in USD currency?"
},
{
"role": "assistant",
"content": "SELECT SUM(balance) AS total_savings_balance FROM financial_services.accounts WHERE account_type = 'Savings' AND currency = 'USD';"
}
] | You are an SQL statement expert. Given the table 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 conversation IDs (whether group chat or not) that have at least one hashtag used in posts linked to them."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.conversation_id\nFROM social_media.conversations c\nJOIN social_media.post_hashtags ph ON c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.post_hashtags (
post_hashtag_id character varying(64) NOT NULL, -- unique identifier for the post-hash... |
[
{
"role": "user",
"content": "Show me the items in player inventory for player ID 'abcdefgh-1234-5678-abcd-efghijklmnop'. List the item name and quantity."
},
{
"role": "assistant",
"content": "SELECT ii.item_name, pi.quantity FROM gaming_technology.player_inventory pi JOIN gaming_technology.in_... | You are an SQL statement expert. Given the table 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": "Show me the top 3 tokens by liquidity on the Binance chain, along with their price and 1-hour price change percentage."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, price, price_change_percentage_1h, liquidity FROM token_dexpool_info WHERE ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_dexpool_info ( pair_address character varying(512) NOT NULL, token_name character varying(100) NOT NULL, token_sy... |
[
{
"role": "user",
"content": "Show me all insurance products of type 'Travel', including their product_id, product_name, and base_premium."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name, base_premium\nFROM insurance.insurance_products\nWHERE product_type = 'Travel';"
}
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"role": "user",
"content": "List all notifications that are related to group conversations, showing notification ID, recipient user ID, and the associated group name."
},
{
"role": "assistant",
"content": "SELECT n.notification_id, n.recipient_user_id, c.group_name FROM social_media.notificati... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.conversations ( conversation_id text PRIMARY KEY, created_at timestamp, last_message_at timestamp, is_grou... |
[
{
"role": "user",
"content": "Display the details of all UTXOs with a 'spent' status of false."
},
{
"role": "assistant",
"content": "SELECT utxo_id, transaction_id, output_index, address, amount FROM trading_platform.utxos WHERE spent = false;"
},
{
"role": "user",
"content": "For t... | 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 trading_platform.users ( user_id text, username text, email text, password_hash text... |
[
{
"role": "user",
"content": "Find the full names and emails of citizens who have received notifications with the status 'Sent' related to a document. Also show the document_id for each notification."
},
{
"role": "assistant",
"content": "SELECT c.first_name || ' ' || c.last_name AS full_name, 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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "List all pairs of active services in the same category where one service’s standard fee is higher than the other’s. Display the category, the higher-fee service name with its fee, and the lower-fee service name with its fee."
},
{
"role": "assistant",
"content": "SE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services ( service_id text, agency_id text, service_name text, description text, category text, eli... |
[
{
"role": "user",
"content": "List the ticker symbol and security name for all securities that had a volume greater than 100000 on '2023-10-27'."
},
{
"role": "assistant",
"content": "SELECT T2.ticker_symbol, T2.security_name FROM financial_services.market_data AS T1 JOIN financial_services.secu... | You are an SQL statement expert. Given the table 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.market_data (
data_point_id bigserial NOT NULL, -- auto-incrementing primary key
security_id... |
[
{
"role": "user",
"content": "For each player, show their username, country_code, registration_date, and the username of the player who registered immediately before them in the same country."
},
{
"role": "assistant",
"content": "SELECT p1.username AS player,\n p1.country_code,\n p1... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "List all trips with their status and passenger count for vehicle 'VHCL789'."
},
{
"role": "assistant",
"content": "SELECT trip_id, status, passenger_count FROM transportation.trips WHERE vehicle_id = 'VHCL789';"
},
{
"role": "user",
"content": "Can you 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 transportation.trips ( trip_id.text, route_id.text, vehicle_id.text, driver_id.text, scheduled_departure.timestamp, act... |
[
{
"role": "user",
"content": "For each event, display its event_id, the event_id of the previous event in the same transaction (if any), and the log_index of both events."
},
{
"role": "assistant",
"content": "SELECT curr.event_id AS current_event_id,\n prev.event_id AS previous_event_... | You are an SQL statement expert. Given the table 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": "How many appointments are scheduled to start tomorrow?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM government_services.appointments WHERE DATE(scheduled_start_time) = CURRENT_DATE + INTERVAL '1 day'"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.appointments ( appointment_id text PRIMARY KEY, citizen_id text, employee_id text, location_id text... |
[
{
"role": "user",
"content": "Show me the total payment amount processed by each staff member for EUR payments, including their staff_id_processed and the count of successful transactions."
},
{
"role": "assistant",
"content": "SELECT staff_id_processed, SUM(amount) AS total_amount_eur, COUNT(*)... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.payments ( payment_id text, reservation_id text, guest_id text, bill_id text, amount numeric, cu... |
[
{
"role": "user",
"content": "List all agents who have a commission rate above 0.1, showing their full names and agency names."
},
{
"role": "assistant",
"content": "SELECT agent_id, first_name, last_name, agency_name, commission_rate FROM insurance.agents WHERE commission_rate > 0.1 AND 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 text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "List all medications manufactured by 'Pfizer', showing their medication name and generic name."
},
{
"role": "assistant",
"content": "SELECT medication_name, generic_name FROM healthcare.medications WHERE manufacturer = 'Pfizer';"
},
{
"role": "user",
"c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id text PRIMARY KEY, medication_name text, generic_name text, manufacturer text, nd... |
[
{
"role": "user",
"content": "List all cryptocurrency assets that have been traded more than 50 times, along with their total trade volume and average price."
},
{
"role": "assistant",
"content": "SELECT a.asset_id, a.name, COUNT(t.trade_id) AS trade_count, SUM(t.quantity * t.price) AS total_vol... | You are an SQL statement expert. Given the table 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": "For each transaction, list the total value transferred and the number of different addresses involved (either as sender or receiver)."
},
{
"role": "assistant",
"content": "SELECT transaction_id, SUM(value) AS total_value_transferred, COUNT(DISTINCT addr) AS num_add... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.token_transfers ( transfer_id text, token_id text, from_address text, to_address text, value numeric, transaction_... |
[
{
"role": "user",
"content": "List all users who have set their location to 'Berlin'."
},
{
"role": "assistant",
"content": "SELECT user_id, username, email, full_name, location\nFROM social_media.users\nWHERE location = 'Berlin';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "List all appointment IDs and their corresponding location IDs for appointments that have status 'cancelled'."
},
{
"role": "assistant",
"content": "SELECT appointment_id, location_id FROM healthcare.appointments WHERE status = 'cancelled';"
}
] | You are an SQL statement expert. Given the table 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, patient_id character varying(64) NOT NULL, doc... |
[
{
"role": "user",
"content": "For each staff member, list their first name, last name, and their property ID."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, property_id FROM hospitality_technology.staff"
},
{
"role": "user",
"content": "Now, only show staff memb... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types (
room_type_id character varying(64) NOT NULL, -- unique identifier for the room ... |
[
{
"role": "user",
"content": "Show me the usernames and email addresses of users who created their accounts in the last 30 days, ordered by creation date in descending order."
},
{
"role": "assistant",
"content": "SELECT username, email FROM web3.users WHERE created_at >= NOW() - INTERVAL '30 da... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, username text, email text, password_hash text, created_at timestamp )
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.