conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "List all users who have received any notification, showing their username and the total number of notifications they received. Assume a users table with user_id and username exists."
},
{
"role": "assistant",
"content": "SELECT u.username, COUNT(n.notification_id) F... | 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.utxos ( utxo_id text PRIMARY KEY, transaction_id text, output_index... |
[
{
"role": "user",
"content": "List the NDC code and description for any medication that has an NDC code starting with '5'."
},
{
"role": "assistant",
"content": "SELECT ndc_code, description FROM healthcare.medications WHERE ndc_code LIKE '5%';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,... |
[
{
"role": "user",
"content": "List all distinct asset types from the assets table."
},
{
"role": "assistant",
"content": "SELECT DISTINCT type\nFROM trading_platform.assets;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Which is the token with the largest difference between its highest and lowest price in the last 24h on each chain, and what is the token's symbol and current price?"
},
{
"role": "assistant",
"content": "SELECT chain, token_symbol, price, (highest_price_24h - lowest... | You are an SQL statement expert. Given the table 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, -- the id of the token",
"token_name character... |
[
{
"role": "user",
"content": "List all assets that have 'category' metadata. Show the asset ID and the value of the 'category'."
},
{
"role": "assistant",
"content": "SELECT asset_id, value AS category FROM trading_platform.metadata WHERE key = 'category';"
},
{
"role": "user",
"cont... | 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, -- unique iden... |
[
{
"role": "user",
"content": "Show me the customer ID, payment ID, payment amount, and payment date for all premium payments with an amount paid over 2000."
},
{
"role": "assistant",
"content": "SELECT customer_id, payment_id, amount_paid, payment_date\nFROM insurance.premium_payments\nWHERE amo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"role": "user",
"content": "Show all appointments that have 'follow-up' mentioned in the notes field."
},
{
"role": "assistant",
"content": "SELECT * FROM healthcare.appointments WHERE notes LIKE '%follow-up%';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id.text, patient_id.text, doctor_id.text, appointment_time.timestamp, duration_mi... |
[
{
"role": "user",
"content": "List all unread notifications for group conversations, including the conversation name, sender_user_id, and notification creation time."
},
{
"role": "assistant",
"content": "SELECT c.group_name, n.sender_user_id, n.created_at\nFROM social_media.notifications n\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 social_media.post_hashtags ( post_hashtag_id text, post_id text, hashtag_id text )
CREATE TABLE social_media.conversati... |
[
{
"role": "user",
"content": "How many documents were uploaded in the year 2023?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM government_services.documents WHERE date_part('year', upload_timestamp) = 2023;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz... |
[
{
"role": "user",
"content": "Show me all routes that have a distance greater than 200 km."
},
{
"role": "assistant",
"content": "SELECT route_number, description, distance_km\nFROM transportation.routes\nWHERE distance_km > 200;"
},
{
"role": "user",
"content": "Can you also include... | You are an SQL statement expert. Given the table 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 items of type 'Armor' in the database, showing the item name, rarity, and their corresponding game_id."
},
{
"role": "assistant",
"content": "SELECT item_id, item_name, rarity, game_id\nFROM gaming_technology.in_game_items\nWHERE item_type = 'Armor';"
},
... | You are an SQL statement expert. Given the table 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": "How many payments were made using the payment method 'Credit Card'?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS credit_card_payments\nFROM government_services.payments\nWHERE payment_method = 'Credit Card';"
}
] | You are an SQL statement expert. Given the table 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 all players who do not have a last_login recorded. List their player_id, username, and registration_date."
},
{
"role": "assistant",
"content": "SELECT player_id, username, registration_date FROM gaming_technology.players WHERE last_login IS NULL;"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "List each customer along with the count of other customers living in the same city. Include customer_id, first_name, last_name, city, and other_customer_count."
},
{
"role": "assistant",
"content": "SELECT a.customer_id,\n a.first_name,\n a.last_name,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "Find all events where the data field contains 'amount' and show the event name, contract ID, and transaction ID, along with the log index, sorted by log index in ascending order."
},
{
"role": "assistant",
"content": "SELECT event_name, contract_id, transaction_id, ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events ( event_id text PRIMARY KEY, contract_id text, event_name text, data text, emitted_at timestamp, transactio... |
[
{
"role": "user",
"content": "List the username, registration date, and address of all users who have created a wallet."
},
{
"role": "assistant",
"content": "SELECT u.username, u.created_at AS registration_date, w.address AS wallet_address\nFROM web3.users u\nJOIN web3.wallets w ON u.user_id = ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "For each city and state, show the number of service locations available along with their accessibility status."
},
{
"role": "assistant",
"content": "SELECT city, state, is_accessible, COUNT(*) AS location_count FROM government_services.service_locations GROUP BY ci... | You are an SQL statement expert. Given the table 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.service_locations ( location_id text, agency_id text, location_name text, address text, city text, ... |
[
{
"role": "user",
"content": "How many time entries does each client have? Provide the client's first and last name along with the count, sorted by count descending."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, COUNT(te.entry_id) AS entry_count FROM legal_services.cli... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"role": "user",
"content": "List all appointments scheduled for clients whose status is 'prospect', showing the client's first name, last name, and the appointment subject."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, a.subject FROM legal_services.clients AS c JOIN ... | You are an SQL statement expert. Given the table 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 all active loans (loan_id, loan_type, principal_amount) where the remaining term is less than 12 months, along with the account_id and monthly_payment."
},
{
"role": "assistant",
"content": "SELECT loan_id, loan_type, principal_amount, account_id, monthly_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 financial_services.loans ( loan_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL UNIQUE, lo... |
[
{
"role": "user",
"content": "List all case numbers and names, along with the full name of the client associated with each case."
},
{
"role": "assistant",
"content": "SELECT T1.case_number, T1.case_name, T2.first_name, T2.last_name FROM cases AS T1 JOIN clients AS T2 ON T1.client_id = T2.client... | You are an SQL statement expert. Given the table 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": "How many tokens had a net positive flow according to smart_money_token_performance, and what is their average ROI?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS token_count, AVG(roi) AS avg_roi\nFROM smart_money_token_performance\nWHERE net_flow > 0;"
... | You are an SQL statement expert. Given the table 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": "List tokens on the 'Arbitrum' chain with a 24-hour price change percentage greater than 10% and a market cap above 1,000,000 USD. Show their symbol, name, price, 24-hour change percentage, and market cap. Order the results by the 24-hour change percentage in descending order."
... | You are an SQL statement expert. Given the table 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, -- the id of the token token_name character varying(100) NO... |
[
{
"role": "user",
"content": "Show me all wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address."
},
{
"role": "assistant",
"content": "SELECT nh.wallet_address, nh.token_id, nh.contract_address FROM nft_holders nh WHERE nh.contract_type = '... | You are an SQL statement expert. Given the table 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": "Provide the total number of vehicles for each fuel_type."
},
{
"role": "assistant",
"content": "SELECT fuel_type, COUNT(*) AS vehicle_count\nFROM transportation.vehicles\nGROUP BY fuel_type;"
},
{
"role": "user",
"content": "Only include fuel types with ... | You are an SQL statement expert. Given the table 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": "For each application, show the application ID, the full name of the assigned employee, and the name of the service applied for."
},
{
"role": "assistant",
"content": "SELECT a.application_id, CONCAT(e.first_name, ' ', e.last_name) AS employee_full_name, s.service_na... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Show me all smart contracts created by users whose email domain is 'gmail.com', along with the contract creation timestamp and the user's username."
},
{
"role": "assistant",
"content": "SELECT sc.contract_id, sc.timestamp, u.username FROM blockchain.smart_contracts... | You are an SQL statement expert. Given the table 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": "Show me all vehicles that are currently out of service (status = 'out_of_service'), including their make, model, and the reason (type field)."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, make, model, type FROM transportation.vehicles WHERE status = 'out... | You are an SQL statement expert. Given the table 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": "Find pairs of events within the same transaction that have the same event name but were emitted by different contracts. List the transaction ID, the shared event name, the IDs of both events, and the IDs of their respective contracts."
},
{
"role": "assistant",
"con... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "Can you list all group conversations and the number of participants in each?"
},
{
"role": "assistant",
"content": "SELECT c.conversation_id, c.group_name, COUNT(cp.user_id) AS participant_count\nFROM social_media.conversations c\nJOIN social_media.conversation_part... | You are an SQL statement expert. Given the table 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 notifications related to messages. Please show notification_id, recipient_user_id, conversation_id, and the creation time."
},
{
"role": "assistant",
"content": "SELECT notification_id, recipient_user_id, target_entity_id AS conversation_id, created_at\nFRO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u... |
[
{
"role": "user",
"content": "Which citizens have made payments but have not uploaded any documents? Please show their first and last names and contact emails."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.first_name, c.last_name, c.contact_email\nFROM government_services.citizens c\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "List all appointments for the client with ID 'client_001' showing the lawyer's ID, appointment subject, and start time."
},
{
"role": "assistant",
"content": "SELECT a.lawyer_id, a.subject, a.start_time\nFROM legal_services.appointments a\nWHERE a.client_id = 'clien... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.appointments ( appointment_id text, client_id text, lawyer_id text, case_id text, start_time timestamp, ... |
[
{
"role": "user",
"content": "List the object ID, collection type, and owner for all Sui NFTs with status 'exists'."
},
{
"role": "assistant",
"content": "SELECT object_id, collection_type, owner FROM sui_nfts WHERE status = 'exists';"
},
{
"role": "user",
"content": "Now, only inclu... | You are an SQL statement expert. Given the table 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": "For each passenger, show their full name, email, and the number of unique trips they have participated in."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, p.email, COUNT(DISTINCT b.trip_id) AS unique_trips\nFROM transportation.passengers p\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.trips ( trip_id text PRIMARY KEY, route_id text, vehicle_id text, driver_id text, scheduled_departure ti... |
[
{
"role": "user",
"content": "Show me all insurance plans that have more than 5 patients enrolled as their primary insurance, along with the provider name and count of patients."
},
{
"role": "assistant",
"content": "SELECT ip.plan_id, ip.plan_name, ip.insurance_provider, COUNT(pi.patient_id) AS... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch... |
[
{
"role": "user",
"content": "Show each player's ID and the number of different achievement IDs they have unlocked."
},
{
"role": "assistant",
"content": "SELECT player_id, COUNT(DISTINCT achievement_id) AS achievement_count\nFROM gaming_technology.player_achievements\ngroup by player_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 gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "I need a list of patients' policy numbers along with their insurance plan names and the plan's website. Return patient_id, policy_number, plan_name, and website."
},
{
"role": "assistant",
"content": "SELECT pi.patient_id, pi.policy_number, ip.plan_name, ip.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 healthcare.doctors ( doctor_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch... |
[
{
"role": "user",
"content": "Show the first name, last name, relationship, and percentage share for all policy beneficiaries added after January 1st, 2024."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, relationship, percentage_share FROM insurance.policy_beneficiaries 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 insurance.policies ( policy_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, product_id c... |
[
{
"role": "user",
"content": "How many insurance policies does each patient have? Return patient_id and policy_count."
},
{
"role": "assistant",
"content": "SELECT patient_id,\n COUNT(*) AS policy_count\nFROM healthcare.patient_insurance\nGROUP BY patient_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 healthcare.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number... |
[
{
"role": "user",
"content": "Show me the total number of items acquired per player for each item type, along with the player's username."
},
{
"role": "assistant",
"content": "SELECT p.player_id, p.username, igi.item_type, SUM(pi.quantity) AS total_acquired\nFROM gaming_technology.player_invent... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "List all log entries associated with users who have participated in any trade, showing the log details and the trade ID."
},
{
"role": "assistant",
"content": "SELECT T1.log_id, T1.action, T1.details, T1.logged_at, T2.trade_id, T2.buyer_id, T2.seller_id FROM logs AS... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
CREATE ... |
[
{
"role": "user",
"content": "List the document name, upload timestamp, and the full name of the lawyer who uploaded it, for all documents associated with case number 'CASE123'."
},
{
"role": "assistant",
"content": "SELECT T1.document_name , T1.upload_timestamp , T2.full_name FROM legal_servi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "Show me the first name and last name of passengers and the scheduled departure time for their bookings."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T3.scheduled_departure FROM transportation.passengers AS T1 JOIN transportation.booking... | You are an SQL statement expert. Given the table 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": "Find services that have associated documents with a 'Pending' verification status. Show the service name and the document type name."
},
{
"role": "assistant",
"content": "SELECT DISTINCT s.service_name, dt.document_type_name FROM government_services.services AS s 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 government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Find all applications whose last update occurred on a weekend. Show application_id, citizen full name, last_updated_at, and status."
},
{
"role": "assistant",
"content": "SELECT\na.application_id,\n(c.first_name || ' ' || c.last_name) AS full_name,\na.last_updated_a... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "I need to know the total USD value of all ERC-20 holdings by each wallet. Calculate the sum of (amount * price) using the latest token prices from token_prices_latest, grouped by wallet_address."
},
{
"role": "assistant",
"content": "SELECT eb.wallet_address,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, amount.text, pk.text )
CREATE TABLE n... |
[
{
"role": "user",
"content": "List claims along with the name of the insurance product associated with the policy under which the claim was filed. Show claim_id, incident_date, and product_name."
},
{
"role": "assistant",
"content": "SELECT T1.claim_id, T1.incident_date, T3.product_name FROM 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 character varying(64) NOT NULL, -- unique identifier for the claim
policy_id charac... |
[
{
"role": "user",
"content": "How many primary insurance policies are currently active for each plan_id? Show plan_id and active_count."
},
{
"role": "assistant",
"content": "SELECT plan_id,\n COUNT(*) AS active_count\nFROM healthcare.patient_insurance\nWHERE is_primary = TRUE\n AND (expi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patient_insurance ( patient_insurance_id text, patient_id text, plan_id text, policy_number text, group_numb... |
[
{
"role": "user",
"content": "Show me the usernames and email addresses of users who have used hashtags in their posts along with the hashtag names they have used."
},
{
"role": "assistant",
"content": "SELECT u.username, u.email, h.tag_name \nFROM social_media.users u\nJOIN social_media.posts p... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "Show me all servers that are currently full, meaning current players equals max players. List the server name, region, and max players."
},
{
"role": "assistant",
"content": "SELECT server_name, region, max_players FROM gaming_technology.servers WHERE current_player... | You are an SQL statement expert. Given the table 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.servers ( server_id uuid PRIMARY KEY, game_id uuid, server_name text, region text, ip_address text, p... |
[
{
"role": "user",
"content": "Show all prescriptions along with the patient's full name and the medication name. Include prescription_id, prescription_date, patient first_name, patient last_name, and medication_name."
},
{
"role": "assistant",
"content": "SELECT pr.prescription_id,\n pr.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 healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "List all narratives with a positive 7-day price change. Include the narrative and the 7-day change."
},
{
"role": "assistant",
"content": "SELECT narrative, price_change_percentage_7d FROM narrative_info WHERE price_change_percentage_7d > 0;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative character varying(512) NOT NULL, top_3_coins text, price_change_percentage_1h double precisi... |
[
{
"role": "user",
"content": "Can you find all policyholders who have submitted a claim that has already been settled, along with the policy number and the settlement amount?"
},
{
"role": "assistant",
"content": "SELECT c.customer_id, c.first_name, c.last_name, p.policy_number, cl.settlement_am... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
[
{
"role": "user",
"content": "Show me all group chats with their names and the time they were last active."
},
{
"role": "assistant",
"content": "SELECT group_name, last_message_at FROM social_media.conversations WHERE is_group_chat = TRUE;"
},
{
"role": "user",
"content": "Only show... | You are an SQL statement expert. Given the table 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": "Show the symbol, name, and total supply for all SUI coins with status 'active'."
},
{
"role": "assistant",
"content": "SELECT scm.symbol, scm.name, scm.coin_type, scm.total_supply\nFROM sui_coins_metadata scm\nWHERE scm.status = 'active';"
},
{
"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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "For each property, count the total number of rooms and the total number of available services."
},
{
"role": "assistant",
"content": "SELECT r.property_id,\n COUNT(DISTINCT r.room_id) AS room_count,\n COUNT(DISTINCT s.service_id) FILTER (WHERE s.is_avail... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id text, property_id text, room_number text, room_type_id text, floor integer, stat... |
[
{
"role": "user",
"content": "Show the first and last name of each passenger along with the total number of bookings they have made."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, COUNT(b.booking_id) AS booking_count FROM transportation.passengers p LEFT JOIN transporta... | You are an SQL statement expert. Given the table 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": "For each verified user, count their followers and show user_id and follower_count, ordered by follower_count descending."
},
{
"role": "assistant",
"content": "SELECT u.user_id,\n COUNT(f.follower_user_id) AS follower_count\nFROM social_media.users u\nJOIN soc... | You are an SQL statement expert. Given the table 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": "Which users have disabled both email and push notifications? Please provide their user IDs and whether their profiles are private."
},
{
"role": "assistant",
"content": "SELECT user_id, private_profile FROM social_media.user_settings WHERE email_notifications_enable... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.user_settings ( setting_id text PRIMARY KEY, user_id text, theme text, email_notifications_enabled bool, p... |
[
{
"role": "user",
"content": "For each customer, what is their total premium amount and total deductible across all their policies?"
},
{
"role": "assistant",
"content": "SELECT customer_id, SUM(premium_amount) AS total_premium, SUM(deductible) AS total_deductible FROM insurance.policies GROUP 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.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d... |
[
{
"role": "user",
"content": "List all room types along with their property name and maximum occupancy, but only for room types with a base rate above 400."
},
{
"role": "assistant",
"content": "SELECT t1.type_name, t2.property_name, t1.max_occupancy FROM hospitality_technology.room_types AS t1 ... | You are an SQL statement expert. Given the table 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 text, property_id text, type_name text, description text, base_rate nu... |
[
{
"role": "user",
"content": "How many secondary insurance policies are there in the system?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS secondary_policy_count\nFROM healthcare.patient_insurance\nWHERE is_primary = FALSE;"
}
] | You are an SQL statement expert. Given the table 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 all available non-smoking rooms on floors 3 or higher, along with their room numbers and features, ordered by floor number."
},
{
"role": "assistant",
"content": "SELECT room_number, floor, features FROM hospitality_technology.rooms WHERE status = 'available... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i... |
[
{
"role": "user",
"content": "Could you list the route number and description for any routes that have a fuel log entry associated with their origin or destination location?"
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.route_number, T1.description FROM transportation.routes AS T1 JO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers (
driver_id character varying(64) NOT NULL, -- unique identifier for the driver
employe... |
[
{
"role": "user",
"content": "List staff members who were hired in the last calendar year, showing their full name, position, and hire date."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, position, hire_date FROM hospitality_technology.staff WHERE hire_date >= date_trunc('y... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.staff ( staff_id text PRIMARY KEY, property_id text, first_name text, last_name text, position t... |
[
{
"role": "user",
"content": "Give me the total number of doctors for each specialty."
},
{
"role": "assistant",
"content": "SELECT specialty, COUNT(*) AS doctor_count\nFROM healthcare.doctors\nGROUP BY specialty;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"role": "user",
"content": "List the first name, last name, and job title for all employees."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, job_title FROM financial_services.employees;"
},
{
"role": "user",
"content": "Only show employees who are currently act... | You are an SQL statement expert. Given the table 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, first_name character varying(100) NOT NULL, ... |
[
{
"role": "user",
"content": "List all trades that occurred on '2023-10-26' and have a status of 'PENDING'."
},
{
"role": "assistant",
"content": "SELECT * FROM financial_services.trades WHERE DATE(trade_timestamp) = '2023-10-26' AND status = 'PENDING';"
},
{
"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 financial_services.trades ( trade_id text, account_id text, security_id text, order_id text, trade_type text, quantity ... |
[
{
"role": "user",
"content": "Show all users along with the number of different assets they have traded as buyers."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, COUNT(DISTINCT t.asset_id) AS assets_traded\nFROM trading_platform.users u\nLEFT JOIN trading_platform.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 trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "Show the agency name and the number of employees for each agency that has at least one employee hired after January 1st, 2023."
},
{
"role": "assistant",
"content": "SELECT a.agency_name, COUNT(e.employee_id) AS employee_count\nFROM government_services.agencies a\nJ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, m... |
[
{
"role": "user",
"content": "Show me the total number of reservations for each property along with the property's name."
},
{
"role": "assistant",
"content": "SELECT p.property_id, p.property_name, COUNT(r.reservation_id) AS reservation_count\nFROM hospitality_technology.properties p\nLEFT JOIN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "Count how many insurance policies do not have a group number specified."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM healthcare.patient_insurance WHERE group_number 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.patient_insurance (
patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p... |
[
{
"role": "user",
"content": "Give me the count of locations per country and type. List country, type, and location_count."
},
{
"role": "assistant",
"content": "SELECT country, type, COUNT(*) AS location_count\nFROM transportation.locations\nGROUP BY country, type;"
},
{
"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 transportation.locations (
location_id character varying(64) NOT NULL, -- unique identifier for the location
n... |
[
{
"role": "user",
"content": "Get the count of room types and the average area_sqft per property."
},
{
"role": "assistant",
"content": "SELECT property_id,\n COUNT(room_type_id) AS room_type_count,\n AVG(area_sqft) AS avg_area\nFROM hospitality_technology.room_types\nGROUP BY p... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "Show me the total USD value of tokens held by each centralized exchange on the 'Polygon' chain for the most recent snapshot time. List the exchange name and the total USD value."
},
{
"role": "assistant",
"content": "WITH LatestSnapshot AS ( SELECT MAX(snapshot_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 project_fundraising_record (",
"id character varying(32) NOT NULL, -- fundraising record id",
"project_id ch... |
[
{
"role": "user",
"content": "List the top 5 Avalanche tokens by total transfer volume in token_activities_avalanche."
},
{
"role": "assistant",
"content": "SELECT tick, SUM(amt) AS total_volume\nFROM token_activities_avalanche\nGROUP BY tick\nORDER BY total_volume DESC\nLIMIT 5;"
},
{
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "Find all blocks mined in the last 30 days with a nonce value greater than 100000."
},
{
"role": "assistant",
"content": "SELECT * FROM blockchain.blocks WHERE timestamp >= NOW() - INTERVAL '30 days' AND nonce > 100000;"
},
{
"role": "user",
"content": "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 blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta... |
[
{
"role": "user",
"content": "Show me the top 5 users who have the highest total trade volume (quantity * price) as buyers, along with their wallet addresses and the number of distinct assets they traded."
},
{
"role": "assistant",
"content": "SELECT t.buyer_id, w.address, COUNT(DISTINCT t.asset... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timesta... |
[
{
"role": "user",
"content": "List all token symbols that have a positive ROI and a Realized Ratio greater than 0.7. Show their token symbol, chain, ROI, and Realized Ratio."
},
{
"role": "assistant",
"content": "SELECT token_symbol, chain, roi, realized_ratio FROM smart_money_token_performance ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_token_performance ( token_address character varying(100) NOT NULL, token_symbol character varying(100), pnl... |
[
{
"role": "user",
"content": "Retrieve the top 5 tokens by 24h price_change_percentage_24h from token_basic_info along with their chain, narrative, and total 24h trading volume. Also include the narrative's token count from narrative_info."
},
{
"role": "assistant",
"content": "SELECT t.token_sy... | You are an SQL statement expert. Given the table 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, -- the id of the token token_name character varying(100) NO... |
[
{
"role": "user",
"content": "Show me all active policies with coverage limits above $500,000, along with the customer names and agent names."
},
{
"role": "assistant",
"content": "SELECT p.policy_id, p.customer_id, p.agent_id, p.coverage_limit, c.first_name || ' ' || c.last_name AS customer_nam... | You are an SQL statement expert. Given the table 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 the user ID and username for all users, ordered by username alphabetically."
},
{
"role": "assistant",
"content": "SELECT user_id, username FROM blockchain.users ORDER BY username ASC;"
},
{
"role": "user",
"content": "From that list, only show user... | 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.users ( user_id.text, username.text, email.text, password_hash.text )
|
[
{
"role": "user",
"content": "For each vehicle, count how many maintenance logs exist."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id, v.make, v.model, COUNT(ml.log_id) AS maintenance_log_count FROM transportation.vehicles v JOIN transportation.maintenance_logs ml ON v.vehicle_id = m... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "For each security sector, what is the average volume recorded in the market data?"
},
{
"role": "assistant",
"content": "SELECT T2.sector, AVG(T1.volume) FROM financial_services.market_data AS T1 JOIN financial_services.securities AS T2 ON T1.security_id = T2.securi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.market_data (
data_point_id bigserial NOT NULL, -- auto-incrementing primary key
security_id... |
[
{
"role": "user",
"content": "List each citizen's full name and the number of documents they have uploaded per service category."
},
{
"role": "assistant",
"content": "SELECT c.first_name || ' ' || c.last_name AS full_name,\n s.category,\n COUNT(d.document_id) AS document_count\nFROM... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "For each agency, show the name and the number of distinct document types that have been submitted for applications of services they provide."
},
{
"role": "assistant",
"content": "SELECT ag.agency_name, COUNT(DISTINCT d.document_type) AS document_type_count\nFROM go... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Show each contract's address along with the total number of events it has emitted and the total number of transactions sent to it."
},
{
"role": "assistant",
"content": "SELECT\n c.address,\n COUNT(e.event_id) AS event_count,\n COUNT(t.transaction_id) AS tx_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 web3.contracts (
contract_id character varying(64) NOT NULL, -- unique identifier for the contract
address cha... |
[
{
"role": "user",
"content": "Show the total amount paid for services in each category."
},
{
"role": "assistant",
"content": "SELECT T2.category , SUM(T1.amount) FROM government_services.payments AS T1 JOIN government_services.services AS T2 ON T1.service_id = T2.service_id GROUP BY T2.categ... | You are an SQL statement expert. Given the table 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, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "Provide a list of all customers whose status is 'Active' and show their customer_id, full name, and email address."
},
{
"role": "assistant",
"content": "SELECT customer_id, first_name || ' ' || last_name AS full_name, email\nFROM insurance.customers\nWHERE status =... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "List the first name, last name, license number, and status for all drivers whose license expires in the next 6 months."
},
{
"role": "assistant",
"content": "SELECT\n first_name,\n last_name,\n license_number,\n status\nFROM transportation.drivers\nWHERE\n lice... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ... |
[
{
"role": "user",
"content": "Which games have at least one achievement worth exactly 75 points, and what are the names and descriptions of those achievements?"
},
{
"role": "assistant",
"content": "SELECT g.title, a.name AS achievement_name, a.description\nFROM gaming_technology.games g\nJOIN 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.games (
game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game
ti... |
[
{
"role": "user",
"content": "List all drivers who have completed more than 20 trips in the past month."
},
{
"role": "assistant",
"content": "SELECT driver_id, COUNT(*) AS trip_count FROM transportation.trips WHERE status = 'completed' AND actual_departure >= CURRENT_DATE - INTERVAL '1 month' 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 transportation.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var... |
[
{
"role": "user",
"content": "What is the total estimated_loss and average settlement_amount for all claims with status 'Approved'?"
},
{
"role": "assistant",
"content": "SELECT SUM(estimated_loss) AS total_estimated_loss,\n AVG(settlement_amount) AS average_settlement\nFROM insurance.clai... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d... |
[
{
"role": "user",
"content": "List all reservations for rooms on the 3rd floor, including guest_id, reservation_id, room_number, property_name, and check_in_date."
},
{
"role": "assistant",
"content": "SELECT r.reservation_id, r.guest_id, ro.room_number, p.property_name, r.check_in_date\nFROM ho... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "Find players who own items with rarity 'Rare' or higher ('Epic', 'Legendary') and list their usernames."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.username FROM players AS T1 INNER JOIN player_inventory AS T2 ON T1.player_id = T2.player_id INNER JOIN ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, ite... |
[
{
"role": "user",
"content": "Give me the count of clients who registered in each month of 2023."
},
{
"role": "assistant",
"content": "SELECT TO_CHAR(date_registered, 'YYYY-MM') AS reg_month, COUNT(*) AS client_count FROM legal_services.clients WHERE date_registered BETWEEN '2023-01-01' AND '20... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "Show me the total number of customers and their average age grouped by city."
},
{
"role": "assistant",
"content": "SELECT city, COUNT(customer_id) AS total_customers, AVG(EXTRACT(YEAR FROM NOW()) - EXTRACT(YEAR FROM date_of_birth)) AS average_age FROM financial_ser... | You are an SQL statement expert. Given the table 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 top 5 projects by total investment value, along with their latest fundraising round name and valuation."
},
{
"role": "assistant",
"content": "SELECT project_name, rounds_name, valuation, SUM(investment_value) AS total_investment_value FROM project_fundr... | You are an SQL statement expert. Given the table 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": "Show me all wallets holding at least 3 different ERC1155 NFTs on Ethereum, along with the number of distinct tokens held by each wallet."
},
{
"role": "assistant",
"content": "SELECT wallet_address, COUNT(DISTINCT token_id) as distinct_tokens\nFROM nft_holders\nWHER... | You are an SQL statement expert. Given the table 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.