conversations listlengths 2 8 | system stringlengths 290 7.65k |
|---|---|
[
{
"role": "user",
"content": "What is the average, minimum, and maximum interest_rate for each loan_type among active loans?"
},
{
"role": "assistant",
"content": "SELECT loan_type,\n AVG(interest_rate) AS avg_interest_rate,\n MIN(interest_rate) AS min_interest_rate,\n MAX(inte... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.loans (
loan_id character varying(64) NOT NULL, -- unique identifier for the loan, could be same... |
[
{
"role": "user",
"content": "What is the average ROI for smart money addresses on the Ethereum chain with a realized profit ratio above 50%?"
},
{
"role": "assistant",
"content": "SELECT AVG(roi) as average_roi\nFROM smart_money_token_performance\nWHERE chain = 'Ethereum'\nAND realized_ratio > ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "Return the number of top-level comments and the number of replies in the comments table."
},
{
"role": "assistant",
"content": "SELECT\n SUM(CASE WHEN parent_comment_id IS NULL THEN 1 ELSE 0 END) AS top_level_comments,\n SUM(CASE WHEN parent_comment_id 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, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "Show me all patients who have a primary insurance plan from 'Blue Cross', along with their insurance policy numbers and the plan types."
},
{
"role": "assistant",
"content": "SELECT p.patient_id, p.first_name, p.last_name, pi.policy_number, ip.plan_type 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.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ... |
[
{
"role": "user",
"content": "List group conversation names and the number of messages sent in each conversation after January 1, 2023."
},
{
"role": "assistant",
"content": "SELECT c.group_name, COUNT(m.message_id) FROM social_media.conversations c JOIN social_media.messages m ON c.conversation... | You are an SQL statement expert. Given the table 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 narratives with a trend rank better than 50, showing the narrative name and their listed 'Top 3 Coins'."
},
{
"role": "assistant",
"content": "SELECT narrative, top_3_coins FROM narrative_info WHERE trend_rank < 50"
},
{
"role": "user",
"content... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume... |
[
{
"role": "user",
"content": "Could you list the top 5 narratives by their 7-day price change percentage, including the number of tokens and their top 3 coins?"
},
{
"role": "assistant",
"content": "SELECT narrative, price_change_percentage_7d, token_num, top_3_coins FROM narrative_info ORDER BY... | You are an SQL statement expert. Given the table 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": "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": "How many medications does each manufacturer have?"
},
{
"role": "assistant",
"content": "SELECT manufacturer, COUNT(*) AS med_count\nFROM healthcare.medications\nGROUP BY manufacturer;"
},
{
"role": "user",
"content": "Only include manufacturers with mor... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,... |
[
{
"role": "user",
"content": "What are the training programs or certifications completed by a staff member with the role of Platform Supervisor?"
},
{
"role": "assistant",
"content": "I'm sorry, but I don't have access to information about the training programs or certifications completed by sta... | 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 all trades with their order_id, trade_type, and commission for trades with commission higher than 100."
},
{
"role": "assistant",
"content": "SELECT trade_id, order_id, trade_type, commission FROM financial_services.trades WHERE commission > 100;"
},
{
... | You are an SQL statement expert. Given the table 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": "Could you list each developer along with the next developer founded after them in the same country? Return columns current_developer, next_developer, and years_difference."
},
{
"role": "assistant",
"content": "SELECT d1.name AS current_developer,\n d2.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 gaming_technology.developers ( developer_id uuid, name text, country text, founded_year integer, website text, created_... |
[
{
"role": "user",
"content": "For each developer, can you find the next developer in the same country using a self join, returning developer_ids and names?"
},
{
"role": "assistant",
"content": "SELECT d1.developer_id AS current_dev,\n d1.name AS current_name,\n d2.develo... | You are an SQL statement expert. Given the table 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": "Could you provide the total number of game sessions and the number of distinct players for each game genre? Display the genre, session count, and player count."
},
{
"role": "assistant",
"content": "SELECT g.genre, COUNT(gs.session_id) AS session_count, COUNT(DISTIN... | You are an SQL statement expert. Given the table 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": "Provide a list of all vehicles and the total quantity of fuel refueled for each vehicle."
},
{
"role": "assistant",
"content": "SELECT T1.license_plate, sum(T2.quantity) FROM transportation.vehicles AS T1 JOIN transportation.fuel_logs AS T2 ON T1.vehicle_id = T2.veh... | You are an SQL statement expert. Given the table 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": "I’d like to find all pairs of securities that belong to the same sector."
},
{
"role": "assistant",
"content": "SELECT a.security_id, a.ticker_symbol, b.security_id AS pair_security_id, b.ticker_symbol AS pair_ticker_symbol, a.sector\nFROM financial_services.securit... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu... |
[
{
"role": "user",
"content": "Show all rooms that are on floor 3."
},
{
"role": "assistant",
"content": "SELECT room_id, property_id, room_number FROM hospitality_technology.rooms WHERE floor = 3;"
},
{
"role": "user",
"content": "For these rooms, include the property name and room 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 hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ... |
[
{
"role": "user",
"content": "List all guests who have a loyalty member ID, showing their full name (first and last name), email, and loyalty ID."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email, loyalty_member_id FROM hospitality_technology.guests WHERE loyalty_member_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms (
room_id character varying(64) NOT NULL, -- unique identifier for the room
prope... |
[
{
"role": "user",
"content": "How many lawyers who are partners were hired in each year? Show the hire year and the count."
},
{
"role": "assistant",
"content": "SELECT strftime('%Y', hire_date) AS hire_year , count(lawyer_id) FROM legal_services.lawyers WHERE is_partner = true GROUP BY hire_... | You are an SQL statement expert. Given the table 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": "List each claim_handler_id along with the number of claims they've handled and the total settlement_amount they've paid out."
},
{
"role": "assistant",
"content": "SELECT claim_handler_id,\n COUNT(*) AS total_claims,\n SUM(settlement_amount) AS total_set... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims (
claim_id character varying(64) NOT NULL, -- unique identifier for the claim
policy_id charac... |
[
{
"role": "user",
"content": "Show the total transaction amount for each customer, including their full name and risk profile. Join customers to accounts and then to transactions."
},
{
"role": "assistant",
"content": "SELECT\n T2.first_name,\n T2.last_name,\n T2.risk_profile,\n SUM(T1.amoun... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "Find all documents of type 'Correspondence' uploaded in 2023. Show the document name, upload timestamp, and the name of the case it belongs to."
},
{
"role": "assistant",
"content": "SELECT T1.document_name, T1.upload_timestamp, T2.case_name FROM legal_services.docu... | You are an SQL statement expert. Given the table 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 the case number, case name, and the full name of the client for cases that have uploaded documents."
},
{
"role": "assistant",
"content": "SELECT T1.case_number , T1.case_name , T2.full_name FROM legal_services.cases AS T1 JOIN legal_services.clients AS T2 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 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 average number of current players per server for each region."
},
{
"role": "assistant",
"content": "SELECT region, AVG(current_players) AS avg_current_players\nFROM gaming_technology.servers\nGROUP BY region;"
},
{
"role": "user",
"content":... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games (
game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game
ti... |
[
{
"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": "List claims along with the name of the insurance product associated with the policy under which the claim was filed. Show claim_id, incident_date, and product_name."
},
{
"role": "assistant",
"content": "SELECT T1.claim_id, T1.incident_date, T3.product_name FROM ins... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims (
claim_id character varying(64) NOT NULL, -- unique identifier for the claim
policy_id charac... |
[
{
"role": "user",
"content": "Can you help me retrieve the inventory details for a specific component ID, including the quantity and warehouse location?"
},
{
"role": "assistant",
"content": "HGETALL inv:<inventory_record_id>"
},
{
"role": "user",
"content": "Can you also include the... | 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
Use Hashes. Key pattern: 'inv:<inventory_record_id>'. Example: HSET inv:INVREC500 component_id "c... |
[
{
"role": "user",
"content": "Show me the deployer address and the count of contracts they have deployed on the 'mainnet' network, but only for deployers who have deployed more than 5 contracts on mainnet. Sort the results by the count in descending order."
},
{
"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 web3.contracts ( contract_id text PRIMARY KEY, address text, abi text, bytecode text... |
[
{
"role": "user",
"content": "Show all appointments with subject containing 'Review' and their corresponding case_id."
},
{
"role": "assistant",
"content": "SELECT appointment_id, subject, case_id\nFROM legal_services.appointments\nWHERE subject ILIKE '%Review%';"
}
] | You are an SQL statement expert. Given the table 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, invoice_number.text, client_id.text, case_id.text, issue_date.date, due_date... |
[
{
"role": "user",
"content": "List all active SUI coins with their symbol, name, and total balance across all owners."
},
{
"role": "assistant",
"content": "SELECT scm.coin_type, scm.symbol, scm.name, SUM(CAST(sc.balance AS DECIMAL)) AS total_balance\nFROM sui_coins_metadata scm\nJOIN sui_coins ... | You are an SQL statement expert. Given the table 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 documents that have multiple versions, including document_name, case_id, and the count of versions."
},
{
"role": "assistant",
"content": "SELECT document_name,\n case_id,\n COUNT(*) AS version_count\nFROM legal_services.documents\nGROUP BY docu... | You are an SQL statement expert. Given the table 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": "For each event, display its event_id, the event_id of the previous event in the same transaction (if any), and the log_index of both events."
},
{
"role": "assistant",
"content": "SELECT curr.event_id AS current_event_id,\n prev.event_id AS previous_event_... | You are an SQL statement expert. Given the table 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, contract_id character varying(64) NOT NULL, event_name character... |
[
{
"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": "For each guest, calculate their total spending on delivered service orders and the total number of those orders."
},
{
"role": "assistant",
"content": "SELECT g.guest_id,\n g.first_name || ' ' || g.last_name AS full_name,\n SUM(so.total_price) AS total_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 hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te... |
[
{
"role": "user",
"content": "Show the prescription ID, medication name, and patient full name for all prescriptions issued in the last 30 days."
},
{
"role": "assistant",
"content": "SELECT pr.prescription_id, m.medication_name, CONCAT(p.first_name, ' ', p.last_name) AS patient_name\nFROM healt... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "Show me all transactions (transaction_id, amount, transaction_type) where the transaction_type is 'Transfer' and the status is 'Completed', along with the account_id and related_account_id."
},
{
"role": "assistant",
"content": "SELECT transaction_id, amount, transa... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the trans... |
[
{
"role": "user",
"content": "List all wallet addresses that have unspent UTXOs with amounts greater than 100, along with the total unspent amount for each address."
},
{
"role": "assistant",
"content": "SELECT w.address, SUM(u.amount) AS total_unspent FROM trading_platform.wallets w JOIN tradin... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "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 lawyers who have any unbilled time entries. Show their first name, last name, and the count of their unbilled entries."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, COUNT(T2.entry_id) FROM lawyers AS T1 JOIN time_entries AS T2 ON T1... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t... |
[
{
"role": "user",
"content": "Count how many posts have media attachments."
},
{
"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 time entries for lawyers specializing in 'Criminal Law'. Show the entry ID, the date worked, hours spent, and the first and last name of the lawyer who performed the work."
},
{
"role": "assistant",
"content": "SELECT te.entry_id, te.date_worked, te.hours_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 legal_services.lawyers (
lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer
first_n... |
[
{
"role": "user",
"content": "Find all NFTs with a rarity rank less than 100 and show their name and the name of their collection."
},
{
"role": "assistant",
"content": "SELECT nm.name AS nft_name, nc.name AS collection_name FROM nft_metadata nm JOIN nft_collections nc ON nm.contract_address = n... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varch... |
[
{
"role": "user",
"content": "Show me all terminated drivers who had worked for the company for more than 5 years before termination."
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name, hire_date FROM transportation.drivers WHERE status = 'Terminated' AND (hire_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 transportation.drivers (
driver_id character varying(64) NOT NULL, -- unique identifier for the driver
employe... |
[
{
"role": "user",
"content": "List all managers (employees who have other employees reporting to them) along with the count of their direct reports, showing only those with more than 5 reports."
},
{
"role": "assistant",
"content": "SELECT e.employee_id, e.first_name, e.last_name, COUNT(r.employ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.employees ( employee_id text PRIMARY KEY, first_name text, last_name text, job_title text, departmen... |
[
{
"role": "user",
"content": "What are the fuel consumption rates per hour for the Boeing 747-8 model?"
},
{
"role": "assistant",
"content": "I'm sorry, but I can't provide information on the fuel consumption rates for the Boeing 747-8 model as this data is not included in the aircraft_models ta... | 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": "Get each user's ID, the count of wallets they own, and the total amount of their unspent UTXOs across all wallets."
},
{
"role": "assistant",
"content": "SELECT w.user_id,\n COUNT(DISTINCT w.wallet_id) AS wallet_count,\n COA... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the wallet
user_... |
[
{
"role": "user",
"content": "Show the latest version number of each document_name for every case."
},
{
"role": "assistant",
"content": "SELECT case_id,\n document_name,\n MAX(version) AS latest_version\nFROM legal_services.documents\nGROUP BY case_id, document_name;"
},
{
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... |
[
{
"role": "user",
"content": "Find all contracts where the deployer address is the same as the contract address, indicating self-deployed contracts."
},
{
"role": "assistant",
"content": "SELECT address, deployer_address FROM web3.contracts WHERE address = deployer_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 text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,... |
[
{
"role": "user",
"content": "I need a report of patients who have received prescriptions for medications manufactured by 'Pfizer'. Include patient ID, first name, last name, medication_name, and prescription_date."
},
{
"role": "assistant",
"content": "SELECT p.patient_id,\n 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": "Show me the top 5 buyers by total trade volume (quantity * price) in the last 30 days, along with their trade count."
},
{
"role": "assistant",
"content": "SELECT buyer_id, COUNT(trade_id) AS trade_count, SUM(quantity * price) AS total_volume FROM trading_platform.t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.trades ( trade_id character varying(64) NOT NULL, order_id character varying(64) NOT NULL, buyer_id ch... |
[
{
"role": "user",
"content": "For each contract, can you list the token symbols and total supply of all tokens created by that contract, along with the contract's current status?"
},
{
"role": "assistant",
"content": "SELECT c.contract_id, c.address AS contract_address, c.status, t.token_symbol,... | You are an SQL statement expert. Given the table 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 text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,... |
[
{
"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": "Can you narrow this down to only show cases where the case type is 'Criminal'?"
},
{
"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 = 'Crimin... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.cases ( case_id.text, case_number.text, case_name.text, client_id.text, lead_lawyer_id.text, case_type.t... |
[
{
"role": "user",
"content": "Show 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": "Can you show me all developers along with the year they were founded and their website, grouped by country?"
},
{
"role": "assistant",
"content": "SELECT country, array_agg(name) AS developers, array_agg(founded_year) AS founded_years, array_agg(website) AS websites... | You are an SQL statement expert. Given the table 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": "Give me the total billed amount for each invoice in 2024."
},
{
"role": "assistant",
"content": "SELECT invoice_id, SUM(hours_spent * billing_rate) AS total_billed_amount FROM legal_services.time_entries WHERE is_billed = TRUE AND EXTRACT(YEAR FROM date_worked) = 20... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.time_entries ( entry_id text PRIMARY KEY, case_id text, lawyer_id text, date_worked date, hours_spent nu... |
[
{
"role": "user",
"content": "Show all routes including their number, type, and description."
},
{
"role": "assistant",
"content": "SELECT route_number , type , description FROM transportation.routes"
},
{
"role": "user",
"content": "Only show routes of type 'City Bus'."
},
{
... | You are an SQL statement expert. Given the table 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": "How many unique patient records are there for each gender?"
},
{
"role": "assistant",
"content": "SELECT gender, COUNT(DISTINCT patient_id) AS patient_count FROM healthcare.patients GROUP BY gender;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"role": "user",
"content": "Show me a summary of all clients with the total number of invoices they've received and the sum of total_amount for those invoices."
},
{
"role": "assistant",
"content": "SELECT cl.client_id,\n CONCAT(cl.first_name, ' ', cl.last_name) AS client_name,\n C... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam... |
[
{
"role": "user",
"content": "List all orders, showing order ID, type, quantity, and the asset name."
},
{
"role": "assistant",
"content": "SELECT o.order_id, o.order_type, o.quantity, a.name FROM trading_platform.orders o JOIN trading_platform.assets a ON o.asset_id = a.asset_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.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
CREATE ... |
[
{
"role": "user",
"content": "Show the first and last names, email, and phone number for all patients who were added to the system in the last 90 days along with their emergency contact name."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email, phone_number, emergency_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 healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
[
{
"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": "Get the average overall review rating for each property. Return property_name and avg_rating."
},
{
"role": "assistant",
"content": "SELECT pr.property_name, AVG(r.rating_overall) AS avg_rating\nFROM hospitality_technology.reviews r\nJOIN hospitality_technology.prop... | You are an SQL statement expert. Given the table 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": "Show me a list of all doctors who have made at least one diagnosis along with the total number of diagnoses they have made."
},
{
"role": "assistant",
"content": "SELECT d.doctor_id, d.first_name, d.last_name, COUNT(di.diagnosis_id) AS diagnosis_count\nFROM 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.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ... |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 2