conversations listlengths 2 8 | system stringlengths 282 8.03k |
|---|---|
[
{
"role": "user",
"content": "Show the total number of customers in each state."
},
{
"role": "assistant",
"content": "SELECT\n state,\n COUNT(customer_id)\nFROM insurance.customers\nGROUP BY\n state;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, address_lin... |
[
{
"role": "user",
"content": "Show me all invoice numbers and due dates where the amount paid is exactly zero."
},
{
"role": "assistant",
"content": "SELECT invoice_number, due_date FROM legal_services.invoices WHERE amount_paid = 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 legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_... |
[
{
"role": "user",
"content": "List all contracts with status 'active' and include the number of events they've emitted in the last 30 days."
},
{
"role": "assistant",
"content": "SELECT c.contract_id, c.address, COUNT(e.event_id) AS recent_event_count FROM web3.contracts c LEFT JOIN web3.events ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts (
contract_id character varying(64) NOT NULL, -- unique identifier for the contract
address cha... |
[
{
"role": "user",
"content": "Show me the first and last names of citizens along with their dates of birth and contact emails for all citizens who registered after January 1, 2023."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, date_of_birth, contact_email 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.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "For each event recorded, list its ID, name, and the status and value of the transaction in which it occurred."
},
{
"role": "assistant",
"content": "SELECT E.event_id, E.event_name, E.transaction_id, T.status, T.value FROM web3.events AS E JOIN web3.transactions 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 web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "For each player, show the player_id and the count of inventory items they acquired with a quantity greater than 1."
},
{
"role": "assistant",
"content": "SELECT player_id, COUNT(inventory_id) AS items_qty_gt_1_count FROM gaming_technology.player_inventory WHERE quan... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), username character varying(100) NOT NULL... |
[
{
"role": "user",
"content": "Show the total number of bookings grouped by payment_transaction_id."
},
{
"role": "assistant",
"content": "SELECT payment_transaction_id, COUNT(*) AS booking_count FROM transportation.bookings GROUP BY payment_transaction_id;"
},
{
"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 transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t... |
[
{
"role": "user",
"content": "Show me all insurance plans that have more than 5 patients enrolled, along with the provider name and count of patients, sorted by patient count in descending order."
},
{
"role": "assistant",
"content": "SELECT i.plan_name, i.insurance_provider, COUNT(p.patient_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.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address 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": "Show me all active electric vehicles along with their depot location details, including the depot's city and timezone."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id, v.license_plate, v.make, v.model, v.year, l.name AS depot_name, l.city, l.timezone FROM... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"role": "user",
"content": "What is the reason behind the cost variation for maintenance of asset_id 'ASSET456' over the past year?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the reasons behind cost variations for maintenance. The data in the maintenan... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.m... |
[
{
"role": "user",
"content": "Show the 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": "Find all users who registered with a Yahoo email address, along with their registration dates."
},
{
"role": "assistant",
"content": "SELECT user_id, username, email, password_hash FROM blockchain.users WHERE email LIKE '%@yahoo.com';"
},
{
"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 blockchain.blocks ( block_id text, previous_block_id text, timestamp timestamp, nonce integer, merkle_root text, diffic... |
[
{
"role": "user",
"content": "Provide the contract ID, creator address, and timestamp for all smart contracts created between January 1st, 2022, and December 31st, 2024."
},
{
"role": "assistant",
"content": "SELECT contract_id, creator_address, timestamp FROM blockchain.smart_contracts WHERE ti... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE blockchain.smart_contracts ( contract_id.text, creator_address.text, code.text, time... |
[
{
"role": "user",
"content": "What are the maintenance costs for a specific aircraft model like the Airbus A320?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to data regarding maintenance costs for specific aircraft models such as the Airbus A320. The information in ... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE manufacturing.aircraft_mod... |
[
{
"role": "user",
"content": "Show me all savings accounts (account_id, account_number, balance) with an interest rate above 2.5%, along with the security details (ticker_symbol, issuer_name) for securities in the same currency as the account."
},
{
"role": "assistant",
"content": "SELECT a.acco... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac... |
[
{
"role": "user",
"content": "Retrieve the policy_number, start_date, end_date, premium_amount, and corresponding product_name for policies with a coverage_limit greater than 500000."
},
{
"role": "assistant",
"content": "SELECT p.policy_number, p.start_date, p.end_date, p.premium_amount, ip.pro... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d... |
[
{
"role": "user",
"content": "Show me all active customers from New York who were born before 1980, along with their contact information."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, phone_number, email, address_line1, city, state, zip_code FROM insurance.customers WHERE ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "Which bed types are offered in each property and how many different room types are associated with each bed type?"
},
{
"role": "assistant",
"content": "SELECT property_id, bed_type, COUNT(DISTINCT room_type_id) AS room_type_count FROM hospitality_technology.room_ty... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text, type_name text, description text, ... |
[
{
"role": "user",
"content": "I want to know how many hashtags have been used for posts whose IDs correspond to conversation IDs. Return conversation_id and hashtag_count."
},
{
"role": "assistant",
"content": "SELECT cp.conversation_id, COUNT(ph.hashtag_id) AS hashtag_count\nFROM social_media.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.post_hashtags (
post_hashtag_id character varying(64) NOT NULL, -- unique identifier for the post-hash... |
[
{
"role": "user",
"content": "List for each fuel type the number of unique vehicle models available. Show the fuel_type and the model count."
},
{
"role": "assistant",
"content": "SELECT fuel_type, COUNT(DISTINCT model) AS model_count FROM transportation.vehicles GROUP BY fuel_type ORDER BY fuel... | You are an SQL statement expert. Given the table 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": "Find all pairs of transactions where both transactions have the same nonce and from_address, but different transaction_id. Show both transaction IDs, the shared from_address, shared nonce, and their block numbers."
},
{
"role": "assistant",
"content": "SELECT t1.tra... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction
fr... |
[
{
"role": "user",
"content": "Show all messages that include a media attachment, along with the sender's user ID and the conversation ID."
},
{
"role": "assistant",
"content": "SELECT message_id, sender_user_id, conversation_id, media_url, media_type, sent_at FROM social_media.messages WHERE med... | You are an SQL statement expert. Given the table 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 text PRIMARY KEY, conversation_id text, sender_user_id text, content text, media_url... |
[
{
"role": "user",
"content": "For each policy, find the latest payment date. Show the policy_id and the maximum payment_date."
},
{
"role": "assistant",
"content": "SELECT policy_id, MAX(payment_date) AS latest_payment_date FROM insurance.premium_payments GROUP BY policy_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 insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_id text, payment_date timestamp, amo... |
[
{
"role": "user",
"content": "How many posts have a media file attached?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM social_media.posts WHERE media_url IS NOT NULL;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE 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 premium payments made after April 1, 2024, including the payment_id, policy_id, customer_id, and amount_paid."
},
{
"role": "assistant",
"content": "SELECT payment_id, policy_id, customer_id, amount_paid\nFROM insurance.premium_payments\nWHERE payment_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 character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, custo... |
[
{
"role": "user",
"content": "Show the application ID, payment amount, and payment method for all payments that have a status of 'Completed' and are related to services in the 'Licensing' category."
},
{
"role": "assistant",
"content": "SELECT p.application_id, p.amount, p.payment_method\nFROM 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": "Which games have the highest number of different in-game items of type 'Weapon'? Show the game title and the count."
},
{
"role": "assistant",
"content": "SELECT g.title AS game_title, COUNT(*) AS weapon_count\nFROM gaming_technology.in_game_items i\nJOIN gaming_tec... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players (
player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player
... |
[
{
"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 character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta... |
[
{
"role": "user",
"content": "Show me the top 5 NFT collections with the highest floor price on Ethereum, along with their names and contract addresses."
},
{
"role": "assistant",
"content": "SELECT name, contract_address, floor_price FROM nft_collections WHERE blockchain = 'ethereum' ORDER BY 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 erc1155_approval_for_all (
block_number bigint NOT NULL, -- Block number containing the transaction
block_times... |
[
{
"role": "user",
"content": "What are the specific tools or equipment used during the maintenance with record_id 'REC456'?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information about the specific tools or equipment used during a maintenance record. The data in the ma... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.m... |
[
{
"role": "user",
"content": "Find all users whose usernames contain numbers and have email addresses from either Gmail or Yahoo."
},
{
"role": "assistant",
"content": "SELECT username, email FROM blockchain.users WHERE (username ~ '[0-9]') AND (email LIKE '%@gmail.com' OR email LIKE '%@yahoo.co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.users ( user_id text, username text, email text, password_hash text )
|
[
{
"role": "user",
"content": "How many appointments have a status of 'Cancelled'?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM legal_services.appointments WHERE status = 'Cancelled';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.appointments ( appointment_id character varying(64) NOT NULL, client_id character varying(64) NOT NULL, ... |
[
{
"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": "What is the total revenue generated by ticket sales at the station with ID 'ST101' for the past month?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the revenue generated by ticket sales as this data is not available in the cur... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.s... |
[
{
"role": "user",
"content": "List the first and last names of employees and the full name of the citizens for whom they have scheduled appointments."
},
{
"role": "assistant",
"content": "SELECT T1.first_name , T1.last_name , T3.first_name , T3.last_name FROM government_services.employees 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 PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "List payment records in USD including guest names and processing staff names."
},
{
"role": "assistant",
"content": "SELECT p.payment_id,\n p.amount,\n p.currency_code,\n g.guest_name,\n s.staff_name\nFROM hospitality_technology.payments p\nJ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ... |
[
{
"role": "user",
"content": "Find all nodes that share the same IP address but have different node_ids."
},
{
"role": "assistant",
"content": "SELECT n1.ip_address, n1.node_id as node_id1, n2.node_id as node_id2 FROM blockchain.nodes n1 JOIN blockchain.nodes n2 ON n1.ip_address = n2.ip_address ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen timestamp )
|
[
{
"role": "user",
"content": "How many documents of each type exist in the system? Show the document type and the count."
},
{
"role": "assistant",
"content": "SELECT document_type, COUNT(*) AS document_count\nFROM legal_services.documents\ngroup BY document_type;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"role": "user",
"content": "Find employees who are managers and list the number of employees they directly manage. Show the manager's full name and the count of their direct reports."
},
{
"role": "assistant",
"content": "SELECT m.first_name || ' ' || m.last_name AS manager_full_name, COUNT(e.... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.employees (
employee_id character varying(64) NOT NULL, -- unique identifier for the government... |
[
{
"role": "user",
"content": "For each property, list the name of the room type and the number of rooms of that type at the property."
},
{
"role": "assistant",
"content": "SELECT T1.property_name, T2.type_name, count(T3.room_id) AS room_count FROM hospitality_technology.properties AS T1 JOIN ho... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "List the username and email of users whose first wallet creation date is the same day as their user registration date."
},
{
"role": "assistant",
"content": "SELECT u.username, u.email FROM web3.users u JOIN (SELECT user_id, MIN(created_at) as first_wallet_created_a... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "Provide a report of each user with their username and the count of all log entries from the last 30 days."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, COUNT(l.log_id) AS log_count\nFROM trading_platform.users u\nLEFT JOIN trading_platform.log... | You are an SQL statement expert. Given the table 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, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "What is the average ROI and total profit for smart money addresses on the Arbitrum chain?"
},
{
"role": "assistant",
"content": "SELECT AVG(roi) AS avg_roi, SUM(profit) AS total_profit\nFROM smart_money_profit\nWHERE chain = 'Arbitrum';"
},
{
"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 smart_money_profit ( address.text, rank.numeric, profit.numeric, roi.numeric, realized_ratio.numeric, most_profit_token... |
[
{
"role": "user",
"content": "Count the number of law firms founded in each decade. Show the decade (e.g., 1990s, 2000s) and the count."
},
{
"role": "assistant",
"content": "SELECT CONCAT(FLOOR(EXTRACT(YEAR FROM founded_date) / 10) * 10, 's') AS decade, COUNT(*) AS firm_count FROM law_firms WHE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "List all medical record entries where the treatment_plan mentions a medication name. Return patient_id, record_id, and the matching medication_name."
},
{
"role": "assistant",
"content": "SELECT mr.patient_id,\n mr.record_id,\n m.medication_name\nFROM he... | You are an SQL statement expert. Given the table 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": "Find all wallet addresses that don't have an associated user_id."
},
{
"role": "assistant",
"content": "SELECT address_id, private_key FROM blockchain.wallets WHERE user_id IS NULL;"
},
{
"role": "user",
"content": "Now show me these addresses along with... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.wallets ( wallet_id text, user_id text, address_id text, private_key text )
|
[
{
"role": "user",
"content": "Show the number of reservations and the sum total_amount for each property."
},
{
"role": "assistant",
"content": "SELECT p.property_id, p.property_name, COUNT(r.reservation_id) AS reservation_count, SUM(r.total_amount) AS total_revenue \nFROM hospitality_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 hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "List the usernames and user IDs of all users whose bio contains the word 'developer'."
},
{
"role": "assistant",
"content": "SELECT user_id, username\nFROM social_media.users\nWHERE bio ILIKE '%developer%';"
}
] | You are an SQL statement expert. Given the table 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": "I need to identify pairs of verified documents submitted by the same citizen. For each pair, display the citizen_id, the earlier document_id with its verification timestamp, and the later document_id with its verification timestamp."
},
{
"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 government_services.documents ( document_id character varying(64) NOT NULL, application_id character varying(64), citiz... |
[
{
"role": "user",
"content": "Show me pairs of a block and its previous block where the previous block's difficulty was greater than 100000. Include details for both blocks."
},
{
"role": "assistant",
"content": "SELECT t1.block_id AS current_block_id, t2.block_id AS previous_block_id, t1.timest... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta... |
[
{
"role": "user",
"content": "List the user ID, theme, and updated_at for users who have updated their settings in the last 90 days and have their theme set to 'dark'."
},
{
"role": "assistant",
"content": "SELECT user_id, theme, updated_at FROM social_media.user_settings WHERE updated_at >= 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 social_media.user_settings ( setting_id.text, user_id.text, theme.text, email_notifications_enabled.boolean, push_notif... |
[
{
"role": "user",
"content": "Show me all vehicles that had maintenance in the past month, including their make, model, maintenance service_date, and depot name."
},
{
"role": "assistant",
"content": "SELECT v.vehicle_id,\n v.make,\n v.model,\n m.service_date,\n l.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 transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text... |
[
{
"role": "user",
"content": "Show me all properties in California with a star rating above 4.0, along with their room types and base rates."
},
{
"role": "assistant",
"content": "SELECT p.property_name, p.star_rating, rt.type_name, rt.base_rate FROM hospitality_technology.properties p JOIN hosp... | You are an SQL statement expert. Given the table 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": "Which narratives have both a positive 1-hour and 24-hour price change percentage? Show the narrative name, the 1h change, and the 24h change."
},
{
"role": "assistant",
"content": "SELECT narrative, price_change_percentage_1h, price_change_percentage_24h FROM narrat... | You are an SQL statement expert. Given the table 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 text, top_3_coins text, price_change_percentage_1h numeric, price_change_percentage_24h nume... |
[
{
"role": "user",
"content": "Show all transactions over 10,000 USD that are not marked as 'REVERSED'."
},
{
"role": "assistant",
"content": "SELECT transaction_id, account_id, amount, currency, status, transaction_date\nFROM financial_services.transactions\nWHERE amount > 10000 AND currency = '... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "Can you help me get the total number of operational platforms across all stations?"
},
{
"role": "assistant",
"content": "db.platforms.countDocuments({ status: 'Operational' });"
}
] | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// db.createCollection('platforms')
// Optional: db.platforms.createIndex({ platform_id: 1 }, { u... |
[
{
"role": "user",
"content": "Now, sort the results by the date opened, oldest first, and show only the top 10."
},
{
"role": "assistant",
"content": "SELECT case_name, case_number, date_opened FROM legal_services.cases WHERE lead_lawyer_id = 'lawyer_abc' AND status = 'Open' AND case_type = 'Cri... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases ( case_id.text, case_number.text, case_name.text, client_id.text, lead_lawyer_id.text, case_type.t... |
[
{
"role": "user",
"content": "For all NFT collections on the Ethereum blockchain, show me the collection name and the current floor price. Sort by floor price descending."
},
{
"role": "assistant",
"content": "SELECT name, floor_price FROM nft_collections WHERE blockchain = 'Ethereum' ORDER BY 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(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "我想了解某个组件的库存情况,包括库存数量、仓库位置和接收日期。"
},
{
"role": "assistant",
"content": "SELECT ci.quantity, ci.location_warehouse, ci.received_date\nFROM manufacturing.component_inventory ci\nWHERE ci.component_id = 'specific_component_id';"
},
{
"role": "user",
"content... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE manufacturing.components (
component_id character varying(64) NOT NULL, -- uniqu... |
[
{
"role": "user",
"content": "List all maintenance services performed on vehicle 'VHCL789', showing the service date and type."
},
{
"role": "assistant",
"content": "SELECT service_date, service_type FROM transportation.maintenance_logs WHERE vehicle_id = 'VHCL789';"
},
{
"role": "user",... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.maintenance_logs ( log_id text, vehicle_id text, service_date date, odometer_reading integer, service_ty... |
[
{
"role": "user",
"content": "What is the total count of game sessions recorded?"
},
{
"role": "assistant",
"content": "SELECT count(*) FROM gaming_technology.game_sessions;"
},
{
"role": "user",
"content": "Now, only count sessions that lasted longer than 1 hour."
},
{
"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 gaming_technology.games (
game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game
ti... |
[
{
"role": "user",
"content": "List the first name and last name of citizens along with the amount of payments they have made."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T2.amount FROM government_services.citizens AS T1 JOIN government_services.payments AS T2 ON T1... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "List all events and any token transfers that occurred in the same transaction, showing event_id, event_name, transfer_id, and token_symbol."
},
{
"role": "assistant",
"content": "SELECT\n e.event_id,\n e.event_name,\n tt.transfer_id,\n tk.token_symbol\nFROM web3... | You are an SQL statement expert. Given the table 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": "List all job titles of employees who work in the 'Finance' department."
},
{
"role": "assistant",
"content": "SELECT DISTINCT job_title\nFROM government_services.employees\nWHERE department = 'Finance';"
}
] | You are an SQL statement expert. Given the table 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": "List all invoices that were paid within 7 days of their issue date. Show invoice number, issue date, payment date, and total amount."
},
{
"role": "assistant",
"content": "SELECT invoice_number, issue_date, payment_date, total_amount FROM legal_services.invoices WHE... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph... |
[
{
"role": "user",
"content": "Find all medical records where the vitals JSON field contains a blood pressure reading with systolic higher than 140, and show the patient_id, record_date, and vitals."
},
{
"role": "assistant",
"content": "SELECT patient_id, record_date, vitals FROM healthcare.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 healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "Count the number of logs for each action type."
},
{
"role": "assistant",
"content": "SELECT action,\n COUNT(*) AS count\nFROM trading_platform.logs\nGROUP BY action;"
}
] | You are an SQL statement expert. Given the table 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.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp )
|
[
{
"role": "user",
"content": "List document names and versions for documents that share the same case_id, showing each pair of versions."
},
{
"role": "assistant",
"content": "SELECT d1.case_id, d1.document_name AS doc_name_v1, d1.version AS version1, d2.document_name AS doc_name_v2, d2.version ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents (
document_id character varying(64) NOT NULL, -- unique identifier for the document
c... |
[
{
"role": "user",
"content": "Find the total number of documents uploaded by each citizen along with their first and last names."
},
{
"role": "assistant",
"content": "SELECT c.citizen_id, c.first_name, c.last_name, COUNT(d.document_id) AS document_count\nFROM government_services.citizens c\nLEF... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens (
citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen
... |
[
{
"role": "user",
"content": "Find all pairs of customers who live in the same state but have different risk profiles."
},
{
"role": "assistant",
"content": "SELECT a.customer_id AS customer_id_a, a.first_name || ' ' || a.last_name AS full_name_a, a.risk_profile AS risk_profile_a, b.customer_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 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 reviews for properties with a star rating of at least 4.5. Include the property_name, review_id, rating_overall, and review_date."
},
{
"role": "assistant",
"content": "SELECT p.property_name, r.review_id, r.rating_overall, r.review_date\nFROM 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 PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "What is the current job satisfaction level or feedback from staff members working at a specific train station?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on job satisfaction levels or feedback from staff members as this data is... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.s... |
[
{
"role": "user",
"content": "For each customer, could you list their full name, email, and the combined balance of all their accounts? Please also show the number of accounts they hold."
},
{
"role": "assistant",
"content": "SELECT c.customer_id, c.first_name || ' ' || c.last_name AS full_name,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h... |
[
{
"role": "user",
"content": "Calculate the average total amount and average amount paid for reservations grouped by booking source."
},
{
"role": "assistant",
"content": "SELECT booking_source, AVG(total_amount) AS avg_total_amount, AVG(amount_paid) AS avg_amount_paid FROM hospitality_technolog... | You are an SQL statement expert. Given the table 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": "What are the personal contact details of the staff member associated with staff_id 'STAFF789' who worked on a specific maintenance record?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide personal contact details of staff members as this informa... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.m... |
[
{
"role": "user",
"content": "For each transaction, list the total value transferred and the number of different addresses involved (either as sender or receiver)."
},
{
"role": "assistant",
"content": "SELECT transaction_id, SUM(value) AS total_value_transferred, COUNT(DISTINCT addr) AS num_add... | You are an SQL statement expert. Given the table 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 text, token_id text, from_address text, to_address text, value numeric, transaction_... |
[
{
"role": "user",
"content": "Find the average percentage share among all beneficiaries for each distinct relationship type."
},
{
"role": "assistant",
"content": "SELECT relationship, AVG(percentage_share) FROM insurance.policy_beneficiaries GROUP BY relationship ORDER 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.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"role": "user",
"content": "Show me all doctors specializing in Pediatrics along with their upcoming appointments, including the patient ID and appointment time."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id, d.first_name, d.last_name, a.patient_id, a.appointment_time FROM healthca... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text PRIMARY KEY, first_name text, last_name text, specialty text, license_number text, ... |
[
{
"role": "user",
"content": "For each player, show how many achievements they have unlocked in games with items of type 'Consumable'."
},
{
"role": "assistant",
"content": "SELECT pa.player_id, COUNT(DISTINCT pa.achievement_id) AS achievements_unlocked\nFROM gaming_technology.player_achievement... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ... |
[
{
"role": "user",
"content": "List tokens that have a 24-hour trading volume greater than $10,000,000 and a negative price change percentage over the last 24 hours. Show the token symbol, chain, total volume, and the 24-hour price change percentage."
},
{
"role": "assistant",
"content": "SELECT ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri... |
[
{
"role": "user",
"content": "What is the maintenance schedule for platform 3 at station DEF for the next month?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to the maintenance schedule for platforms. The data I have only includes static information about platform de... | You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE train_station_management.p... |
[
{
"role": "user",
"content": "Can you list each game alongside another game in the same genre but by a different developer?"
},
{
"role": "assistant",
"content": "SELECT g1.genre, g1.title AS game1, g2.title AS game2\nFROM gaming_technology.games g1\nJOIN gaming_technology.games g2\n ON g1.genr... | You are an SQL statement expert. Given the table 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 vehicles and their last maintenance service date along with the odometer reading, including only those that have not had a fuel refill in the past 30 days."
},
{
"role": "assistant",
"content": "SELECT m.vehicle_id,\n m.last_service_date,\n m.la... | You are an SQL statement expert. Given the table 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, route_number character varying(32) NOT NULL UNIQUE, de... |
[
{
"role": "user",
"content": "Show me the usernames and email addresses of users who commented on any post tagged with the hashtag 'H777'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, u.email\nFROM social_media.comments c\nJOIN social_media.users u ON c.user_id = 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 social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char... |
[
{
"role": "user",
"content": "Calculate for each player the timespan between their earliest and latest achievement unlocks."
},
{
"role": "assistant",
"content": "SELECT pa_min.player_id,\n pa_max.max_time - pa_min.min_time AS span\nFROM (\n SELECT player_id,\n MIN(unlocked_at) 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 gaming_technology.player_achievements (
player_achievement_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique id... |
[
{
"role": "user",
"content": "Show the full name of each manager and the average commission rate of the agents who report directly to them. Only include managers who have at least one reporting agent."
},
{
"role": "assistant",
"content": "SELECT T2.first_name AS manager_first_name, T2.last_name... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state... |
[
{
"role": "user",
"content": "For each vehicle, list its vehicle_id, license_plate, and any older vehicle of the same type (showing older_vehicle_id and older year)."
},
{
"role": "assistant",
"content": "SELECT cur.vehicle_id,\n cur.license_plate,\n old.vehicle_id AS older_vehicle_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 transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "Show me the list of hashtags that have been used, along with the time they were first used."
},
{
"role": "assistant",
"content": "SELECT tag_name, created_at \nFROM social_media.hashtags;"
}
] | You are an SQL statement expert. Given the table 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": "For citizens who registered before January 1, 2023, show the total number of notifications sent to them for each channel. List the citizen's first name, last name, the channel, and the count of notifications."
},
{
"role": "assistant",
"content": "SELECT\n T1.first... | You are an SQL statement expert. Given the table 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 the first and last name of each citizen along with the city and state of the service location for their agency."
},
{
"role": "assistant",
"content": "SELECT c.first_name, c.last_name, sl.city, sl.state\nFROM government_services.citizens c\nJOIN government_serv... | You are an SQL statement expert. Given the table 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 patients who have an active prescription for a medication manufactured by 'AstraZeneca', along with their policy number and the prescription ID."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, pi.policy_number, pr.prescription_id\nFROM healthcar... | You are an SQL statement expert. Given the table 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.text, medication_name.text, generic_name.text, manufacturer.text, ndc_code.text,... |
[
{
"role": "user",
"content": "List all group chat conversations and the number of messages in each group chat."
},
{
"role": "assistant",
"content": "SELECT c.conversation_id,\n c.group_name,\n COUNT(m.message_id) AS message_count\nFROM social_media.conversations c\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.posts ( post_id.text, user_id.text, content.text, media_url.text, media_type.text, created_at.timestamp, u... |
[
{
"role": "user",
"content": "Show me all events emitted by contracts where the event name contains 'Approval', along with the contract ID and transaction ID, sorted by emitted timestamp in descending order."
},
{
"role": "assistant",
"content": "SELECT event_id, contract_id, event_name, transac... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.events (
event_id character varying(64) NOT NULL, -- unique identifier for the event
contract_id characte... |
[
{
"role": "user",
"content": "I would like to see a list of all medical records where the chief complaint contains the word 'cough' along with the doctor's ID and the date of the record."
},
{
"role": "assistant",
"content": "SELECT record_id, doctor_id, record_date, chief_complaint FROM healthc... | You are an SQL statement expert. Given the table 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, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "For each guest, list reservation_id, guest_id, check_in_date, and the next reservation_id and its check_in_date."
},
{
"role": "assistant",
"content": "SELECT r1.reservation_id,\n r1.guest_id,\n r1.check_in_date,\n r2.reservation_id AS next_reserva... | You are an SQL statement expert. Given the table 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": "I would like to calculate the average rarity_score for each NFT collection on the Ethereum blockchain."
},
{
"role": "assistant",
"content": "SELECT c.contract_address,\n AVG(m.rarity_score) AS avg_rarity\nFROM nft_collections c\nJOIN nft_metadata m\n ON c.co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_... |
[
{
"role": "user",
"content": "How many hashtags have been created in March 2024?"
},
{
"role": "assistant",
"content": "```sql\nSELECT COUNT(*) AS march_2024_hashtag_count\nFROM social_media.hashtags\nWHERE created_at >= '2024-03-01'\n AND created_at < '2024-04-01';\n```"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p... |
[
{
"role": "user",
"content": "List the IDs and names of all service locations that have no phone number specified."
},
{
"role": "assistant",
"content": "SELECT location_id, location_name \nFROM government_services.service_locations \nWHERE contact_phone IS NULL OR contact_phone = '';"
}
] | You are an SQL statement expert. Given the table 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": "How many unique wallets hold each NFT (by contract_address and token_id) currently?"
},
{
"role": "assistant",
"content": "SELECT contract_address, token_id, COUNT(DISTINCT wallet_address) AS holder_count\nFROM nft_holders\nGROUP BY contract_address, token_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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.