conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Show me all servers that have the same current_players value as another server in a different region. List both server names, their regions, and the current_players value."
},
{
"role": "assistant",
"content": "SELECT s1.server_name AS server1, s1.region AS region1,... | You are an SQL statement expert. Given the table 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, game_id.uuid, server_name.text, region.text, ip_address.text, port.integer,... |
[
{
"role": "user",
"content": "Give me the number of securities and the latest update timestamp for each security_type."
},
{
"role": "assistant",
"content": "SELECT security_type,\n COUNT(*) AS security_count,\n MAX(last_updated) AS latest_update\nFROM financial_services.securities\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.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu... |
[
{
"role": "user",
"content": "List the names of all law firms along with the names (first and last) of lawyers who are partners in those firms."
},
{
"role": "assistant",
"content": "SELECT lf.firm_name, l.first_name, l.last_name\nFROM legal_services.law_firms lf\nJOIN legal_services.lawyers l O... | You are an SQL statement expert. Given the table 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": "List all billable but unbilled time entries including entry_id, lawyer_id, case_id, date_worked, hours_spent, and billing_rate."
},
{
"role": "assistant",
"content": "SELECT entry_id, lawyer_id, case_id, date_worked, hours_spent, billing_rate\nFROM legal_services.ti... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.law_firms ( firm_id text, firm_name text, address text, phone text, website text, founded_date date, man... |
[
{
"role": "user",
"content": "List all distinct job titles present in the organization."
},
{
"role": "assistant",
"content": "SELECT DISTINCT job_title FROM government_services.employees;"
}
] | You are an SQL statement expert. Given the table 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.employees (
employee_id character varying(64) NOT NULL, -- unique identifier for the government... |
[
{
"role": "user",
"content": "List all conversation participants along with post_hashtag details where the participant's user_id matches the hashtag_id."
},
{
"role": "assistant",
"content": "SELECT cp.conversation_id, cp.user_id, ph.post_id, ph.hashtag_id\nFROM social_media.conversation_partici... | You are an SQL statement expert. Given the table 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": "Find pairs of items within each game that share the same rarity but have different item_types. Show game_id, rarity, item1_name, and item2_name."
},
{
"role": "assistant",
"content": "SELECT i1.game_id, i1.rarity, i1.item_name AS item1_name, i2.item_name AS item2_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 gaming_technology.in_game_items ( item_id uuid PRIMARY KEY, game_id uuid, item_name text, item_type text, description t... |
[
{
"role": "user",
"content": "I need a list of active drivers with their names and contact details."
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name, contact_number, email FROM transportation.drivers WHERE status = 'Active';"
},
{
"role": "user",
"conten... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... |
[
{
"role": "user",
"content": "Show the count of patients residing in each unique address, excluding any entries with no address listed."
},
{
"role": "assistant",
"content": "SELECT address, COUNT(patient_id) AS patient_count FROM healthcare.patients WHERE address IS NOT NULL AND address != '' 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 healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "Show me the top 3 tokens by 24-hour trading volume in the 'NFT' narrative, along with their price and market cap."
},
{
"role": "assistant",
"content": "SELECT token_name, token_symbol, total_volume, price, market_cap FROM token_basic_info WHERE narrative = 'NFT' OR... | You are an SQL statement expert. Given the table 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 pairs of documents within the same case that were uploaded on the same day but by different lawyers. Show the case_id, upload_date, document_id and uploader_id for both documents in the pair."
},
{
"role": "assistant",
"content": "SELECT d1.case_id, DATE(d1.upl... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "How can I pair developers that share the same website domain? Show domain, dev1, dev2."
},
{
"role": "assistant",
"content": "SELECT split_part(website, '/', 3) AS domain,\n d1.name AS dev1,\n d2.name AS dev2\nFROM gaming_technology.developers d1\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.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "Show me all premium payments made in the last quarter, along with the corresponding policy and customer information."
},
{
"role": "assistant",
"content": "SELECT pp.payment_id, pp.policy_id, pp.customer_id, pp.payment_date, pp.amount_paid, pp.payment_method FROM 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 insurance.agents ( agent_id text PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, l... |
[
{
"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": "Show the wallet address and amount for the token with tick 'ordi', along with its maximum supply from the `token_info` table."
},
{
"role": "assistant",
"content": "SELECT T1.wallet_address, T1.amount, T2.max_supply FROM token_balances AS T1 JOIN token_info AS T2 ON... | 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 token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, t... |
[
{
"role": "user",
"content": "List lawyers who have any unbilled time entries. Show their first name, last name, and the count of their unbilled entries."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, COUNT(T2.entry_id) FROM lawyers AS T1 JOIN time_entries AS T2 ON 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 legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t... |
[
{
"role": "user",
"content": "Show me all transactions (transaction_id, amount, transaction_type) where the status is 'Completed' and the transaction_date is within the last 30 days, along with the security details (ticker_symbol, security_name) for securities traded on the same day as the transaction."
}... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.transactions ( transaction_id.text, account_id.text, related_account_id.text, transaction_type.text,... |
[
{
"role": "user",
"content": "Show me all doctors and the insurance plans provided by 'WellLife'. Include the doctor's full name and the plan name."
},
{
"role": "assistant",
"content": "SELECT d.first_name, d.last_name, ip.plan_name\nFROM healthcare.doctors d\nCROSS JOIN healthcare.insurance_pl... | You are an SQL statement expert. Given the table 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 each payment_method and the number of premium payments made using that method, sorted by the count in descending order."
},
{
"role": "assistant",
"content": "SELECT payment_method, COUNT(*) AS payment_count FROM insurance.premium_payments GROUP BY payment_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 insurance.agents ( agent_id text, first_name text, last_name text, agency_name text, license_number text, license_state... |
[
{
"role": "user",
"content": "How many citizens are marked as not verified?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM government_services.citizens WHERE is_verified = 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 government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"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": "I want to retrieve a list of all doctors along with every insurance plan name, showing doctor ID, first and last names, and insurance plan name."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id, d.first_name, d.last_name, p.plan_name\nFROM healthcare.doctor... | You are an SQL statement expert. Given the table 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": "List the user ID, username, and wallet address for all users who have at least one unspent UTXO associated with any of their wallets."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.user_id, T1.username, T2.address FROM trading_platform.users AS T1 JOIN tr... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text, username text, email text, password_hash text, created_at timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "Can you list all securities that have had at least one trade in the past 30 days? Please include the ticker_symbol, security_name, exchange, and the total number of trades for each security."
},
{
"role": "assistant",
"content": "SELECT s.ticker_symbol, s.security_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.securities ( security_id text, ticker_symbol text, isin_code text, cusip_code text, security_name te... |
[
{
"role": "user",
"content": "List pairs of invoice numbers for the same case, including their issue dates."
},
{
"role": "assistant",
"content": "SELECT T1.invoice_number AS invoice1_number, T2.invoice_number AS invoice2_number, T1.case_id, T1.issue_date AS invoice1_issue_date, T2.issue_date 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 legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_... |
[
{
"role": "user",
"content": "List all claims that are still pending (status = 'pending') and were reported more than 30 days ago."
},
{
"role": "assistant",
"content": "SELECT claim_id, policy_id, customer_id, reported_date FROM insurance.claims WHERE status = 'pending' AND reported_date < CURR... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara... |
[
{
"role": "user",
"content": "Can you show me how many achievements each player unlocks per day? Return player_id, unlock_date, and achievement_count."
},
{
"role": "assistant",
"content": "SELECT player_id,\n CAST(unlocked_at AS date) AS unlock_date,\n COUNT(*) AS achievement_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 gaming_technology.player_achievements ( player_achievement_id uuid, player_id uuid, achievement_id uuid, unlocked_at ti... |
[
{
"role": "user",
"content": "Retrieve each citizen's first_name, last_name, and their most recent notification's message_subject and sent_at, only for notifications sent via 'Email'."
},
{
"role": "assistant",
"content": "SELECT c.first_name,\n c.last_name,\n n.message_subject,\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, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "List the event_id, event_name, emitted_at, contract_id from the events table, and the token_symbol and token_name for the token associated with that contract address from the tokens table, for all events that have a corresponding token."
},
{
"role": "assistant",
"c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "Can you list all patients along with the insurance plan names they are enrolled in? Please include patient ID, first name, last name, and plan name."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, ip.plan_name\nFROM 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.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "Which cases have at least one document uploaded, and what are the names and case numbers of those cases along with the most recent document name for each?"
},
{
"role": "assistant",
"content": "SELECT c.case_id, c.case_name, c.case_number, d.document_name AS latest_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases ( case_id character varying(64) NOT NULL, case_number character varying(100) UNIQUE, case_name tex... |
[
{
"role": "user",
"content": "What is the maintenance schedule for the platforms at the station with ID 'ST234' for the next month?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to the maintenance schedule for the platforms at any station. The data I have only include... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.s... |
[
{
"role": "user",
"content": "Show me each case ID with its latest uploaded document. I want to see the case ID, document name, version, and upload timestamp for the most recently uploaded document in each case."
},
{
"role": "assistant",
"content": "SELECT d.case_id, d.document_name, d.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 text, case_id text, document_name text, document_type text, storage_path text, u... |
[
{
"role": "user",
"content": "List all agents along with their manager's first and last name for agents whose status is 'active'."
},
{
"role": "assistant",
"content": "SELECT a.agent_id,\n a.first_name AS agent_first_name,\n a.last_name AS agent_last_name,\n m.agent_id AS mana... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, first_name text, last_name text, agency_name text, license_number text, l... |
[
{
"role": "user",
"content": "How many achievements were unlocked in total in the year 2023?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM gaming_technology.player_achievements WHERE unlocked_at >= '2023-01-01 00:00:00+00' AND unlocked_at < '2024-01-01 00:00:00+00';"
},
{
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid N... |
[
{
"role": "user",
"content": "Find reviews that contain the word 'dirty' in the comment section, showing the review ID, comment, and rating."
},
{
"role": "assistant",
"content": "SELECT review_id, comment, rating_overall FROM hospitality_technology.reviews WHERE LOWER(comment) LIKE '%dirty%';"
... | You are an SQL statement expert. Given the table 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.reviews ( review_id.text, property_id.text, reservation_id.text, guest_id.text, rating_overall.i... |
[
{
"role": "user",
"content": "List all pairs of tokens (show token_id for both) that share the same contract address, excluding pairs where the token_id is the same."
},
{
"role": "assistant",
"content": "SELECT t1.token_id AS token_id1, t2.token_id AS token_id2, t1.contract_address FROM web3.to... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.tokens ( token_id character varying(64) NOT NULL, contract_address character varying(128) NOT NULL, token_name cha... |
[
{
"role": "user",
"content": "For each publisher, find pairs of games they have published that belong to different genres. Include publisher_id, the genre and title of both games in each pair."
},
{
"role": "assistant",
"content": "SELECT g1.publisher_id,\n g1.genre AS genre1,\n g1.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 gaming_technology.games (
game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game
ti... |
[
{
"role": "user",
"content": "List all DApps along with their URLs."
},
{
"role": "assistant",
"content": "SELECT name, url FROM trading_platform.dapps;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "Show the count of posts for each distinct media type."
},
{
"role": "assistant",
"content": "SELECT media_type, COUNT(*) FROM social_media.posts GROUP BY media_type;"
},
{
"role": "user",
"content": "Only include posts created after June 1, 2024."
},
... | You are an SQL statement expert. Given the table 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": "What is the count of securities for each security_type in the 'Financial' sector?"
},
{
"role": "assistant",
"content": "SELECT security_type, COUNT(*) as security_count FROM financial_services.securities WHERE sector = 'Financial' GROUP BY security_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 financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu... |
[
{
"role": "user",
"content": "List all drivers who have operated trips using Electric vehicles. Include driver ID, full name, and the number of Electric trips they've operated."
},
{
"role": "assistant",
"content": "SELECT d.driver_id, d.first_name || ' ' || d.last_name AS full_name, COUNT(*) 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 transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "What is the average interest rate for auto loans (loan_type = 'Auto') with a principal amount between $20,000 and $50,000?"
},
{
"role": "assistant",
"content": "SELECT AVG(interest_rate) AS average_interest_rate FROM financial_services.loans WHERE loan_type = 'Auto... | You are an SQL statement expert. Given the table 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 available services in the 'Housekeeping' department that cost less than 20."
},
{
"role": "assistant",
"content": "SELECT service_id, service_name, price\nFROM hospitality_technology.services\nWHERE department = 'Housekeeping' AND is_available = true AND pr... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id text, property_id text, room_number text, room_type_id text, floor integer, stat... |
[
{
"role": "user",
"content": "Show me pairs of invoice numbers for the same case."
},
{
"role": "assistant",
"content": "SELECT T1.invoice_number, T2.invoice_number, T1.case_id FROM legal_services.invoices AS T1 JOIN legal_services.invoices AS T2 ON T1.case_id = T2.case_id AND T1.invoice_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.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_... |
[
{
"role": "user",
"content": "Provide the total quantity of items acquired by each player and the most recent acquisition date."
},
{
"role": "assistant",
"content": "SELECT pi.player_id,\n SUM(pi.quantity) AS total_quantity,\n MAX(pi.acquired_at) AS last_acquired_at\nFROM gaming_tec... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), title character varying(200) NOT NULL, devel... |
[
{
"role": "user",
"content": "List all posts that have at least two hashtags and have received more than 5 likes. Return the post_id and the number of likes as like_count."
},
{
"role": "assistant",
"content": "SELECT p.post_id,\n COUNT(l.like_id) AS like_count\nFROM social_media.posts 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 social_media.posts (
post_id character varying(64) NOT NULL, -- unique identifier for the post
user_id characte... |
[
{
"role": "user",
"content": "Find documents that have the same document_name but are associated with different cases. Show the document name and the two different case IDs."
},
{
"role": "assistant",
"content": "SELECT d1.document_name, d1.case_id AS case_id_1, d2.case_id AS case_id_2 FROM lega... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "Show me all claims along with the related customer's full name and the policy number for incidents that occurred in 2024."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.incident_date, c.description, cu.first_name || ' ' || cu.last_name AS customer_full_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "For each user, how many wallets have they created?"
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(*) AS wallet_count FROM trading_platform.wallets GROUP BY user_id;"
},
{
"role": "user",
"content": "Actually, I want to see only users with 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 trading_platform.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "Show each route's route_id and the total number of completed trips associated with it."
},
{
"role": "assistant",
"content": "SELECT route_id, COUNT(*) AS completed_trip_count\nFROM transportation.trips\nWHERE status = 'Completed'\nGROUP BY route_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 transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text... |
[
{
"role": "user",
"content": "Show policy number, cancellation date, and the customer's first and last name for policies cancelled due to 'Non-Payment'."
},
{
"role": "assistant",
"content": "SELECT T1.policy_number, T1.cancellation_date, T2.first_name, T2.last_name FROM policies AS T1 JOIN cust... | You are an SQL statement expert. Given the table 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 each user's username along with the number of posts they've made that include any media attachment, ordering the results by that count descending."
},
{
"role": "assistant",
"content": "SELECT u.username, COUNT(p.post_id) AS media_post_count\nFROM 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.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "How many unique patient records are there for each gender?"
},
{
"role": "assistant",
"content": "SELECT gender, COUNT(DISTINCT patient_id) AS patient_count FROM healthcare.patients GROUP BY gender;"
}
] | You are an SQL statement expert. Given the table 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": "Calculate the total value of unspent UTXOs for each user whose KYC status has been 'approved'."
},
{
"role": "assistant",
"content": "SELECT kyc.user_id, SUM(u.amount) FROM trading_platform.kyc_audit kyc JOIN trading_platform.utxos u ON kyc.user_id = u.user_id WHERE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.utxos ( utxo_id.text, transaction_id.text, output_index.integer, address.text, amount.numeric, spent.b... |
[
{
"role": "user",
"content": "List the username and email of users whose first wallet creation date is the same day as their user registration date."
},
{
"role": "assistant",
"content": "SELECT u.username, u.email FROM web3.users u JOIN (SELECT user_id, MIN(created_at) as first_wallet_created_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 web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "Show assets of type 'token', including their name, symbol, and any associated metadata key and value."
},
{
"role": "assistant",
"content": "SELECT t1.name, t1.symbol, t2.key, t2.value FROM trading_platform.assets AS t1 LEFT JOIN trading_platform.metadata AS t2 ON 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 me all customers (customer_id, first_name, last_name) who live in California (state = 'CA') and have a risk_profile of 'High', along with their email addresses."
},
{
"role": "assistant",
"content": "SELECT customer_id, first_name, last_name, email FROM financi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "For each doctor, find the longest single appointment duration. Return doctor_id, first_name, last_name, and max_duration."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id,\n d.first_name,\n d.last_name,\n MAX(a.duration_minutes) AS max_dur... | You are an SQL statement expert. Given the table 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 the scheduled start times and service names for all appointments, along with the description of those services."
},
{
"role": "assistant",
"content": "SELECT a.scheduled_start_time, s.service_name, s.description\nFROM government_services.appointments a\nJOIN 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.services (
service_id character varying(64) NOT NULL, -- unique identifier for the service
... |
[
{
"role": "user",
"content": "For each employee, show their first name, last name, and the total payment amount for applications they have been assigned to process."
},
{
"role": "assistant",
"content": "SELECT e.first_name, e.last_name, SUM(p.amount) AS total_payment_amount\nFROM government_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 government_services.services ( service_id text, agency_id text, service_name text, description text, category text, eli... |
[
{
"role": "user",
"content": "Show the list of developer names and their corresponding website domains (the domain part of the website URL)."
},
{
"role": "assistant",
"content": "SELECT name, \n CASE \n WHEN website LIKE 'http%' THEN SUBSTRING(website FROM '://([^/]+)')\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.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_... |
[
{
"role": "user",
"content": "How many documents of each type exist in the system? Show the document type and the count."
},
{
"role": "assistant",
"content": "SELECT document_type, COUNT(*) AS document_count\nFROM legal_services.documents\ngroup BY document_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 legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"role": "user",
"content": "Find claim IDs that have more than 5 documents of type 'PHOTO'."
},
{
"role": "assistant",
"content": "SELECT claim_id FROM insurance.claim_documents WHERE document_type = 'PHOTO' GROUP BY claim_id HAVING COUNT(*) > 5;"
},
{
"role": "user",
"content": "C... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claim_documents ( document_id text PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ... |
[
{
"role": "user",
"content": "Show me all pairs of achievements unlocked by the same player on the same calendar date, returning player_id, achievement_id as achv1, achv2, and the date."
},
{
"role": "assistant",
"content": "SELECT pa1.player_id,\n DATE(pa1.unlocked_at) AS unlock_date,\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.player_achievements (
player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique id... |
[
{
"role": "user",
"content": "List the full names of citizens who have submitted applications for services provided by agencies at the 'Federal' jurisdiction level."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name FROM government_services.citizens AS T1 INNER JOIN govern... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth... |
[
{
"role": "user",
"content": "Count the total number of premium payments made in the year 2024."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM premium_payments WHERE EXTRACT(YEAR FROM payment_date) = 2024"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "List all claims that were reported more than 30 days after the incident date."
},
{
"role": "assistant",
"content": "SELECT claim_id, policy_id, customer_id, incident_date, reported_date FROM insurance.claims WHERE DATEDIFF(reported_date, incident_date) > 30;"
},
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d... |
[
{
"role": "user",
"content": "List all payments made using a credit card, including guest_id, amount, payment_method, and payment_timestamp."
},
{
"role": "assistant",
"content": "SELECT guest_id, amount, payment_method, payment_timestamp FROM hospitality_technology.payments WHERE payment_method... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.payments ( payment_id text, reservation_id text, guest_id text, bill_id text, amount numeric, cu... |
[
{
"role": "user",
"content": "What are the specific tools or equipment used during the maintenance with record_id 'REC456'?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information about the specific tools or equipment used during a maintenance record. The data in the ma... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.m... |
[
{
"role": "user",
"content": "Show the contract address and total number of approvals for all ERC20 tokens from the erc20_approval table."
},
{
"role": "assistant",
"content": "SELECT contract_address, COUNT(*) AS total_approvals\nFROM erc20_approval\nGROUP BY contract_address;"
},
{
"ro... | You are an SQL statement expert. Given the table 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": "Could you list each employee along with their manager’s full name?"
},
{
"role": "assistant",
"content": "SELECT e.employee_id, e.first_name || ' ' || e.last_name AS employee_name, m.first_name || ' ' || m.last_name AS manager_name\nFROM financial_services.employees... | You are an SQL statement expert. Given the table 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.employees ( employee_id text, first_name text, last_name text, job_title text, department text, bran... |
[
{
"role": "user",
"content": "Count the total number of blocks mined for each day of the week."
},
{
"role": "assistant",
"content": "SELECT TO_CHAR(timestamp, 'Day') AS day_of_week, COUNT(*) AS block_count FROM blockchain.blocks GROUP BY day_of_week;"
},
{
"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 blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta... |
[
{
"role": "user",
"content": "List all invoices that were paid within 7 days of their issue date. Show invoice number, issue date, payment date, and total amount."
},
{
"role": "assistant",
"content": "SELECT invoice_number, issue_date, payment_date, total_amount FROM legal_services.invoices 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 legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph... |
[
{
"role": "user",
"content": "Show me all managers (agents who have other agents reporting to them) along with their full names and the count of agents they manage."
},
{
"role": "assistant",
"content": "SELECT m.agent_id, m.first_name, m.last_name, COUNT(a.agent_id) AS team_size FROM insurance.... | You are an SQL statement expert. Given the table 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": "How many passengers were created each year? Provide the year and passenger_count."
},
{
"role": "assistant",
"content": "SELECT EXTRACT(YEAR FROM created_at) AS year, COUNT(*) AS passenger_count\nFROM transportation.passengers\nGROUP BY year\nORDER BY year;"
},
... | You are an SQL statement expert. Given the table 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, first_name character varying(128) NOT NULL, la... |
[
{
"role": "user",
"content": "Find the total number of documents uploaded by each citizen along with their first and last names."
},
{
"role": "assistant",
"content": "SELECT c.citizen_id, c.first_name, c.last_name, COUNT(d.document_id) AS document_count\nFROM government_services.citizens c\nLEF... | You are an SQL statement expert. Given the table 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 drivers who have completed more than 10 trips in the last month, along with their contact information and the average passenger count for their trips."
},
{
"role": "assistant",
"content": "SELECT d.driver_id, d.first_name, d.last_name, d.contact_number,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens... |
[
{
"role": "user",
"content": "List all locations of type 'depot' in the United States, showing their name, state, and city."
},
{
"role": "assistant",
"content": "SELECT name, state_province, city FROM transportation.locations WHERE country = 'United States' AND type = 'depot';"
},
{
"ro... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.locations ( location_id text, name text, type text, address_line1 text, city text, state_province text, ... |
[
{
"role": "user",
"content": "For each server, show its name and the total number of achievements available for the game it hosts."
},
{
"role": "assistant",
"content": "SELECT s.server_name, s.region, COUNT(a.achievement_id) AS achievement_count\nFROM gaming_technology.servers s\nLEFT JOIN gami... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid NOT NULL DEFAULT gen_random_uuid(), name character varying(150) NOT NU... |
[
{
"role": "user",
"content": "Show me the total premium paid by each customer for insurance products where the base premium is less than 2000. I want to see customer_id, product_id, and total_premium_paid."
},
{
"role": "assistant",
"content": "SELECT pp.customer_id, ip.product_id, SUM(pp.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 insurance.insurance_products ( product_id character varying(64) NOT NULL, product_name character varying(150) NOT NULL,... |
[
{
"role": "user",
"content": "Show me the appointment ID, subject, and the full name of the lawyer for all appointments where a location is specified."
},
{
"role": "assistant",
"content": "SELECT T2.appointment_id, T2.subject, T1.first_name, T1.last_name FROM legal_services.lawyers AS T1 JOIN l... | You are an SQL statement expert. Given the table 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, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "Which patients have insurance policies that are effective between May 1st, 2023 and October 1st, 2023? Show their patient_id, policy_number, and effective_date, and also include the related plan_id."
},
{
"role": "assistant",
"content": "SELECT patient_id, policy_nu... | You are an SQL statement expert. Given the table 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": "List the appointment ID, start time, and the case number for all appointments that are linked to a case."
},
{
"role": "assistant",
"content": "SELECT T1.appointment_id, T1.start_time, T2.case_number FROM legal_services.appointments AS T1 JOIN legal_services.cases 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 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 the latest time each player acquired any item."
},
{
"role": "assistant",
"content": "SELECT player_id, MAX(acquired_at) AS last_acquired_at FROM gaming_technology.player_inventory GROUP BY player_id;"
},
{
"role": "user",
"content": "Actually, can ... | You are an SQL statement expert. Given the table 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(), -- unique identifier for... |
[
{
"role": "user",
"content": "Find pairs of achievements within each game where the point difference is exactly 10."
},
{
"role": "assistant",
"content": "SELECT a1.achievement_id AS ach1_id,\n a2.achievement_id AS ach2_id,\n ABS(a1.points - a2.points) AS point_diff\nFROM gaming_tech... | You are an SQL statement expert. Given the table 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.achievements ( achievement_id.uuid, game_id.uuid, name.text, description.text, icon_url.text, points.... |
[
{
"role": "user",
"content": "List all premium payments made by customer 'CUST001' in the year 2024. Show payment ID, policy ID, amount paid, and payment date."
},
{
"role": "assistant",
"content": "SELECT payment_id, policy_id, amount_paid, payment_date FROM insurance.premium_payments WHERE cus... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.premium_payments (
payment_id character varying(64) NOT NULL, -- unique identifier for the payment
po... |
[
{
"role": "user",
"content": "For each service order, list the order_id, reservation_id, the full name of the staff who ordered it as ordered_by, and the full name of the staff who delivered it as delivered_by."
},
{
"role": "assistant",
"content": "SELECT so.order_id,\n so.reservation_id,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.staff ( staff_id text, property_id text, first_name text, last_name text, position text, work_em... |
[
{
"role": "user",
"content": "What is the count of securities for each currency in the 'Energy' sector?"
},
{
"role": "assistant",
"content": "SELECT currency, COUNT(*) as security_count FROM financial_services.securities WHERE sector = 'Energy' GROUP BY currency;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities ( security_id character varying(64) NOT NULL, ticker_symbol character varying(20) NOT NUL... |
[
{
"role": "user",
"content": "Show the usernames of users who have a non-empty bio."
},
{
"role": "assistant",
"content": "SELECT username FROM social_media.users WHERE bio IS NOT NULL AND bio != '';"
},
{
"role": "user",
"content": "Now, only show users who were created before 2024.... | You are an SQL statement expert. Given the table 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 all wallets along with their user IDs, but only for wallets created in 2023."
},
{
"role": "assistant",
"content": "SELECT wallet_id, user_id, address, created_at FROM web3.wallets WHERE created_at BETWEEN '2023-01-01' AND '2023-12-31';"
},
{
"role": "u... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
|
[
{
"role": "user",
"content": "Provide the total count of UTXOs grouped by their spent status."
},
{
"role": "assistant",
"content": "SELECT spent, COUNT(*) AS utxo_count\nFROM trading_platform.utxos\nGROUP BY spent;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan... |
[
{
"role": "user",
"content": "List all staff members who have an access level greater than 3, showing their staff ID, first name, and last name."
},
{
"role": "assistant",
"content": "SELECT staff_id, first_name, last_name FROM hospitality_technology.staff WHERE access_level > 3;"
},
{
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id text, property_id text, room_number text, room_type_id text, floor integer, stat... |
[
{
"role": "user",
"content": "Which pairs of tokens on the same chain have the greatest difference in 24h trading volume? List the two token symbols, their volumes, the absolute difference, and the chain. Limit to the top 3 pairs."
},
{
"role": "assistant",
"content": "SELECT a.chain,\n 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 token_dexpool_info (",
"pair_address character varying(512) NOT NULL, -- the id of dexpool",
"token_name cha... |
[
{
"role": "user",
"content": "List all projects that have completed a Series A funding round, including their investment value and valuation."
},
{
"role": "assistant",
"content": "SELECT project_name, investment_value, valuation FROM project_fundraising_record WHERE rounds_name = 'Series 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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "Show all users whose full name starts with 'A' and who have updated their profile in June 2024. Please include their usernames and updated_at timestamps."
},
{
"role": "assistant",
"content": "SELECT username, updated_at FROM social_media.users WHERE full_name ILIKE... | You are an SQL statement expert. Given the table 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 each document_name along with the count of its versions, but only include those document_names that have more than 3 versions."
},
{
"role": "assistant",
"content": "SELECT document_name,\n COUNT(version) AS version_count\nFROM legal_services.documents\nG... | You are an SQL statement expert. Given the table 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": "What is the average cost per unit for fuel at each location type? Show the location type and the average cost."
},
{
"role": "assistant",
"content": "SELECT T2.type , AVG(T1.cost_per_unit) FROM transportation.fuel_logs AS T1 JOIN transportation.locations AS T2 ON 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.locations ( location_id text PRIMARY KEY, name text, type text, address_line1 text, city text, state_pro... |
[
{
"role": "user",
"content": "Give me a count of invoices issued for each case this year, and show the case ID with the count."
},
{
"role": "assistant",
"content": "SELECT case_id, COUNT(*) AS invoice_count\nFROM legal_services.invoices\nWHERE EXTRACT(YEAR FROM issue_date) = EXTRACT(YEAR FROM C... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices (
invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice
invo... |
[
{
"role": "user",
"content": "Find all notifications where the message subject contains the word 'Alert'."
},
{
"role": "assistant",
"content": "SELECT notification_id, citizen_id, application_id, message_subject, message_body, channel, sent_at, status, related_entity_type, related_entity_id FRO... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.notifications ( notification_id text, citizen_id text, application_id text, message_subject text, m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.