conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "How many events were emitted on each date? List the date and the count of events."
},
{
"role": "assistant",
"content": "SELECT DATE(emitted_at) AS emit_date,\n COUNT(*) AS event_count\nFROM web3.events\nGROUP BY DATE(emitted_at);"
},
{
"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 web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"role": "user",
"content": "Which employees have verified more than 5 documents in the last 30 days? Return the employee's full name, department, and the number of verifications."
},
{
"role": "assistant",
"content": "SELECT e.first_name || ' ' || e.last_name AS full_name, e.department, 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 government_services.services ( service_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "Can you help me get the total number of operational platforms across all stations?"
},
{
"role": "assistant",
"content": "db.platforms.countDocuments({ status: 'Operational' });"
}
] | 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
// db.createCollection('platforms')
// Optional: db.platforms.createIndex({ platform_id: 1 }, { u... |
[
{
"role": "user",
"content": "List patient_id, first_name, last_name, and date_of_birth for all patients older than 65 years."
},
{
"role": "assistant",
"content": "SELECT patient_id, first_name, last_name, date_of_birth\nFROM healthcare.patients\nWHERE date_of_birth < CURRENT_DATE - INTERVAL '6... | You are an SQL statement expert. Given the table 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, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "Show me the first and last names of customers who have purchased a policy for an insurance product of type 'travel', along with the policy number and product name."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, p.policy_number, ip.product_n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "Give me a list of users who follow more than one other user, including their username and the count of people they follow."
},
{
"role": "assistant",
"content": "SELECT u.username, COUNT(f.following_user_id) AS following_count\nFROM social_media.follows f\nJOIN soci... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "List the users who have never posted any public posts, showing user_id, username, and email."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, u.email FROM social_media.users u LEFT JOIN social_media.posts p ON p.user_id = u.user_id AND p.visibili... | You are an SQL statement expert. Given the table 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 average commission_rate for each agent status and only show statuses with an average commission_rate above 0.05?"
},
{
"role": "assistant",
"content": "SELECT status,\n AVG(commission_rate) AS avg_commission_rate\nFROM insurance.agents\nGROUP BY 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 insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state... |
[
{
"role": "user",
"content": "Show the first name, last name, and the date they joined (created_at) for all passengers."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, created_at FROM transportation.passengers;"
},
{
"role": "user",
"content": "Only include passe... | You are an SQL statement expert. Given the table 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 inactive customers from California, showing their full names and the date they were created."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, created_at FROM insurance.customers WHERE state = 'California' AND status = 'Inactive';"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "Show me all accounts (account_id, account_number, balance) that have a balance greater than $50,000 and are in USD currency, along with the security details (ticker_symbol, security_name) for securities traded on the same exchange as the account's last_updated_at 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 financial_services.accounts (
account_id character varying(64) NOT NULL, -- unique identifier for the account
c... |
[
{
"role": "user",
"content": "Show me the top 5 tokens by market cap on the Ethereum chain, along with their 24-hour trading volume and 7-day price change percentage."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, market_cap, total_volume, price_change_percentage_7d FROM... | You are an SQL statement expert. Given the table 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": "Find all cryptocurrency assets that have been traded more than 50 times but have an average trade quantity less than 10."
},
{
"role": "assistant",
"content": "SELECT t.asset_id, COUNT(t.trade_id) AS trade_count, AVG(t.quantity) AS avg_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.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "Count the number of appointments that have a status of 'Cancelled'."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM government_services.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 government_services.appointments ( appointment_id text, citizen_id text, employee_id text, location_id text, service_id... |
[
{
"role": "user",
"content": "Show me asset IDs and DApp names for metadata entries linking assets to DApps where metadata.value matches a dapp_id."
},
{
"role": "assistant",
"content": "SELECT m.asset_id, d.name AS dapp_name\nFROM trading_platform.metadata m\nJOIN trading_platform.dapps d\n ON... | You are an SQL statement expert. Given the table 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 appointment ID, subject, and start time for appointments that are linked to a case, along with the case number and case name."
},
{
"role": "assistant",
"content": "SELECT T1.appointment_id, T1.subject, T1.start_time, T2.case_number, T2.case_name FROM le... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases ( case_id.text, case_number.text, case_name.text, client_id.text, lead_lawyer_id.text, case_type.t... |
[
{
"role": "user",
"content": "Show me all active accounts with a balance greater than 2000."
},
{
"role": "assistant",
"content": "SELECT account_id, account_number, customer_id, account_type, balance, currency\nFROM financial_services.accounts\nWHERE status = 'Open' AND balance > 2000;"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
... |
[
{
"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": "List all inactive customers from Texas who were created in the last 2 years, showing their full names and creation dates."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, created_at FROM insurance.customers WHERE state = 'Texas' AND status = 'ina... | You are an SQL statement expert. Given the table 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": "For wallet address '0xWalletA', list the ERC20 tokens held, showing contract address and amount."
},
{
"role": "assistant",
"content": "SELECT contract_address, amount FROM erc20_balances WHERE wallet_address = '0xWalletA';"
},
{
"role": "user",
"content... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, transaction_index integ... |
[
{
"role": "user",
"content": "List all rooms along with their room type names and base rates for rooms that are currently 'Available'."
},
{
"role": "assistant",
"content": "SELECT r.room_id, r.room_number, rt.type_name, rt.base_rate\nFROM hospitality_technology.rooms r\nJOIN hospitality_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 hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "Find pairs of citizens who share the same gender but registered in different years. Show each citizen's first and last name along with their registration year."
},
{
"role": "assistant",
"content": "SELECT c1.first_name AS first_name_1,\n c1.last_name AS 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 government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth... |
[
{
"role": "user",
"content": "Show me all reservations with more than 2 adults that are confirmed (status = 'Confirmed'), including their check-in dates and total amounts."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, r.property_id, r.guest_id, r.check_in_date, r.total_amount F... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, property_id character varying(64) NOT ... |
[
{
"role": "user",
"content": "List all patients who have non-primary insurance plans from providers containing 'Care' in their name, including the policy number and expiration date."
},
{
"role": "assistant",
"content": "SELECT pi.patient_id, pi.policy_number, pi.expiration_date FROM healthcare.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors (
doctor_id character varying(64) NOT NULL, -- unique identifier for the doctor
first_name ... |
[
{
"role": "user",
"content": "Which clients have appointments scheduled for a case that also has at least one invoice issued? Please show the client_id, appointment_id, appointment start_time, related case_id, and invoice_number."
},
{
"role": "assistant",
"content": "SELECT a.client_id, a.appoi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices ( invoice_id.text, invoice_number.text, client_id.text, case_id.text, issue_date.date, due_date... |
[
{
"role": "user",
"content": "Show me the notification ID, recipient user ID, and notification type for notifications received by users that user 'user123' is following."
},
{
"role": "assistant",
"content": "SELECT n.notification_id, n.recipient_user_id, n.notification_type FROM social_media.no... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t... |
[
{
"role": "user",
"content": "Show me the top 5 NFT collections with the highest token count on Ethereum, along with their names, symbols, and floor prices."
},
{
"role": "assistant",
"content": "SELECT nc.name, nc.symbol, nc.floor_price, nc.token_count FROM nft_collections nc WHERE nc.blockchai... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all ( block_number.bigint, block_timestamp.timestamp, transaction_index.integer, transaction_hash.... |
[
{
"role": "user",
"content": "Which agencies offer more than three services? List the agency ID and the total number of services they provide."
},
{
"role": "assistant",
"content": "SELECT agency_id, COUNT(service_id) AS total_services\nFROM government_services.services\nGROUP BY agency_id\nHAVI... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies (
agency_id character varying(64) NOT NULL, -- unique identifier for the agency
ag... |
[
{
"role": "user",
"content": "Show me the name of each document, the name of the case it belongs to, and the full name of the lawyer who uploaded it."
},
{
"role": "assistant",
"content": "SELECT T1.document_name, T2.case_name, T3.full_name FROM documents AS T1 JOIN cases AS T2 ON T1.case_id = 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 legal_services.documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"role": "user",
"content": "Show me all bookings along with the full name and email of the passenger, the trip's scheduled departure time, and the assigned driver's full name."
},
{
"role": "assistant",
"content": "SELECT b.booking_id, p.first_name || ' ' || p.last_name AS passenger_full_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 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 distinct dosage forms used in prescriptions."
},
{
"role": "assistant",
"content": "SELECT DISTINCT dosage FROM healthcare.prescriptions;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.prescriptions ( prescription_id text PRIMARY KEY, record_id text, patient_id text, doctor_id text, medicatio... |
[
{
"role": "user",
"content": "Show each customer's checking and savings account numbers for customers who have both types."
},
{
"role": "assistant",
"content": "SELECT a.customer_id,\n a.account_number AS checking_account,\n b.account_number AS savings_account\nFROM financial_servic... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id.text, customer_id.text, account_number.text, account_type.text, balance.numeri... |
[
{
"role": "user",
"content": "List all invoices with status 'Sent', including invoice_number and the associated case_name."
},
{
"role": "assistant",
"content": "SELECT i.invoice_number, c.case_name\nFROM legal_services.invoices i\nJOIN legal_services.cases c\n ON i.case_id = c.case_id\nWHERE 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.lawyers (
lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer
first_n... |
[
{
"role": "user",
"content": "能否帮我查询特定路线(route_id 为 'route_ne_corr')上的所有车站信息,并包含每个车站的平台数量?"
},
{
"role": "assistant",
"content": "ZRANGE route:route_ne_corr:stops 0 -1\nHGETALL route_station:<route_station_id> for each route_station_id in result\nHGETALL station:<station_id> for each station_id ... | 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 to store station details. Key format: station:<station_id>
// Example:
// HSET stat... |
[
{
"role": "user",
"content": "List all unspent transaction outputs (UTXOs), showing their transaction ID and amount."
},
{
"role": "assistant",
"content": "SELECT transaction_id, amount FROM trading_platform.utxos WHERE spent = false;"
},
{
"role": "user",
"content": "Calculate the 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 character varying(64) NOT NULL, username character ... |
[
{
"role": "user",
"content": "Show me all guests from California who are loyalty members and have provided both email and phone number, sorted by their last name in alphabetical order."
},
{
"role": "assistant",
"content": "SELECT guest_id, first_name, last_name, email, phone_number FROM hospita... | You are an SQL statement expert. Given the table 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": "List the first and last names of all drivers, along with the count of unique vehicle makes they have driven."
},
{
"role": "assistant",
"content": "SELECT d.first_name, d.last_name, COUNT(DISTINCT v.make) AS unique_vehicle_makes\nFROM transportation.drivers d\nJOIN ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text... |
[
{
"role": "user",
"content": "Show me all electric vehicles that have completed trips in the last month, along with the count of trips each vehicle has completed."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id, v.make, v.model, COUNT(t.trip_id) AS trip_count FROM transportation.vehic... | You are an SQL statement expert. Given the table 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": "How many wallets were created in each distinct month?"
},
{
"role": "assistant",
"content": "SELECT DATE_TRUNC('month', created_at) AS creation_month, COUNT(*) AS wallet_count FROM web3.wallets GROUP BY DATE_TRUNC('month', created_at) ORDER BY creation_month;"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
|
[
{
"role": "user",
"content": "List the number of available services per department for each property, displaying the property name and department along with the count of services."
},
{
"role": "assistant",
"content": "SELECT p.property_name,\n s.department,\n COUNT(*) AS service_cou... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ... |
[
{
"role": "user",
"content": "List total billable hours and total amount per lawyer for July 2023."
},
{
"role": "assistant",
"content": "SELECT lawyer_id,\n SUM(hours_spent) AS total_hours,\n SUM(hours_spent * billing_rate) AS total_amount\nFROM legal_services.time_entries\nWHERE is... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries ( entry_id text, case_id text, lawyer_id text, date_worked date, hours_spent numeric, billi... |
[
{
"role": "user",
"content": "Show me the deployer address and the count of contracts they have deployed on the 'mainnet' network, but only for deployers who have deployed more than 5 contracts on mainnet. Sort the results by the count in descending order."
},
{
"role": "assistant",
"content": "... | 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.contracts ( contract_id text PRIMARY KEY, address text, abi text, bytecode text... |
[
{
"role": "user",
"content": "Show the total balance for each SUI coin across all owners. Group by coin_type."
},
{
"role": "assistant",
"content": "SELECT coin_type,\n SUM(CAST(balance AS DECIMAL)) AS total_balance\nFROM sui_coins\nGROUP BY coin_type;"
},
{
"role": "user",
"co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "List the total number of items acquired by each player, grouped by rarity, for items that have been acquired at least twice."
},
{
"role": "assistant",
"content": "SELECT pi.player_id, igi.rarity, SUM(pi.quantity) AS total_acquired\nFROM gaming_technology.player_inv... | You are an SQL statement expert. Given the table 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": "Get all documents uploaded by lawyers who are partners."
},
{
"role": "assistant",
"content": "SELECT d.document_id, d.document_name, d.case_id, d.upload_timestamp\nFROM legal_services.documents d\nJOIN legal_services.lawyers l ON d.uploaded_by_lawyer_id = l.lawyer_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph... |
[
{
"role": "user",
"content": "How many hashtags have been created in March 2024?"
},
{
"role": "assistant",
"content": "```sql\nSELECT COUNT(*) AS march_2024_hashtag_count\nFROM social_media.hashtags\nWHERE created_at >= '2024-03-01'\n AND created_at < '2024-04-01';\n```"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "Give me the total number of reservations and the sum of total_amount by month for the year 2023."
},
{
"role": "assistant",
"content": "SELECT DATE_TRUNC('month', check_in_date) AS month,\n COUNT(*) AS reservation_count,\n SUM(tot... | You are an SQL statement expert. Given the table 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": "Show me the balance history of wallet '0xdeadbeef' for token at contract '0xaaaa...' ."
},
{
"role": "assistant",
"content": "SELECT block_number, amount\nFROM erc20_balances_historical\nWHERE wallet_address = '0xdeadbeef'\n AND contract_address = '0xaaaa...';"
}... | You are an SQL statement expert. Given the table 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 `user_id` and `conversation_id` for participants who are in conversations where there is at least one message sent by *another* user that they have not read."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.user_id, T1.conversation_id FROM social_media... | You are an SQL statement expert. Given the table 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.messages ( message_id character varying(64) NOT NULL, conversation_id character varying(64) NOT NULL, send... |
[
{
"role": "user",
"content": "List the client ID, full name, and the total number of invoices they have received."
},
{
"role": "assistant",
"content": "SELECT c.client_id, c.first_name, c.last_name, COUNT(i.invoice_id) AS invoice_count\nFROM legal_services.clients c\nLEFT JOIN legal_services.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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Find all wallets that hold at least one NFT and also hold ERC-20 tokens."
},
{
"role": "assistant",
"content": "SELECT DISTINCT nh.wallet_address\nFROM nft_holders nh\nJOIN erc20_balances eb\n ON nh.wallet_address = eb.wallet_address;"
},
{
"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 erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, amount.text, pk.text )
CREATE TABLE n... |
[
{
"role": "user",
"content": "Find all nodes that share the same IP address but have different node_ids."
},
{
"role": "assistant",
"content": "SELECT n1.ip_address, n1.node_id AS node_id1, n2.node_id AS node_id2 FROM blockchain.nodes n1 JOIN blockchain.nodes n2 ON n1.ip_address = n2.ip_address ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen timestamp )
|
[
{
"role": "user",
"content": "I want a list of all claims where at least one document is larger than 2 megabytes. Include the claim ID, incident date, and the file name of such documents."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.incident_date, d.file_name\nFROM insurance.claim... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d... |
[
{
"role": "user",
"content": "For projects that have completed more than one fundraising round, calculate the average investment value across all their recorded rounds. Display the project name and this average value."
},
{
"role": "assistant",
"content": "SELECT project_name, AVG(investment_val... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "Retrieve a list of agents who were hired in 2024. Include agent_id, first_name, last_name, hire_date."
},
{
"role": "assistant",
"content": "SELECT agent_id, first_name, last_name, hire_date\nFROM insurance.agents\nWHERE hire_date >= '2024-01-01' AND hire_date < '20... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state... |
[
{
"role": "user",
"content": "Show me all contracts deployed on the 'ethereum' network along with their deployer addresses and the count of events emitted by each contract, sorted by event count in descending order."
},
{
"role": "assistant",
"content": "SELECT c.address, c.deployer_address, COU... | You are an SQL statement expert. Given the table 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": "Find all assets that have metadata with both 'category' and 'subcategory' keys, along with their corresponding values."
},
{
"role": "assistant",
"content": "SELECT m1.asset_id, m1.value as category, m2.value as subcategory FROM trading_platform.metadata m1 JOIN tra... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.metadata (
metadata_id character varying(64) NOT NULL, -- unique identifier for the metadata
... |
[
{
"role": "user",
"content": "Show product_id, product_name, and base_premium for the five most recently created active insurance products."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name, base_premium\nFROM insurance.insurance_products\nWHERE is_active = true\nORDER BY cr... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products ( product_id character varying(64) NOT NULL, product_name character varying(150) NOT NULL,... |
[
{
"role": "user",
"content": "特定のコンポーネントの在庫情報を取得したいです。コンポーネントIDと在庫数量、倉庫の場所を含めてください。"
},
{
"role": "assistant",
"content": "SELECT component_id, quantity, location_warehouse FROM component_inventory WHERE component_id = 'specific_component_id';"
},
{
"role": "user",
"content": "さらに、受け... | 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
Index 'component_inventory'. Mapping: { properties: { inventory_record_id: { type: 'keyword' }, c... |
[
{
"role": "user",
"content": "Show the total payment amount and the count of payments for each payment method with status 'Completed'."
},
{
"role": "assistant",
"content": "SELECT payment_method, SUM(amount), COUNT(*) FROM government_services.payments WHERE status = 'Completed' GROUP BY payment... | You are an SQL statement expert. Given the table 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.payments ( payment_id.text, application_id.text, citizen_id.text, service_id.text, amount.numeric, ... |
[
{
"role": "user",
"content": "Show me the document ID, document type, and uploaded timestamp for all claim documents."
},
{
"role": "assistant",
"content": "SELECT document_id, document_type, uploaded_at FROM insurance.claim_documents;"
},
{
"role": "user",
"content": "Now, include 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 insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state... |
[
{
"role": "user",
"content": "Show me the total number of sessions and the total duration in seconds for each server, including the server name and the game title."
},
{
"role": "assistant",
"content": "SELECT\n s.server_name,\n g.game_title,\n COUNT(gs.session_id) AS total_sessions,\n SUM(g... | You are an SQL statement expert. Given the table 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 all maintenance logs for 'Oil Change' services performed in the last 6 months, including the vehicle ID, service date, and cost."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE service_t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs (
log_id character varying(64) NOT NULL, -- unique identifier for the maintenance ... |
[
{
"role": "user",
"content": "List document names and versions for documents that share the same case_id, showing each pair of versions."
},
{
"role": "assistant",
"content": "SELECT d1.case_id, d1.document_name AS doc_name_v1, d1.version AS version1, d2.document_name AS doc_name_v2, d2.version ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"role": "user",
"content": "List the employee full names, the department they work in, and the number of notifications sent to citizens who have made payments for the services managed by these employees' agencies."
},
{
"role": "assistant",
"content": "SELECT e.first_name || ' ' || e.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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Show me, for each city, how many notifications have been sent to citizens living in that city."
},
{
"role": "assistant",
"content": "SELECT c.city, COUNT(n.notification_id) AS notification_count\nFROM government_services.citizens c\nJOIN government_services.notific... | You are an SQL statement expert. Given the table 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": "Can you retrieve the document_id, file_name, file_size_bytes, uploaded_at, and the full name of the agent (first and last name concatenated) for all documents uploaded in 2024 by active agents licensed in CA?"
},
{
"role": "assistant",
"content": "SELECT cd.document... | You are an SQL statement expert. Given the table 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": "I need a report that shows, for each account status and loan type, how many loans there are and the average principal amount."
},
{
"role": "assistant",
"content": "SELECT a.status,\n l.loan_type,\n COUNT(*) AS total_loans,\n AVG(l.principal_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.loans (
loan_id character varying(64) NOT NULL, -- unique identifier for the loan, could be same... |
[
{
"role": "user",
"content": "I need a summary of vehicles by type and fuel_type, showing the count of vehicles in each combination."
},
{
"role": "assistant",
"content": "SELECT v.type,\n v.fuel_type,\n COUNT(*) AS vehicle_count\nFROM transportation.vehicles v\nGROUP BY v.type, v.fu... | You are an SQL statement expert. Given the table 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": "Can you provide a breakdown of total and average account balance by account_type and currency for each account status?"
},
{
"role": "assistant",
"content": "SELECT account_type, currency, status, COUNT(*) AS total_accounts, SUM(balance) AS total_balance, AVG(balanc... | You are an SQL statement expert. Given the table 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": "For each pair of origin and destination location IDs, show the number of completed trips between them."
},
{
"role": "assistant",
"content": "SELECT origin_location_id, destination_location_id, COUNT(*) AS completed_trip_count FROM transportation.trips WHERE 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 transportation.trips ( trip_id text PRIMARY KEY, route_id text, vehicle_id text, driver_id text, scheduled_departure ti... |
[
{
"role": "user",
"content": "Show the booking ID and seat number for all bookings that have a fare equal to 50."
},
{
"role": "assistant",
"content": "SELECT booking_id, seat_number\nFROM transportation.bookings\nWHERE fare = 50;"
},
{
"role": "user",
"content": "Also include the bo... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, route_number text, description text, origin_location_id text, destin... |
[
{
"role": "user",
"content": "Show the route number, route type, and the names of the origin and destination locations for all routes."
},
{
"role": "assistant",
"content": "SELECT r.route_number, r.type, l1.name AS origin_name, l2.name AS destination_name\nFROM transportation.routes r\nJOIN tra... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes ( route_id text, route_number text, description text, origin_location_id text, destination_locati... |
[
{
"role": "user",
"content": "I need a list of claim_ids that have at least one document of type 'Photo' and at least one of type 'Invoice'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT cd.claim_id\nFROM insurance.claim_documents cd\nWHERE cd.document_type IN ('Photo', 'Invoice');"
}... | You are an SQL statement expert. Given the table 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": "I want to find all pairs of documents for the same claim where one document is a PDF and the other is an image. Return claim_id, the PDF's document_id as pdf_doc_id, the image's document_id as img_doc_id, and their file names."
},
{
"role": "assistant",
"content": "... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ... |
[
{
"role": "user",
"content": "I'd like to see, for each month, the total number of players who registered and how many of them are active versus inactive."
},
{
"role": "assistant",
"content": "SELECT DATE_TRUNC('month', registration_date) AS month,\n COUNT(*) AS total_registrations,\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 gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "Count the number of transactions per sender for March 2023."
},
{
"role": "assistant",
"content": "SELECT sender_address, COUNT(*) AS tx_count\nFROM blockchain.transactions\nWHERE timestamp >= '2023-03-01' AND timestamp < '2023-04-01'\nGROUP BY sender_address;"
},... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.transactions ( transaction_id text, block_id text, sender_address text, receiver_address text, amount numeri... |
[
{
"role": "user",
"content": "Provide a count of notifications for each unique message subject."
},
{
"role": "assistant",
"content": "SELECT message_subject, COUNT(*) AS notification_count FROM government_services.notifications GROUP BY message_subject ORDER BY notification_count DESC;"
}
] | You are an SQL statement expert. Given the table 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.notifications ( notification_id text PRIMARY KEY, citizen_id text, application_id text, message_sub... |
[
{
"role": "user",
"content": "Give me the case number, name, and description for all cases that are currently closed."
},
{
"role": "assistant",
"content": "SELECT case_number, case_name, description FROM legal_services.cases WHERE status = 'Closed';"
},
{
"role": "user",
"content": ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases ( case_id character varying(64) NOT NULL, case_number character varying(100) UNIQUE, case_name tex... |
[
{
"role": "user",
"content": "For each medication, show the total number of prescriptions where at least one refill was allowed."
},
{
"role": "assistant",
"content": "SELECT medication_id, COUNT(*) AS prescription_count FROM healthcare.prescriptions WHERE refills_allowed > 0 GROUP BY medication... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "What is the average speed of train number T9876 during its last journey?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the average speed of train number T9876 during its last journey. The data in the trains table does not inclu... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.t... |
[
{
"role": "user",
"content": "For each client, show the earliest and latest invoice issue_date, along with the total amount invoiced. Include client_id, earliest_issue_date, latest_issue_date, and total_amount."
},
{
"role": "assistant",
"content": "SELECT client_id, MIN(issue_date) AS earliest_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_... |
[
{
"role": "user",
"content": "Which developers have at least one player who unlocked an achievement on a game they developed?"
},
{
"role": "assistant",
"content": "SELECT DISTINCT d.developer_id, d.name\nFROM gaming_technology.developers d\nJOIN gaming_technology.games g ON d.developer_id = g.d... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "List all in-game items' names, types, and rarity along with their total cost in USD, for items that belong to games released on or after 2021-01-01."
},
{
"role": "assistant",
"content": "SELECT i.item_name, i.item_type, i.rarity, i.cost_amount\nFROM gaming_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 gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "Show all projects that raised funds in February 2022, including their names and investment values."
},
{
"role": "assistant",
"content": "SELECT project_name, investment_value FROM project_fundraising_record WHERE investment_date LIKE '2022-02%';"
}
] | You are an SQL statement expert. Given the table 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": "Which are the top 5 smart money addresses with the highest ROI on the BSC chain, and what are their profit, realized ratio, and most profitable token?"
},
{
"role": "assistant",
"content": "SELECT address, profit, roi, realized_ratio, most_profit_token FROM smart_mo... | You are an SQL statement expert. Given the table 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 text, rank numeric, profit numeric, roi numeric, realized_ratio numeric, most_profit_token... |
[
{
"role": "user",
"content": "Show me the top 3 fundraising rounds by investment value in the last 6 months, including project name and valuation."
},
{
"role": "assistant",
"content": "SELECT project_name, rounds_name, investment_value, valuation\nFROM project_fundraising_record\nWHERE investme... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "Show me all loans where the principal amount is between 50,000 and 200,000. Include loan_id, account_id, loan_type, and principal_amount."
},
{
"role": "assistant",
"content": "SELECT loan_id, account_id, loan_type, principal_amount FROM financial_services.loans WHE... | You are an SQL statement expert. Given the table 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": "Show me the total number of hours worked by each lawyer for each case."
},
{
"role": "assistant",
"content": "SELECT t.lawyer_id, t.case_id, SUM(t.hours_spent) AS total_hours\nFROM legal_services.time_entries t\nGROUP BY t.lawyer_id, t.case_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 text, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"role": "user",
"content": "List the full name (first name and last name) of all citizens who have uploaded documents whose expiry date is in the past."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.first_name, T1.last_name FROM government_services.citizens AS T1 INNER JOIN governme... | You are an SQL statement expert. Given the table 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": "Find all blocks that contain transactions where the amount is greater than 500, and include the block difficulty."
},
{
"role": "assistant",
"content": "SELECT DISTINCT b.block_id, b.difficulty FROM blockchain.blocks b JOIN blockchain.transactions t ON b.block_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 blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text... |
[
{
"role": "user",
"content": "List the top 5 accounts by total commission paid in trades during June 2024. Include account_number and total_commission."
},
{
"role": "assistant",
"content": "SELECT a.account_number,\n SUM(t.commission) AS total_commission\nFROM financial_services.trades 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 financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba... |
[
{
"role": "user",
"content": "Find all wallet addresses that don't have an associated user_id."
},
{
"role": "assistant",
"content": "SELECT address_id FROM blockchain.wallets WHERE user_id IS NULL;"
},
{
"role": "user",
"content": "Now show me these addresses along with their privat... | You are an SQL statement expert. Given the table 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.addresses ( address_id.text, public_key.text, balance.numeric )
CREATE TABLE blockchain.wallets ( wallet_id ... |
[
{
"role": "user",
"content": "Show all available services and their categories that have an average processing time above 7 days."
},
{
"role": "assistant",
"content": "SELECT service_name, category\nFROM government_services.services\nWHERE is_active = true AND average_processing_time_days > 7;"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services (
service_id character varying(64) NOT NULL, -- unique identifier for the service
... |
[
{
"role": "user",
"content": "Find all blocks that contain transactions where the amount is greater than 500, and include the block difficulty."
},
{
"role": "assistant",
"content": "SELECT DISTINCT b.block_id, b.difficulty FROM blockchain.blocks b JOIN blockchain.transactions t ON b.block_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 blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta... |
[
{
"role": "user",
"content": "List all pairs of users that registered on the same day, showing both user IDs and the registration date."
},
{
"role": "assistant",
"content": "SELECT u1.user_id AS user_id_1, u2.user_id AS user_id_2, DATE(u1.created_at) AS registration_date\nFROM web3.users u1\nJO... | You are an SQL statement expert. Given the table 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, -- unique identifier for the user
username character vary... |
[
{
"role": "user",
"content": "For each player, show how many achievements they have unlocked in games with items of type 'Consumable'."
},
{
"role": "assistant",
"content": "SELECT pa.player_id, COUNT(DISTINCT pa.achievement_id) AS achievements_unlocked\nFROM gaming_technology.player_achievement... | You are an SQL statement expert. Given the table 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 the first and last names of employees who verified documents, along with the document type they verified."
},
{
"role": "assistant",
"content": "SELECT e.first_name, e.last_name, d.document_type\nFROM government_services.documents d\nJOIN government_services.em... | You are an SQL statement expert. Given the table 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": "Can you help me find all schedules for a specific route with route_id 'RT789' that includes the train details and the departure times?"
},
{
"role": "assistant",
"content": "SELECT s.schedule_id, s.departure_datetime, s.arrival_datetime, s.status, t.train_id\nFROM s... | 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
// PUT /stations
{
"mappings": {
"properties": {
"station_id": { "type": "keyword" },... |
[
{
"role": "user",
"content": "For each state, count the number of customers and display state as state and the count as customer_count, ordered by customer_count descending."
},
{
"role": "assistant",
"content": "SELECT state,\n COUNT(*) AS customer_count\nFROM insurance.customers\nGROUP B... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.