conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "Show me the total price and quantity for each service order, along with the guest's full name."
},
{
"role": "assistant",
"content": "SELECT t1.order_id, t1.total_price, t1.quantity, t2.first_name, t2.last_name FROM hospitality_technology.service_orders AS t1 JOIN h... | You are an SQL statement expert. Given the table 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": "Provide a count of servers per game status."
},
{
"role": "assistant",
"content": "SELECT status, COUNT(*) AS server_count FROM gaming_technology.servers GROUP BY status;"
},
{
"role": "user",
"content": "Filter the list to only show statuses that have 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 gaming_technology.game_sessions ( session_id.uuid, player_id.uuid, game_id.uuid, server_id.uuid, start_time.timestamptz... |
[
{
"role": "user",
"content": "Count how many medications each manufacturer provides."
},
{
"role": "assistant",
"content": "SELECT manufacturer, COUNT(*) FROM healthcare.medications GROUP BY manufacturer;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,... |
[
{
"role": "user",
"content": "List all item names and their rarity, along with the title of the game they belong to."
},
{
"role": "assistant",
"content": "SELECT T1.item_name, T1.rarity, T2.title FROM in_game_items AS T1 JOIN games AS T2 ON T1.game_id = T2.game_id;"
},
{
"role": "user",... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "Which service categories have an average processing time greater than 7 days? Please show the category and the average processing time."
},
{
"role": "assistant",
"content": "SELECT category, AVG(average_processing_time_days) AS avg_processing_time FROM government_s... | You are an SQL statement expert. Given the table 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": "What is the average balance of all addresses in the database?"
},
{
"role": "assistant",
"content": "SELECT AVG(balance) AS average_balance FROM blockchain.addresses;"
},
{
"role": "user",
"content": "Can you break this down by the first 3 characters of ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.addresses ( address_id text PRIMARY KEY, public_key text, balance numeric )
|
[
{
"role": "user",
"content": "Find all medical records where the vitals JSON field contains a blood pressure reading higher than 140/90, and show the patient_id, record_date, and vitals."
},
{
"role": "assistant",
"content": "SELECT patient_id, record_date, vitals FROM healthcare.medical_records... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medical_records ( record_id.text, patient_id.text, appointment_id.text, doctor_id.text, record_date.timestam... |
[
{
"role": "user",
"content": "List all achievements with points greater than 100, showing achievement_id, name, and points."
},
{
"role": "assistant",
"content": "SELECT achievement_id, name, points\nFROM gaming_technology.achievements\nWHERE points > 100;"
},
{
"role": "user",
"cont... | You are an SQL statement expert. Given the table 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 agents who have sold at least one policy for an insurance product of type 'Health'. For each agent, show their full name, agency name, and the product name."
},
{
"role": "assistant",
"content": "SELECT DISTINCT a.first_name || ' ' || a.last_name AS agent_f... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ... |
[
{
"role": "user",
"content": "List NFT collections deployed after block number 10000000 with more than 500 tokens, showing contract_address, name, and token_count."
},
{
"role": "assistant",
"content": "SELECT contract_address, name, token_count\nFROM nft_collections\nWHERE deploy_block_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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "List all ERC20 tokens from the metadata table. Show their symbol, name, contract address, and total supply."
},
{
"role": "assistant",
"content": "SELECT symbol, name, contract_address, total_supply FROM token_metas WHERE is_erc20 = 1"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ... |
[
{
"role": "user",
"content": "Which ERC1155 NFT contracts have received approval-for-all events? Show contract_address and approval count."
},
{
"role": "assistant",
"content": "SELECT contract_address, COUNT(*) AS approval_count FROM erc1155_approval_for_all GROUP BY contract_address;"
},
{... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "List all posts that have received at least one like and at least one comment, showing the post_id and the total number of likes and comments each has."
},
{
"role": "assistant",
"content": "SELECT p.post_id, COUNT(DISTINCT l.like_id) AS like_count, COUNT(DISTINCT c.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "Show me the user ID, wallet address, and transaction ID for the first 20 transactions sent from any user's wallet."
},
{
"role": "assistant",
"content": "SELECT W.user_id, W.address, T.transaction_id FROM web3.wallets W JOIN web3.transactions T ON W.address = T.from... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE web3.transactions ( transaction_id text PRIMARY KEY, from_address text, to_address t... |
[
{
"role": "user",
"content": "Show the content of comments and the content of the posts they belong to, for comments made by users whose location is 'New York'. Also include the username of the commenter."
},
{
"role": "assistant",
"content": "SELECT c.content AS comment_content, p.content AS po... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "List each patient's first and last name along with their total number of appointments in 2024."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, COUNT(a.appointment_id) AS appointment_count\nFROM healthcare.patients p\nLEFT JOIN healthcare.app... | You are an SQL statement expert. Given the table 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": "Can you show the driver first name, last name, and the make and model of the vehicle for each trip, along with the scheduled departure time?"
},
{
"role": "assistant",
"content": "SELECT d.first_name, d.last_name, v.make, v.model, t.scheduled_departure\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 character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "I need to get the count of appointments grouped by their status."
},
{
"role": "assistant",
"content": "SELECT a.status, \n COUNT(*) AS appointment_count\nFROM legal_services.appointments a\nGROUP BY a.status;"
},
{
"role": "user",
"content": "Only... | You are an SQL statement expert. Given the table 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 payments, showing the payment amount, currency, and the guest's full name who made the payment."
},
{
"role": "assistant",
"content": "SELECT p.payment_id, p.amount, p.currency_code, g.first_name, g.last_name FROM hospitality_technology.payments AS p JOIN h... | You are an SQL statement expert. Given the table 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": "For each booking, show the booking ID, passenger's full name, booking status, and the email of the passenger."
},
{
"role": "assistant",
"content": "SELECT b.booking_id, p.first_name, p.last_name, b.status, p.email\nFROM transportation.bookings b\nJOIN transportatio... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f... |
[
{
"role": "user",
"content": "List the 10 most recent achievement unlocks across all players. Show player ID, achievement ID, and unlock timestamp."
},
{
"role": "assistant",
"content": "SELECT player_id, achievement_id, unlocked_at FROM gaming_technology.player_achievements ORDER BY unlocked_at... | You are an SQL statement expert. Given the table 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": "List each achievement name, the number of players who unlocked it, and the latest unlock time."
},
{
"role": "assistant",
"content": "SELECT a.name,\n COUNT(pa.player_id) AS unlock_count,\n MAX(pa.unlocked_at) AS latest_unlocked_at\nFROM gaming_techn... | You are an SQL statement expert. Given the table 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": "Find all addresses with a balance greater than 1000, ordered by balance in descending order."
},
{
"role": "assistant",
"content": "SELECT address_id, public_key, balance FROM blockchain.addresses WHERE balance > 1000 ORDER BY balance DESC;"
},
{
"role": "us... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.addresses ( address_id text PRIMARY KEY, public_key text, balance numeric )
|
[
{
"role": "user",
"content": "Which achievement has the highest point value for each game?"
},
{
"role": "assistant",
"content": "SELECT a1.game_id, a1.achievement_id, a1.name, a1.points FROM gaming_technology.achievements a1 WHERE a1.points = (SELECT MAX(a2.points) FROM gaming_technology.achiev... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.servers ( server_id uuid PRIMARY KEY, game_id uuid, server_name text, region text, ip_address text, p... |
[
{
"role": "user",
"content": "Show me all tokens with their contract addresses and total supply, but only include tokens where the decimals are greater than 6, sorted by total supply in descending order."
},
{
"role": "assistant",
"content": "SELECT token_name, contract_address, total_supply 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 web3.tokens ( token_id.text, contract_address.text, token_name.text, token_symbol.text, decimals.integer, total_supply.... |
[
{
"role": "user",
"content": "Show me the top 5 tokens by USD value held on the Binance Smart Chain, along with their average price and total balance."
},
{
"role": "assistant",
"content": "SELECT token_symbol, AVG(price) AS average_price, SUM(balance) AS total_balance, SUM(usd_value) AS total_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 cex_token_balance ( snapshot_time text, chain text, address text, exchange text, token_address text, token_symbol text,... |
[
{
"role": "user",
"content": "For each post, show the number of different users who have commented on it, along with the post_id."
},
{
"role": "assistant",
"content": "SELECT post_id, COUNT(DISTINCT user_id) AS unique_commenters\nFROM social_media.comments\nGROUP BY post_id;"
},
{
"role... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "Show me tokens that have recorded smart money inflows. For these tokens, list the token symbol, the current price from the basic info table, and the total sum of USD values from all smart money inflows recorded for that token."
},
{
"role": "assistant",
"content": "... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_basic_info ( coin_id.text, token_name.text, token_symbol.text, token_address.t... |
[
{
"role": "user",
"content": "Which hashtags were created after May 15, 2024? Show their hashtag IDs and tag names."
},
{
"role": "assistant",
"content": "SELECT hashtag_id, tag_name FROM social_media.hashtags WHERE created_at > '2024-05-15';"
},
{
"role": "user",
"content": "Now, on... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.hashtags (
hashtag_id character varying(64) NOT NULL, -- unique identifier for the hashtag
tag_nam... |
[
{
"role": "user",
"content": "List the message subjects for all notifications sent via the 'Push' channel that have a 'Sent' status."
},
{
"role": "assistant",
"content": "SELECT message_subject FROM government_services.notifications WHERE channel = 'Push' AND status = 'Sent';"
}
] | You are an SQL statement expert. Given the table 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... |
[
{
"role": "user",
"content": "List all drivers whose licenses are set to expire within the next 60 days, along with their full name, license number, and contact number."
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name, license_number, contact_number\nFROM transporta... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... |
[
{
"role": "user",
"content": "List the ERC20 tokens (from token_metas) with exactly 6 decimals. Show their symbol, contract_address, and name."
},
{
"role": "assistant",
"content": "SELECT symbol, contract_address, name FROM token_metas WHERE is_erc20 = 1 AND decimals = 6;"
},
{
"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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
[
{
"role": "user",
"content": "List all likes made by user 'U100' on posts, including the like_id and the post_id."
},
{
"role": "assistant",
"content": "SELECT like_id, post_id FROM social_media.likes WHERE user_id = 'U100' AND post_id IS NOT NULL;"
},
{
"role": "user",
"content": "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.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, created_at.timestamp )
|
[
{
"role": "user",
"content": "For each service category, count the number of appointments scheduled in the next 7 days. Return the category and appointment count."
},
{
"role": "assistant",
"content": "SELECT s.category, COUNT(a.appointment_id) AS upcoming_appointments\nFROM government_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 government_services.services ( service_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "List all posts that contain the word 'festival' in their content, showing the post_id, the author's username, and the post creation time."
},
{
"role": "assistant",
"content": "SELECT p.post_id, u.username, p.created_at\nFROM social_media.posts p\nJOIN 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": "List all insurance plans with their plan ID, plan name, and the total number of prescriptions made for each plan (via any patient's insurance policy for that plan)."
},
{
"role": "assistant",
"content": "SELECT ip.plan_id, ip.plan_name, COUNT(pres.prescription_id) 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 healthcare.appointments ( appointment_id text PRIMARY KEY, patient_id text, doctor_id text, appointment_time timestamp,... |
[
{
"role": "user",
"content": "For each user with 'approved' KYC status, show their user ID and the total amount in their unspent UTXOs."
},
{
"role": "assistant",
"content": "SELECT T1.user_id, SUM(T2.amount) FROM trading_platform.kyc_audit AS T1 JOIN trading_platform.utxos AS T2 ON T1.user_id =... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.utxos ( utxo_id text, transaction_id text, output_index integer, address text, amount numeric, spent b... |
[
{
"role": "user",
"content": "Show me the record_id, patient_id, prescription_id, medication_id, start_date, and the systolic blood pressure from the associated medical record for all prescriptions."
},
{
"role": "assistant",
"content": "SELECT p.prescription_id,\n p.medication_id,\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 healthcare.medical_records ( record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, appoi... |
[
{
"role": "user",
"content": "For each player, list the total number of 'Legendary' rarity items they have in their inventory, along with the titles of the respective games those items belong to."
},
{
"role": "assistant",
"content": "SELECT pi.player_id, g.game_id, g.title, COUNT(*) AS legendar... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time... |
[
{
"role": "user",
"content": "Show me the earliest unlock date for each achievement along with the player_id who unlocked it."
},
{
"role": "assistant",
"content": "SELECT achievement_id, player_id, MIN(unlocked_at) AS earliest_unlock FROM gaming_technology.player_achievements GROUP BY achieveme... | You are an SQL statement expert. Given the table 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": "List each comment_id and the number of likes it has received, but only include comments with at least 5 likes, ordered by like_count ascending."
},
{
"role": "assistant",
"content": "SELECT l.comment_id, COUNT(*) AS like_count\nFROM social_media.likes l\nWHERE l.com... | You are an SQL statement expert. Given the table 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, ... |
[
{
"role": "user",
"content": "What is the average commission rate for active agents?"
},
{
"role": "assistant",
"content": "SELECT AVG(commission_rate) FROM insurance.agents WHERE status = 'Active';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "List all service appointments showing the appointment ID, the name of the service, and the city where the appointment is scheduled."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, s.service_name, l.city\nFROM government_services.appointments a\nJOIN ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "How many beneficiaries are there for each relationship type in the policy_beneficiaries table?"
},
{
"role": "assistant",
"content": "SELECT relationship, COUNT(*) AS beneficiary_count\nFROM insurance.policy_beneficiaries\nGROUP BY relationship;"
}
] | You are an SQL statement expert. Given the table 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.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text... |
[
{
"role": "user",
"content": "Retrieve each vehicle's most recent maintenance service date and next_service_due_date along with the date of its most recent trip actual_arrival. Include vehicle_id, service_date, next_service_due_date, and most_recent_arrival."
},
{
"role": "assistant",
"content":... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.routes (
route_id character varying(64) NOT NULL, -- unique identifier for the route
route_numb... |
[
{
"role": "user",
"content": "Show each contract address and the count of successful transactions sent to that contract."
},
{
"role": "assistant",
"content": "SELECT c.address, COUNT(t.transaction_id) AS success_tx_count FROM web3.contracts c JOIN web3.transactions t ON t.to_address = c.address... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts (
contract_id character varying(64) NOT NULL, -- unique identifier for the contract
address cha... |
[
{
"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 a list of all wallet addresses along with the user_id who owns them, sorted by the wallet creation time."
},
{
"role": "assistant",
"content": "SELECT user_id, address FROM web3.wallets ORDER BY created_at;"
}
] | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the wallet
user_id character... |
[
{
"role": "user",
"content": "Show all room types available at properties located in 'US', including the property name, room type name, base rate, and maximum occupancy."
},
{
"role": "assistant",
"content": "SELECT p.property_name, rt.type_name, rt.base_rate, rt.max_occupancy FROM hospitality_t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "List the full names of citizens who have uploaded documents with a verification status of 'Pending' and the type of document they uploaded."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T2.document_type FROM government_services.citizens ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents ( document_id text, application_id text, citizen_id text, document_type text, file_refere... |
[
{
"role": "user",
"content": "For each property, list the property name and the count of payments processed."
},
{
"role": "assistant",
"content": "SELECT\n prop.property_name,\n COUNT(p.payment_id) AS payment_count\nFROM hospitality_technology.properties AS prop\nJOIN hospitality_technology.r... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "Find the top 3 achievements with the highest points. Return achievement_id, name, and points."
},
{
"role": "assistant",
"content": "SELECT achievement_id,\n name,\n points\nFROM gaming_technology.achievements\nORDER BY points DESC\nLIMIT 3;"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "Show me all diagnoses that correspond to a medication based on matching the diagnosis_code with the medication's NDC code, and include diagnosis_id, patient_id, diagnosis_date, medication_name, and status."
},
{
"role": "assistant",
"content": "SELECT d.diagnosis_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 healthcare.diagnoses ( diagnosis_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, patient_i... |
[
{
"role": "user",
"content": "How many premium payments were made using 'Credit Card' as the payment method?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS credit_card_payments\nFROM insurance.premium_payments\nWHERE payment_method = 'Credit Card';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "List all narratives with a negative 1-hour price change percentage and a trend rank below 50."
},
{
"role": "assistant",
"content": "SELECT narrative, price_change_percentage_1h, trend_rank FROM narrative_info WHERE price_change_percentage_1h < 0 AND trend_rank < 50... | You are an SQL statement expert. Given the table 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": "Show me all users who have wallets but have never placed any orders, along with their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, u.email, w.address FROM trading_platform.users u JOIN trading_platform.wallets w ON u.user_id... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac... |
[
{
"role": "user",
"content": "List each recipient_user_id and the count of unread notifications they have, but only include users with public profiles."
},
{
"role": "assistant",
"content": "SELECT n.recipient_user_id, COUNT(*) AS unread_count\nFROM social_media.notifications n\nJOIN 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.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u... |
[
{
"role": "user",
"content": "List the file name and document type for all documents uploaded by the user with ID 'agent456'."
},
{
"role": "assistant",
"content": "SELECT file_name, document_type FROM insurance.claim_documents WHERE uploaded_by = 'agent456';"
},
{
"role": "user",
"c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claim_documents ( document_id character varying(64) NOT NULL, claim_id character varying(64) NOT NULL, docume... |
[
{
"role": "user",
"content": "List all premium payments along with the payment date, amount, and the status of the related policy."
},
{
"role": "assistant",
"content": "SELECT pp.payment_id, pp.payment_date, pp.amount_paid, p.status AS policy_status\nFROM insurance.premium_payments pp\nJOIN ins... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "List usernames and the length of their 'bio' field for users whose 'is_verified' status is true."
},
{
"role": "assistant",
"content": "SELECT username, LENGTH(bio) AS bio_length FROM social_media.users WHERE is_verified IS 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.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "List all token transfers between two distinct addresses, showing transfer_id, from_address, to_address, value, and transaction_id."
},
{
"role": "assistant",
"content": "SELECT transfer_id, from_address, to_address, value, transaction_id\nFROM web3.token_transfers\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 web3.token_transfers (
transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer
token... |
[
{
"role": "user",
"content": "List reservations made by guests who have communication consent enabled, showing the reservation ID, guest full name, and property name."
},
{
"role": "assistant",
"content": "SELECT T1.reservation_id, T2.first_name, T2.last_name, T3.property_name FROM hospitality_t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.reservations ( reservation_id text, property_id text, guest_id text, room_id text, room_type_id ... |
[
{
"role": "user",
"content": "Show me the average difficulty for blocks that have a previous block versus those that don't have a previous block."
},
{
"role": "assistant",
"content": "SELECT CASE WHEN previous_block_id IS NULL THEN 'No Previous Block' ELSE 'Has Previous Block' END AS block_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 blockchain.blocks ( block_id text PRIMARY KEY, previous_block_id text, timestamp timestamp, nonce int, merkle_root text... |
[
{
"role": "user",
"content": "Which staff members are managing properties, and what are the names and email addresses of those properties?"
},
{
"role": "assistant",
"content": "SELECT s.staff_id, s.first_name, s.last_name, p.property_name, p.email_address FROM hospitality_technology.staff s INN... | You are an SQL statement expert. Given the table 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": "For each ERC20 token, show the contract address, symbol, and the total number of unique wallet holders based on the current erc20_balances table."
},
{
"role": "assistant",
"content": "SELECT e.contract_address, t.symbol, COUNT(DISTINCT e.wallet_address) AS holder_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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "List the full names of citizens who have made payments for services that are currently inactive. Also show the service name and payment amount."
},
{
"role": "assistant",
"content": "SELECT c.first_name || ' ' || c.last_name AS full_name, s.service_name, p.amount\nF... | You are an SQL statement expert. Given the table 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": "What is the average profit for smart money addresses on the 'Arbitrum' chain?"
},
{
"role": "assistant",
"content": "SELECT AVG(profit) FROM smart_money_profit WHERE chain = 'Arbitrum'"
},
{
"role": "user",
"content": "And how many smart money addresses ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE smart_money_profit ( address text, rank numeric, profit numeric, roi numeric, realized_ratio numeric, most_profit_token... |
[
{
"role": "user",
"content": "Show me all claims filed in the last 6 months with their associated policy details and customer information."
},
{
"role": "assistant",
"content": "SELECT cl.claim_id, cl.incident_date, cl.status, cl.settlement_amount, p.policy_number, p.product_id, p.coverage_limit... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers (
customer_id character varying(64) NOT NULL, -- unique identifier for the customer
first_... |
[
{
"role": "user",
"content": "Show me all servers and the total number of achievements available in the game they host. Include the server name and region."
},
{
"role": "assistant",
"content": "SELECT s.server_name, s.region, COUNT(a.achievement_id) AS total_achievements\nFROM gaming_technology... | You are an SQL statement expert. Given the table 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": "I want to find all appointments from the past year for patients diagnosed with 'diabetes', including appointment time, patient full name, and doctor full name."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, a.appointment_time, CONCAT(p.first_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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "List the make and model of vehicles that have completed a trip, along with the trip ID."
},
{
"role": "assistant",
"content": "SELECT T1.make, T1.model, T2.trip_id FROM transportation.vehicles AS T1 JOIN transportation.trips AS T2 ON T1.vehicle_id = T2.vehicle_id WH... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "List all appointments handled by lawyers from law firms founded after 2015, showing the appointment subject and the lawyer's firm name."
},
{
"role": "assistant",
"content": "SELECT a.subject, f.firm_name\nFROM legal_services.appointments a\nJOIN legal_services.lawy... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers (
lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer
first_n... |
[
{
"role": "user",
"content": "Which active insurance products contain the word 'comprehensive' or 'premium' in their description? List their product IDs, product names, types, and base premiums."
},
{
"role": "assistant",
"content": "SELECT product_id, product_name, product_type, base_premium\nF... | You are an SQL statement expert. Given the table 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": "I want to find all claim IDs that have both an 'Accident Report' and a 'Police Report' document."
},
{
"role": "assistant",
"content": "SELECT DISTINCT a.claim_id\nFROM insurance.claim_documents a\nJOIN insurance.claim_documents b\n ON a.claim_id = b.claim_id\nWHER... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claim_documents ( document_id text, claim_id text, document_type text, file_name text, file_path text, file_s... |
[
{
"role": "user",
"content": "Which tokens have a current price above $20 and belong to the 'DeFi' narrative?"
},
{
"role": "assistant",
"content": "SELECT token_symbol, token_name, chain, price\nFROM token_basic_info\nWHERE price > 20 AND narrative = 'DeFi';"
},
{
"role": "user",
"c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(... |
[
{
"role": "user",
"content": "Show me the top 5 guests who have submitted the most reviews. Include guest_id and review_count."
},
{
"role": "assistant",
"content": "SELECT guest_id, COUNT(*) AS review_count\nFROM hospitality_technology.reviews\nGROUP BY guest_id\nORDER BY review_count DESC\nLIM... | You are an SQL statement expert. Given the table 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": "Show me all players who have acquired items from games that have running servers in the 'ap-northeast-1' region, and the item names they acquired."
},
{
"role": "assistant",
"content": "SELECT DISTINCT pi.player_id, igi.item_name \nFROM gaming_technology.player_inve... | You are an SQL statement expert. Given the table 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": "Which employees have been assigned to applications for services with a standard fee greater than 200? Show the employee's full name, job title, application ID, and the service name."
},
{
"role": "assistant",
"content": "SELECT e.first_name || ' ' || e.last_name 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 character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "List appointment IDs, patient first and last names, and their chief complaint for appointments that have an associated medical record."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, p.first_name, p.last_name, mr.chief_complaint\nFROM healthcare.appo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Show all pairs of players who share the same email domain. Return player1, player2, and the domain."
},
{
"role": "assistant",
"content": "SELECT p1.username AS player1,\n p2.username AS player2,\n SPLIT_PART(p1.email, '@', 2) AS domain\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.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"role": "user",
"content": "For each case, show its name, case number, the total hours worked by all lawyers, and the name of the client associated with the case."
},
{
"role": "assistant",
"content": "SELECT c.case_name, c.case_number, SUM(te.hours_spent) AS total_hours, cl.first_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.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Show me the top 5 users who have interacted with DApps, along with the count of distinct DApps they interacted with and their wallet addresses."
},
{
"role": "assistant",
"content": "SELECT w.user_id, COUNT(DISTINCT d.dapp_id) AS dapp_count, w.address FROM trading_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 trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
CREATE ... |
[
{
"role": "user",
"content": "Which fundraising project in 2022 had the highest valuation, and which token (by symbol) from smart_money_token_performance matches the project name? Please display project_name, valuation, rounds_name, and the matched token_symbol."
},
{
"role": "assistant",
"conte... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id character varying(32) NOT NULL, project_id character varying(32) NOT NULL, project_name... |
[
{
"role": "user",
"content": "Which document_name has the highest number of versions? Return the document_name and the number of versions."
},
{
"role": "assistant",
"content": "SELECT document_name,\n COUNT(*) AS version_count\nFROM legal_services.documents\nGROUP BY document_name\nORDER ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... |
[
{
"role": "user",
"content": "Show me the top 5 wallet addresses with the highest total ERC20 token balances, including their wallet addresses and total amounts."
},
{
"role": "assistant",
"content": "SELECT wallet_address, SUM(CAST(amount AS decimal)) AS total_balance FROM erc20_balances GROUP ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc20_balances ( block_number.bigint, contract_address.text, wallet_address.text, amount.text, pk.text )
CREATE TABLE e... |
[
{
"role": "user",
"content": "How many games are there per platform, and what is the earliest release_date for each platform?"
},
{
"role": "assistant",
"content": "SELECT platform,\n COUNT(*) AS game_count,\n MIN(release_date) AS earliest_release\nFROM gaming_technology.games\nGROUP... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date... |
[
{
"role": "user",
"content": "List all prescriptions where the dosage text contains the word 'unit'. Show the prescription ID, medication ID, and dosage."
},
{
"role": "assistant",
"content": "SELECT prescription_id, medication_id, dosage FROM healthcare.prescriptions WHERE dosage LIKE '%unit%';... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses ( diagnosis_id text PRIMARY KEY, record_id text, patient_id text, doctor_id text, diagnosis_code t... |
[
{
"role": "user",
"content": "Can you give me the number of available services and their average price for each department?"
},
{
"role": "assistant",
"content": "SELECT department, COUNT(*) AS available_services_count, AVG(price) AS average_price\nFROM hospitality_technology.services\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 hospitality_technology.services ( service_id text, property_id text, service_name text, description text, category text... |
[
{
"role": "user",
"content": "List all diagnosis entries that are marked as chronic and have a status of 'Active'. Show diagnosis ID, patient ID, and description."
},
{
"role": "assistant",
"content": "SELECT diagnosis_id, patient_id, description FROM healthcare.diagnoses WHERE is_chronic = 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 healthcare.diagnoses (
diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry
... |
[
{
"role": "user",
"content": "How many drivers and passengers have email addresses ending with 'company.com'? Return the count for each group."
},
{
"role": "assistant",
"content": "SELECT 'drivers' AS role, COUNT(*) AS count\nFROM transportation.drivers\nWHERE email LIKE '%@company.com'\nUNION ... | You are an SQL statement expert. Given the table 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": "How many documents are there for each document_type? Show document_type and count ordered by the count in descending order."
},
{
"role": "assistant",
"content": "SELECT document_type,\n COUNT(*) AS 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.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "Show me all invoices where the amount paid is exactly equal to the total amount."
},
{
"role": "assistant",
"content": "SELECT * FROM legal_services.invoices WHERE amount_paid = total_amount;"
},
{
"role": "user",
"content": "Instead, show only the invoi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.invoices (
invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice
invo... |
[
{
"role": "user",
"content": "Show the number of UTXOs associated with each unique address in the system."
},
{
"role": "assistant",
"content": "SELECT address, COUNT(utxo_id) FROM trading_platform.utxos GROUP BY address;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.assets ( asset_id text PRIMARY KEY, name text, symbol text, type text )
CREATE TABLE trading_platform.... |
[
{
"role": "user",
"content": "List all pairs of lawyers who have unbilled billable time entries for the same case. Include both lawyer IDs and the case_id."
},
{
"role": "assistant",
"content": "SELECT t1.lawyer_id AS lawyer1_id,\n t2.lawyer_id AS lawyer2_id,\n t1.case_id\nFROM 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.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billi... |
[
{
"role": "user",
"content": "List all agents who have a commission rate above 0.1, showing their full names and agency names."
},
{
"role": "assistant",
"content": "SELECT agent_id, first_name || ' ' || last_name AS full_name, agency_name, commission_rate FROM insurance.agents WHERE commission_... | You are an SQL statement expert. Given the table 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 pending premium payments made in March 2024, showing payment_id, customer_id, amount_paid, and due_date, ordered by payment_date ascending."
},
{
"role": "assistant",
"content": "SELECT payment_id,\n customer_id,\n amount_paid,\n due_date\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.premium_payments ( payment_id.text, policy_id.text, customer_id.text, payment_date.timestamp, amount_paid.num... |
[
{
"role": "user",
"content": "For each order, show the username of the user who placed it, the name of the asset ordered, and the order quantity."
},
{
"role": "assistant",
"content": "SELECT o.order_id, u.username, a.name AS asset_name, o.quantity\nFROM trading_platform.orders o\nJOIN trading_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 trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "List the name, address line 1, and city for all locations located in California."
},
{
"role": "assistant",
"content": "SELECT name, address_line1, city FROM transportation.locations WHERE state_province = 'CA'"
}
] | You are an SQL statement expert. Given the table 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": "List each user and their total number of followers, including username, ordered by follower count descending."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, COUNT(f.follower_user_id) AS follower_count FROM social_media.users u LEFT JOIN social_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "Find the total number of unique document types stored in the claim_documents table."
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT document_type) FROM insurance.claim_documents;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.