conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"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": "List all invoices that do not have any associated documents for their case. Show the invoice number, total amount, and case_id."
},
{
"role": "assistant",
"content": "SELECT i.invoice_number, i.total_amount, i.case_id\nFROM legal_services.invoices i\nLEFT JOIN legal... | You are an SQL statement expert. Given the table 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": "List all fuel logs for vehicle 'VHCL123', including the fuel type, quantity, and total cost."
},
{
"role": "assistant",
"content": "SELECT fuel_log_id, fuel_type, quantity, total_cost FROM transportation.fuel_logs WHERE vehicle_id = 'VHCL123';"
},
{
"role": ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, qu... |
[
{
"role": "user",
"content": "Find the fastest reply for each conversation, showing conversation_id, initial_message_id, reply_message_id, and response_time in seconds."
},
{
"role": "assistant",
"content": "SELECT m1.conversation_id,\n m1.message_id AS initial_message_id,\n m2.messa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.messages (
message_id character varying(64) NOT NULL, -- unique identifier for the message
convers... |
[
{
"role": "user",
"content": "Find users who have never followed anyone but have created at least 5 posts. Return user_id and post_count."
},
{
"role": "assistant",
"content": "SELECT u.user_id, COUNT(p.post_id) AS post_count\nFROM social_media.users u\nLEFT JOIN social_media.posts p ON u.user_i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "Count how many users have not specified a value for their bio."
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.users WHERE bio IS NULL OR bio = '';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses."
},
{
"role": "assistant",
"content": "SELECT name, contract_address, total_supply FROM token_metas WHERE is_erc20 = 1 ORDER BY CAST(total_supply AS decimal)... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "Show 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": "Get the total number of guests for each country_code."
},
{
"role": "assistant",
"content": "SELECT country_code, COUNT(*) AS guest_count\nFROM hospitality_technology.guests\nGROUP BY country_code;"
},
{
"role": "user",
"content": "Actually, only 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 hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "List the user IDs for users who have both private profiles enabled and push notifications enabled."
},
{
"role": "assistant",
"content": "SELECT user_id FROM social_media.user_settings WHERE private_profile = TRUE AND push_notifications_enabled = TRUE;"
}
] | You are an SQL statement expert. Given the table 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.likes ( like_id text, user_id text, post_id text, comment_id text, created_at timestamp )
CREATE TABLE soc... |
[
{
"role": "user",
"content": "Show me all active agents who have handled claims with police reports, along with the count of such claims per agent."
},
{
"role": "assistant",
"content": "SELECT a.agent_id, a.first_name, a.last_name, COUNT(c.claim_id) AS police_report_claim_count FROM insurance.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 insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"role": "user",
"content": "I need a list of claim_ids that have at least one document of type 'Photo' and at least one of type 'Invoice'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT cd.claim_id\nFROM insurance.claim_documents cd\nWHERE cd.document_type IN ('Photo', 'Invoice');"
}... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "List all appointments with their subject and associated case number for appointments that have both a case_id and a non-null location."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, a.subject, a.case_id, c.case_number\nFROM legal_services.appointmen... | You are an SQL statement expert. Given the table 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, -- unique identifier for the case/matter
case_n... |
[
{
"role": "user",
"content": "List all agencies that do not have a website URL specified. Return their agency_id, agency_name, and main_phone_number."
},
{
"role": "assistant",
"content": "SELECT agency_id, agency_name, main_phone_number FROM government_services.agencies WHERE website_url IS NUL... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... |
[
{
"role": "user",
"content": "Which citizens have had both applications and appointments for services in the 'Healthcare' category? List their full name, application ID, and appointment ID."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.first_name || ' ' || c.last_name AS full_name, a.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth... |
[
{
"role": "user",
"content": "For each state, show the total number of service locations and the number of employees working at agencies within those states."
},
{
"role": "assistant",
"content": "SELECT sl.state, COUNT(DISTINCT sl.location_id) AS location_count, COUNT(DISTINCT e.employee_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 government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth... |
[
{
"role": "user",
"content": "List all premium payments along with the full name of the agent who sold each policy and the name of the related insurance product."
},
{
"role": "assistant",
"content": "SELECT pp.payment_id, pp.amount_paid, pp.payment_date, a.first_name AS agent_first_name, a.last... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id.text, customer_id.text, product_id.text, agent_id.text, policy_number.text, start_date.d... |
[
{
"role": "user",
"content": "For each medication, show the total number of prescriptions where at least one refill was allowed."
},
{
"role": "assistant",
"content": "SELECT medication_id, COUNT(*) AS prescription_count FROM healthcare.prescriptions WHERE refills_allowed > 0 GROUP BY medication... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, gender text, ad... |
[
{
"role": "user",
"content": "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": "List all coin types and symbols from the sui_coins_metadata table."
},
{
"role": "assistant",
"content": "SELECT coin_type, symbol FROM sui_coins_metadata;"
},
{
"role": "user",
"content": "Only show coins with status 'exists'."
},
{
"role": "ass... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE nft_holders ( block_number.bigint, contract_address.text, wallet_address.text, token_id.text, contract_type.text, amoun... |
[
{
"role": "user",
"content": "List all premium payments made by Bank Transfer where the amount_paid is greater than 5000. Show payment_id, policy_id, customer_id, amount_paid, and payment_date, ordered by amount_paid descending."
},
{
"role": "assistant",
"content": "SELECT payment_id,\n 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 insurance.policies (
policy_id character varying(64) NOT NULL, -- unique identifier for the policy
customer_id ... |
[
{
"role": "user",
"content": "Show the latest version number of each document_name for every case."
},
{
"role": "assistant",
"content": "SELECT case_id,\n document_name,\n MAX(version) AS latest_version\nFROM legal_services.documents\nGROUP BY case_id, document_name;"
},
{
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... |
[
{
"role": "user",
"content": "List the contract ID, address, and deployer address for all contracts deployed on the 'mainnet' network."
},
{
"role": "assistant",
"content": "SELECT contract_id, address, deployer_address FROM web3.contracts WHERE network_id = 'mainnet';"
}
] | You are an SQL statement expert. Given the table 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": "What is the total number of likes recorded in the system?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.likes;"
}
] | You are an SQL statement expert. Given the table 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.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, created_at.timestamp )
|
[
{
"role": "user",
"content": "Show me the post ID, content, and creation time for all posts made by user 'user789'."
},
{
"role": "assistant",
"content": "SELECT post_id, content, created_at FROM social_media.posts WHERE user_id = 'user789';"
},
{
"role": "user",
"content": "Modify 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 social_media.posts ( post_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi... |
[
{
"role": "user",
"content": "Show the count of services available for each category."
},
{
"role": "assistant",
"content": "SELECT category, COUNT(service_id) AS service_count FROM government_services.services GROUP BY category;"
},
{
"role": "user",
"content": "Only include categor... | You are an SQL statement expert. Given the table 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 how many achievements each player has unlocked."
},
{
"role": "assistant",
"content": "SELECT player_id,\n COUNT(*) AS total_unlocked\nFROM gaming_technology.player_achievements\nGROUP BY player_id;"
},
{
"role": "user",
"content": "Now onl... | You are an SQL statement expert. Given the table 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": "What is the average investment value for projects that completed Series A funding rounds?"
},
{
"role": "assistant",
"content": "SELECT AVG(investment_value) AS average_investment 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 character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "Find all pairs of products that share the same product_type but have differing active statuses, listing both their product_ids, product_types, and is_active flags."
},
{
"role": "assistant",
"content": "SELECT p1.product_id AS product_id_1,\n p1.product_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 insurance.insurance_products ( product_id text PRIMARY KEY, product_name text, product_type text, description text, bas... |
[
{
"role": "user",
"content": "List the document ID, file name, and size for all documents uploaded in the last 30 days by user 'agent_smith' that are larger than 5 megabytes, ordered by upload time descending."
},
{
"role": "assistant",
"content": "SELECT document_id, file_name, file_size_bytes ... | You are an SQL statement expert. Given the table 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": "Can you list all assets along with their names and types, but only show assets whose symbol contains the letter 'A'?"
},
{
"role": "assistant",
"content": "SELECT asset_id, name, symbol, type FROM trading_platform.assets WHERE symbol LIKE '%A%';"
},
{
"role"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.assets ( asset_id text PRIMARY KEY, name text, symbol text, type text )
|
[
{
"role": "user",
"content": "Find all review comments that have a staff response, showing the comment and the staff response date."
},
{
"role": "assistant",
"content": "SELECT comment, response_date FROM reviews WHERE response_date IS NOT NULL;"
},
{
"role": "user",
"content": "Now... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.reviews ( review_id text PRIMARY KEY, property_id text, reservation_id text, guest_id text, rati... |
[
{
"role": "user",
"content": "Can you show me the document types submitted by citizens whose accounts are verified, and for each, the email of the citizen who uploaded it?"
},
{
"role": "assistant",
"content": "SELECT d.document_type, c.contact_email\nFROM government_services.documents d\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 government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth... |
[
{
"role": "user",
"content": "Find patients who currently have both a primary and a secondary insurance policy. For each, show patient_id, full name, primary policy_number, and secondary policy_number."
},
{
"role": "assistant",
"content": "SELECT p.patient_id,\n p.first_name || ' ' || p.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 healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "List all users and the total quantity of orders they have placed for 'buy' orders."
},
{
"role": "assistant",
"content": "SELECT t1.username, SUM(t2.quantity) FROM trading_platform.users AS t1 JOIN trading_platform.orders AS t2 ON t1.user_id = t2.user_id WHERE t2.or... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE trading_platform.users ( user_id.text, username.text, email.text, password_hash.text... |
[
{
"role": "user",
"content": "How many games are available on each platform?"
},
{
"role": "assistant",
"content": "SELECT platform,\n COUNT(*) AS game_count\nFROM gaming_technology.games\nGROUP BY platform;"
},
{
"role": "user",
"content": "Only include platforms that have mor... | You are an SQL statement expert. Given the table 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": "For each review, show me the review comment and the associated service names that the guest has ordered during the same reservation."
},
{
"role": "assistant",
"content": "SELECT r.review_id, r.comment, s.service_name \nFROM hospitality_technology.reviews r\nJOIN 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.reservations ( reservation_id.text, property_id.text, guest_id.text, room_id.text, room_type_id.... |
[
{
"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 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": "Find posts that have been liked by users the author of the post is following. List the post_id and the user_id of the post author."
},
{
"role": "assistant",
"content": "SELECT p.post_id, p.user_id AS post_author_user_id FROM social_media.posts AS p JOIN social_medi... | You are an SQL statement expert. Given the table 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, user_id character varying(64) NOT NULL, content text, medi... |
[
{
"role": "user",
"content": "Show me all room types with their property IDs and amenities where the description includes 'ocean view'."
},
{
"role": "assistant",
"content": "SELECT room_type_id, property_id, amenities FROM hospitality_technology.room_types WHERE description LIKE '%ocean view%';... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, property_id character varying(64) NOT ... |
[
{
"role": "user",
"content": "List all claim documents of type 'POLICE_REPORT' uploaded in June 2024. Show document_id, claim_id, and file_name."
},
{
"role": "assistant",
"content": "SELECT document_id, claim_id, file_name\nFROM insurance.claim_documents\nWHERE document_type = 'POLICE_REPORT'\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d... |
[
{
"role": "user",
"content": "Provide a list of all unique genders present in the citizens table."
},
{
"role": "assistant",
"content": "SELECT DISTINCT gender FROM government_services.citizens;"
},
{
"role": "user",
"content": "How many citizens belong to each 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 government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "List all staff members, the property name they work for, and the number of services offered at their property."
},
{
"role": "assistant",
"content": "SELECT s.staff_id, s.first_name, s.last_name, p.property_name, COUNT(sv.service_id) AS service_count\nFROM hospitali... | You are an SQL statement expert. Given the table 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": "Can you fetch all claims reported in the past 30 days, including claim_id, incident_date, reported_date, and estimated_loss?"
},
{
"role": "assistant",
"content": "SELECT claim_id, incident_date, reported_date, estimated_loss\nFROM insurance.claims\nWHERE reported_d... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara... |
[
{
"role": "user",
"content": "List each username with how many users they follow and how many users follow them."
},
{
"role": "assistant",
"content": "SELECT u.username,\n COALESCE(following.following_count, 0) AS following_count,\n COALESCE(followers.followers_count, 0) AS follower... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "Show the total fare collected from bookings, grouped by the state/province of the destination location of the trip, for bookings made in May 2024."
},
{
"role": "assistant",
"content": "SELECT\n l.state_province,\n SUM(b.fare) AS total_fare_collected\nFROM transpo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "Find all users who have wallets but have never logged any actions, along with their wallet creation date."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, w.created_at AS wallet_created_at FROM trading_platform.users u JOIN trading_platform.wallets ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "Show all achievements for games developed in Germany, including achievement names and their point values."
},
{
"role": "assistant",
"content": "SELECT a.name AS achievement_name, a.points\nFROM gaming_technology.achievements a\nJOIN gaming_technology.games g ON a.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.players ( player_id uuid, username text, email text, password_hash text, registration_date timestamp ... |
[
{
"role": "user",
"content": "How many conversations are group chats?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.conversations WHERE is_group_chat = TRUE;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "What is the total USD value of tokens held by Binance exchange on the Ethereum chain according to the cex_token_balance table?"
},
{
"role": "assistant",
"content": "SELECT SUM(usd_value) AS total_usd_value FROM cex_token_balance WHERE exchange = 'Binance' AND chain... | You are an SQL statement expert. Given the table 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 text, token_name text, token_symbol text, chain text, price numeric, price_change_per... |
[
{
"role": "user",
"content": "Show me a list of appointments, including their subject and start time, along with the case number for the related case."
},
{
"role": "assistant",
"content": "SELECT T1.subject, T1.start_time, T2.case_number FROM appointments AS T1 JOIN cases AS T2 ON T1.case_id = ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Show the wallet ID, user's username, and the creator address for all wallets whose address was used to deploy a smart contract."
},
{
"role": "assistant",
"content": "SELECT w.wallet_id, u.username, sc.creator_address\nFROM blockchain.wallets w\nJOIN blockchain.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 blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text... |
[
{
"role": "user",
"content": "Show me all items of rarity 'Epic', displaying the item's name and type, along with the title of the game it is part of."
},
{
"role": "assistant",
"content": "SELECT igi.item_name, igi.item_type, g.title FROM gaming_technology.in_game_items igi JOIN gaming_technolo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_inventory (
inventory_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for... |
[
{
"role": "user",
"content": "List the first name and last name of the driver and the license plate of the vehicle used for each trip."
},
{
"role": "assistant",
"content": "SELECT T1.first_name , T1.last_name , T3.license_plate FROM transportation.drivers AS T1 JOIN transportation.trips AS T2 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 transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"role": "user",
"content": "How many services are defined for each service category?"
},
{
"role": "assistant",
"content": "SELECT category, COUNT(*) AS service_count FROM government_services.services GROUP BY category;"
},
{
"role": "user",
"content": "Only show categories that ha... | You are an SQL statement expert. Given the table 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 a summary of customers with their total account balance and the count of accounts."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, COUNT(a.account_id) AS account_count, SUM(a.balance) AS total_account_balance FROM financial_services.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"role": "user",
"content": "Which smart money address on the 'Ethereum' chain has the highest profit from tokens in the 'DeFi' narrative, and what is their ROI?"
},
{
"role": "assistant",
"content": "SELECT sm.address, sm.profit, sm.roi\nFROM smart_money_profit sm\nJOIN smart_money_token_inflo... | You are an SQL statement expert. Given the table 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, -- the id of narrative",
"top_3_coins text, --... |
[
{
"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": "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 the number of employees in each department."
},
{
"role": "assistant",
"content": "SELECT department, COUNT(*) AS employee_count\nFROM financial_services.employees\ngroup BY department;"
},
{
"role": "user",
"content": "Exclude departments that have... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba... |
[
{
"role": "user",
"content": "Show me the usernames of users who have commented on posts that were created in group chat conversations, along with the names of those group chats."
},
{
"role": "assistant",
"content": "SELECT u.username, c.group_name\nFROM social_media.comments cm\nJOIN social_me... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "Show me the total transaction amount sent by each user (based on user_id) in the last 30 days, along with their username."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, SUM(t.amount) AS total_amount FROM blockchain.users u JOIN blockchain.walle... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic... |
[
{
"role": "user",
"content": "Show all users who follow both user 'U100' and user 'U101'."
},
{
"role": "assistant",
"content": "SELECT f1.follower_user_id\nFROM social_media.follows f1\nJOIN social_media.follows f2 ON f1.follower_user_id = f2.follower_user_id\nWHERE f1.following_user_id = 'U100... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 8