conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "For each trip, list the trip ID, its scheduled departure time, and the total fare from all bookings associated with that trip."
},
{
"role": "assistant",
"content": "SELECT T2.trip_id , T2.scheduled_departure , SUM(T1.fare) FROM transportation.bookings AS T1 JOIN ... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "List all pairs of time entries for the same case that were worked on the same date by different lawyers. Include both entry IDs, the case ID, the work date, and both lawyer IDs."
},
{
"role": "assistant",
"content": "SELECT t1.entry_id AS entry1_id, t2.entry_id AS 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 legal_services.time_entries ( entry_id.text, case_id.text, lawyer_id.text, date_worked.date, hours_spent.numeric, billi... |
[
{
"role": "user",
"content": "Show me the latest token activities on Avalanche, listing the type, amount, and timestamp."
},
{
"role": "assistant",
"content": "SELECT type, amt, block_timestamp FROM token_activities_avalanche ORDER BY block_timestamp DESC LIMIT 100"
},
{
"role": "user",
... | 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 the top 5 NFT collections with the highest average rarity score, along with their contract addresses and names."
},
{
"role": "assistant",
"content": "SELECT contract_address, name, AVG(rarity_score) as avg_rarity_score FROM nft_metadata GROUP BY contract_ad... | You are an SQL statement expert. Given the table 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": "For each game_id and region, show me the server that currently has the highest current_players and the server that has the highest max_players. Return game_id, region, top_current_server_id, top_current_players, top_capacity_server_id, and top_capacity."
},
{
"role": "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 gaming_technology.servers ( server_id uuid, game_id uuid, server_name text, region text, ip_address text, port integer,... |
[
{
"role": "user",
"content": "Show me the top 5 users who have the highest total trade volume (quantity * price) as buyers, along with their wallet addresses and the number of distinct assets they traded."
},
{
"role": "assistant",
"content": "SELECT t.buyer_id, w.address, COUNT(DISTINCT t.asset... | You are an SQL statement expert. Given the table 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 PRIMARY KEY, user_id text, address text, private_key text, created_at timesta... |
[
{
"role": "user",
"content": "List the names of services and the total number of times each service has been ordered. Only include services that have been ordered at least once."
},
{
"role": "assistant",
"content": "SELECT T1.service_name, count(T2.order_id) AS order_count FROM hospitality_tech... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "List all inactive insurance products that were created more than 5 years ago."
},
{
"role": "assistant",
"content": "SELECT * FROM insurance.insurance_products WHERE is_active = false AND created_at < CURRENT_DATE - INTERVAL '5 years';"
},
{
"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 insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu... |
[
{
"role": "user",
"content": "Find all chronic diagnoses made by Cardiology doctors in the last year, including patient ID, diagnosis description, and doctor's full name."
},
{
"role": "assistant",
"content": "SELECT di.patient_id, di.description, d.first_name || ' ' || d.last_name AS doctor_nam... | You are an SQL statement expert. Given the table 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": "Find all patients who have received a diagnosis with 'Diabetes' in the description. Show patient ID and diagnosis date."
},
{
"role": "assistant",
"content": "SELECT patient_id, diagnosis_date FROM healthcare.diagnoses WHERE description ILIKE '%Diabetes%';"
},
{... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.diagnoses (
diagnosis_id character varying(64) NOT NULL, -- unique identifier for the diagnosis entry
... |
[
{
"role": "user",
"content": "Show me all conversation IDs (whether group chat or not) that have at least one hashtag used in posts linked to them."
},
{
"role": "assistant",
"content": "SELECT DISTINCT c.conversation_id\nFROM social_media.conversations c\nJOIN social_media.post_hashtags ph ON 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": "Show me all properties in California with their star ratings and the total number of rooms they have, ordered by the room count in descending order."
},
{
"role": "assistant",
"content": "SELECT p.property_id, p.property_name, p.star_rating, COUNT(r.room_id) AS room... | You are an SQL statement expert. Given the table 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 each client_id, first_name, last_name, and the sum of total_amount for all of their invoices."
},
{
"role": "assistant",
"content": "SELECT c.client_id,\n c.first_name,\n c.last_name,\n SUM(i.total_amount) AS total_invoiced\nFROM legal_service... | You are an SQL statement expert. Given the table 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": "Find claims where the estimated loss is greater than the average estimated loss for claims with a status of 'Closed'. Show the claim ID, incident date, estimated loss, and status."
},
{
"role": "assistant",
"content": "SELECT claim_id, incident_date, estimated_loss,... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ... |
[
{
"role": "user",
"content": "List the first and last names of all drivers, along with the count of unique vehicle makes they have driven."
},
{
"role": "assistant",
"content": "SELECT d.first_name, d.last_name, COUNT(DISTINCT v.make) AS unique_vehicle_makes\nFROM transportation.drivers d\nJOIN ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text... |
[
{
"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": "List each employee's first and last name along with the count of active services offered by their agency."
},
{
"role": "assistant",
"content": "SELECT e.first_name, e.last_name, COUNT(s.service_id) AS active_service_count\nFROM government_services.employees e\nJOIN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT... |
[
{
"role": "user",
"content": "What is the average commission rate for active agents?"
},
{
"role": "assistant",
"content": "SELECT AVG(commission_rate) FROM insurance.agents WHERE status = 'Active';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin... |
[
{
"role": "user",
"content": "我想查看所有检查记录中检查员的ID和检查结果,同时统计每个检查员的检查次数。"
},
{
"role": "assistant",
"content": "db.inspections.aggregate([\n {\n $group: {\n _id: '$inspector_employee_id',\n total_inspections: { $count: {} },\n results: { $push: '$result' }\n }\n },\n {\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
Collection 'inspections'. Document structure: { _id: <ObjectId (or inspection_id)>, inspection_id... |
[
{
"role": "user",
"content": "Which is the token with the largest difference between its highest and lowest price in the last 24h on each chain, and what is the token's symbol and current price?"
},
{
"role": "assistant",
"content": "SELECT chain, token_symbol, price, (highest_price_24h - lowest... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
"CREATE TABLE token_basic_info (",
"coin_id character varying(100) NOT NULL, -- the id of the token",
"token_name character... |
[
{
"role": "user",
"content": "I want to find total PNL and average ROI of smart money token performance for each narrative category. Only include narratives with average ROI greater than 0.5."
},
{
"role": "assistant",
"content": "SELECT bi.narrative,\n SUM(smtp.pnl) AS total_pnl,\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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "For each driver, show their driver_id, first_name, last_name, along with any other driver whose license_expiry_date is earlier than theirs."
},
{
"role": "assistant",
"content": "SELECT d1.driver_id AS driver_id,\n d1.first_name,\n d1.last_name,\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 transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... |
[
{
"role": "user",
"content": "Show me the total transaction amount sent by each user (based on user_id) in the last 30 days, along with their username."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, SUM(t.amount) AS total_amount_sent FROM blockchain.users u JOIN blockchain.... | You are an SQL statement expert. Given the table 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.transactions ( transaction_id.text, block_id.text, sender_address.text, receiver_address.text, amount.numeri... |
[
{
"role": "user",
"content": "For each vehicle, show vehicle_id, make, model, the earliest and latest fuel log IDs with their timestamps."
},
{
"role": "assistant",
"content": "WITH extremes AS (\n SELECT vehicle_id,\n MIN(log_timestamp) AS first_ts,\n MAX(log_timestamp) AS last... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text... |
[
{
"role": "user",
"content": "Find consecutive image messages in each conversation: return conversation_id, first_image_id, next_image_id, and time_diff in seconds."
},
{
"role": "assistant",
"content": "SELECT m1.conversation_id,\n m1.message_id AS first_image_id,\n m2.message_id AS... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.messages (
message_id character varying(64) NOT NULL, -- unique identifier for the message
convers... |
[
{
"role": "user",
"content": "How many comments were created in the month of March 2024?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM social_media.comments WHERE created_at >= '2024-03-01' AND created_at < '2024-04-01';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ... |
[
{
"role": "user",
"content": "List all routes along with the number of unique vehicles assigned to trips on each route."
},
{
"role": "assistant",
"content": "SELECT r.route_id, r.route_number, COUNT(DISTINCT t.vehicle_id) AS unique_vehicles\nFROM transportation.routes r\nLEFT JOIN transportatio... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU... |
[
{
"role": "user",
"content": "List the service_id, service_name, and agency_id for all active services that have an online application URL provided."
},
{
"role": "assistant",
"content": "SELECT service_id,\n service_name,\n agency_id\nFROM government_services.services\nWHERE is_acti... | You are an SQL statement expert. Given the table 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 servers hosting games that use the 'Unity' engine, including each server's name, region, and the game's release_date."
},
{
"role": "assistant",
"content": "SELECT s.server_name, s.region, g.release_date\nFROM gaming_technology.servers s\nJOIN gaming_techno... | You are an SQL statement expert. Given the table 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": "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": "For wallet address '0xWalletA', list the ERC20 tokens held, showing contract address and amount."
},
{
"role": "assistant",
"content": "SELECT contract_address, amount FROM erc20_balances WHERE wallet_address = '0xWalletA';"
},
{
"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 erc1155_approval_for_all ( block_number bigint NOT NULL, block_timestamp timestamp(3) NOT NULL, transaction_index integ... |
[
{
"role": "user",
"content": "Show the number of employees in each department."
},
{
"role": "assistant",
"content": "SELECT department, COUNT(*) AS employee_count\nFROM financial_services.employees\ngroup BY department;"
},
{
"role": "user",
"content": "Exclude departments that have... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba... |
[
{
"role": "user",
"content": "Show me wallet addresses that hold more than 1000 of any ERC1155 token, along with the token ID and contract address."
},
{
"role": "assistant",
"content": "SELECT wallet_address, token_id, contract_address FROM erc20_balances WHERE CAST(amount AS decimal) > 1000;"
... | You are an SQL statement expert. Given the table 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": "Show me the number of vehicles for each make in the system."
},
{
"role": "assistant",
"content": "SELECT make, COUNT(*) AS vehicle_count\nFROM transportation.vehicles\nGROUP BY make"
},
{
"role": "user",
"content": "Now, only show makes that have more t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles ( vehicle_id text, license_plate text, vin text, make text, model text, year integer, type text... |
[
{
"role": "user",
"content": "Retrieve the number of claim documents uploaded by each user. Show uploaded_by and the document count."
},
{
"role": "assistant",
"content": "SELECT uploaded_by, COUNT(document_id) AS document_count\nFROM insurance.claim_documents\nGROUP BY uploaded_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 insurance.claims (
claim_id character varying(64) NOT NULL, -- unique identifier for the claim
policy_id charac... |
[
{
"role": "user",
"content": "Show me properties that have more than 10 service orders delivered in the last month. Include the property_name and the number of delivered orders."
},
{
"role": "assistant",
"content": "SELECT p.property_name,\n COUNT(o.order_id) AS delivered_orders\nFROM hos... | You are an SQL statement expert. Given the table 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": "How many unique user_ids are there in the wallets table?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT user_id) AS unique_users FROM blockchain.wallets;"
},
{
"role": "user",
"content": "Now, show me the top 5 user_ids with the highest num... | You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the wallet
user_id cha... |
[
{
"role": "user",
"content": "Retrieve all prescriptions linked to chronic diagnoses. Show prescription_id, diagnosis_id, diagnosis_code, and prescription_date."
},
{
"role": "assistant",
"content": "SELECT pr.prescription_id,\n d.diagnosis_id,\n d.diagnosis_code,\n pr.prescrip... | You are an SQL statement expert. Given the table 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 the document IDs and expiry dates for all documents that have not yet been verified."
},
{
"role": "assistant",
"content": "SELECT document_id, expiry_date \nFROM government_services.documents \nWHERE verification_status = 'Pending';"
}
] | You are an SQL statement expert. Given the table 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.applications ( application_id text, citizen_id text, service_id text, submitted_at timestamp, statu... |
[
{
"role": "user",
"content": "What's the average session duration and average score per game genre?"
},
{
"role": "assistant",
"content": "SELECT g.genre,\n AVG(gs.duration_seconds) AS avg_duration,\n AVG(gs.score) AS avg_score\nFROM gaming_technology.game_sessions gs\nJOIN gaming_te... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "For each user, list their order_id, order_type, and any log messages they have generated."
},
{
"role": "assistant",
"content": "SELECT\n o.user_id,\n o.order_id,\n o.order_type,\n l.action AS log_message\nFROM trading_platform.orders o\nJOIN trading_platform.lo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan... |
[
{
"role": "user",
"content": "Show me all documents along with the document name and type, together with both the upload_timestamp and the lawyer ID who uploaded them."
},
{
"role": "assistant",
"content": "SELECT document_id, document_name, document_type, upload_timestamp, uploaded_by_lawyer_id... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... |
[
{
"role": "user",
"content": "Show me, for each item, the total number of times it has been acquired and the earliest date it was acquired. Also, show the number of unique players who have acquired each item."
},
{
"role": "assistant",
"content": "SELECT item_id, COUNT(*) AS total_acquisitions, ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, ite... |
[
{
"role": "user",
"content": "How many distinct users have ever participated in a conversation?"
},
{
"role": "assistant",
"content": "SELECT COUNT(DISTINCT user_id) AS distinct_participant_count\nFROM social_media.conversation_participants;"
}
] | You are an SQL statement expert. Given the table 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.follows ( follow_id.text, follower_user_id.text, following_user_id.text, created_at.timestamp )
CREATE TAB... |
[
{
"role": "user",
"content": "List all ERC20 tokens from the `token_metas` table that have a total supply greater than 1 followed by 21 zeros. Show their contract address, symbol, name, and total supply."
},
{
"role": "assistant",
"content": "SELECT contract_address, symbol, name, total_supply F... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add... |
[
{
"role": "user",
"content": "List the names and cities of all service locations, along with the agency ID, where the locations are marked as accessible."
},
{
"role": "assistant",
"content": "SELECT location_name, city, agency_id FROM government_services.service_locations WHERE is_accessible = ... | You are an SQL statement expert. Given the table 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.service_locations (
location_id character varying(64) NOT NULL, -- unique identifier for the ph... |
[
{
"role": "user",
"content": "Show me each law firm's ID, name, managing_partner_id, and the number of appointments scheduled with that managing partner."
},
{
"role": "assistant",
"content": "SELECT f.firm_id, \n f.firm_name, \n f.managing_partner_id, \n COUNT(a.appointment_id... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "I need to find pairs of players who share the same email domain. For each pair, return player1_id, player2_id, and the shared domain."
},
{
"role": "assistant",
"content": "SELECT p1.player_id AS player1_id,\n p2.player_id AS player2_id,\n LOWER(SPLIT_PA... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt... |
[
{
"role": "user",
"content": "For each achievement, can you list its name, the corresponding game's title, and the total number of players who have unlocked it?"
},
{
"role": "assistant",
"content": "SELECT a.name AS achievement_name, g.title AS game_title, COUNT(pa.player_id) AS unlock_count\nF... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid, title text, developer_id uuid, publisher_id uuid, genre text, release_date date... |
[
{
"role": "user",
"content": "Show me all transfer activities for the token tick 'PEPE', including the sender, receiver, and amount."
},
{
"role": "assistant",
"content": "SELECT from_address, to_address, amt FROM token_activities WHERE tick = 'PEPE' AND type = 'transfer'"
},
{
"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 erc20_balances ( block_number bigint, contract_address text, wallet_address text, amount text, pk text )
CREATE TABLE n... |
[
{
"role": "user",
"content": "Find pairs of products with the same product_type but different is_active statuses. Include product_type, active product_id, active product_name, inactive product_id, and inactive product_name."
},
{
"role": "assistant",
"content": "SELECT\n p_active.product_type,\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.insurance_products (
product_id character varying(64) NOT NULL, -- unique identifier for the insurance pr... |
[
{
"role": "user",
"content": "For each player and server pair, show the total number of game sessions they've had together and the sum of scores, ordered by total sessions descending."
},
{
"role": "assistant",
"content": "SELECT player_id, server_id, COUNT(*) AS total_sessions, SUM(score) AS to... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time... |
[
{
"role": "user",
"content": "Show the number of posts for each user."
},
{
"role": "assistant",
"content": "SELECT user_id, COUNT(*) AS post_count FROM social_media.posts GROUP BY user_id;"
},
{
"role": "user",
"content": "Only include users who have posted more than 10 times."
},... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts (
post_id character varying(64) NOT NULL, -- unique identifier for the post
user_id characte... |
[
{
"role": "user",
"content": "Show the document ID, document type, and upload timestamp for all documents uploaded by citizens who registered after January 1st, 2023."
},
{
"role": "assistant",
"content": "SELECT d.document_id, d.document_type, d.upload_timestamp FROM government_services.documen... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.documents ( document_id text, application_id text, citizen_id text, document_type text, file_refere... |
[
{
"role": "user",
"content": "Find all pairs of inventory entries where the same player acquired the same item twice. Show the player_id, item_id, the earlier inventory_id as first_inv, and the later inventory_id as second_inv."
},
{
"role": "assistant",
"content": "SELECT p1.player_id,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid PRIMARY KEY, player_id uuid, item_id uuid, quantity int, acquire... |
[
{
"role": "user",
"content": "List all document names and their latest version numbers for each case."
},
{
"role": "assistant",
"content": "SELECT d.case_id, d.document_name, MAX(d.version) AS latest_version\nFROM legal_services.documents d\nGROUP BY d.case_id, d.document_name;"
},
{
"r... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.documents ( document_id.text, case_id.text, document_name.text, document_type.text, storage_path.text, u... |
[
{
"role": "user",
"content": "Calculate the total PNL and total Net Flow for all tokens recorded on the 'Arbitrum' chain."
},
{
"role": "assistant",
"content": "SELECT SUM(pnl) as total_pnl, SUM(net_flow) as total_net_flow FROM smart_money_token_performance WHERE chain = 'Arbitrum';"
},
{
... | You are an SQL statement expert. Given the table 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_token_performance ( token_address character varying(100) NOT NULL, token_symbol character varying(100), pnl... |
[
{
"role": "user",
"content": "Find all events where the data field contains 'amount' and show the event name, contract ID, and transaction ID, sorted by emitted timestamp."
},
{
"role": "assistant",
"content": "SELECT event_name, contract_id, transaction_id FROM web3.events WHERE data LIKE '%amo... | You are an SQL statement expert. Given the table 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.text, contract_id.text, event_name.text, data.text, emitted_at.timestamp, transaction_id.text, l... |
[
{
"role": "user",
"content": "List all staff members along with their direct manager's first and last names."
},
{
"role": "assistant",
"content": "SELECT s.staff_id,\n s.first_name AS staff_first_name,\n s.last_name AS staff_last_name,\n m.first_name AS manager_first_name,\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.staff ( staff_id character varying(64) NOT NULL, property_id character varying(64) NOT NULL, fir... |
[
{
"role": "user",
"content": "Show me each service order along with the next order placed by the same guest, including both order IDs and the time difference in minutes between the two orders."
},
{
"role": "assistant",
"content": "SELECT a.order_id,\n b.order_id AS next_order_id,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.service_orders ( order_id.text, reservation_id.text, guest_id.text, service_id.text, staff_id_or... |
[
{
"role": "user",
"content": "How many addresses have a realized_ratio below 0.5?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS address_count FROM smart_money_profit WHERE realized_ratio < 0.5;"
}
] | You are an SQL statement expert. Given the table 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": "Find smart money addresses that have a positive ROI but their realized profit ratio is less than 50%. List their address, ROI, and realized ratio, ordered by ROI in descending order."
},
{
"role": "assistant",
"content": "SELECT address, roi, realized_ratio FROM sma... | 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 smart_money_profit ( address character varying(100) NOT NULL, rank INT, profit numer... |
[
{
"role": "user",
"content": "List all policies that have a coverage_limit exactly equal to the deductible. Show policy_id, policy_number, coverage_limit, and deductible."
},
{
"role": "assistant",
"content": "SELECT policy_id, policy_number, coverage_limit, deductible\nFROM insurance.policies\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,... |
[
{
"role": "user",
"content": "For all scheduled appointments in the next 14 days, list the appointment ID, scheduled start time, the name of the service, and the standard fee."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, a.scheduled_start_time, s.service_name, s.standard_fee\n... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.services (
service_id character varying(64) NOT NULL, -- unique identifier for the service
... |
[
{
"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": "Show me the number of primary insurance policies per insurance provider, including the provider name and the count."
},
{
"role": "assistant",
"content": "SELECT ip.insurance_provider, COUNT(*) AS primary_policy_count\nFROM healthcare.patient_insurance pi\nJOIN heal... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number... |
[
{
"role": "user",
"content": "Can you write a query that retrieves each server's name, its region, and the highest current player count observed in that region?"
},
{
"role": "assistant",
"content": "SELECT s.server_name, s.region, m.max_current_players\nFROM gaming_technology.servers s\nJOIN (\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.servers ( server_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, server_name chara... |
[
{
"role": "user",
"content": "List all employees and their managers, showing the full name for both the employee and their manager."
},
{
"role": "assistant",
"content": "SELECT e.first_name || ' ' || e.last_name AS employee_name, m.first_name || ' ' || m.last_name AS manager_name FROM financial... | You are an SQL statement expert. Given the table 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, account_id character varying(64) NOT N... |
[
{
"role": "user",
"content": "List all users who have deployed contracts, along with their email addresses and the count of contracts they've deployed."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, COUNT(c.contract_id) AS contract_count FROM web3.users u JOIN web3.contracts c... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "For each payment method, show the total number of completed payments and the total amount paid."
},
{
"role": "assistant",
"content": "SELECT payment_method, COUNT(*) AS completed_count, SUM(amount) AS total_paid FROM government_services.payments WHERE status = 'Com... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.payments ( payment_id character varying(64) NOT NULL, application_id character varying(64), citizen... |
[
{
"role": "user",
"content": "List all developers founded before 2010 along with the number of games they have created."
},
{
"role": "assistant",
"content": "SELECT d.name, d.founded_year, COUNT(g.game_id) AS total_games\nFROM gaming_technology.developers d\nLEFT JOIN gaming_technology.games g ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea... |
[
{
"role": "user",
"content": "List all clients, showing their full name, email, and phone number."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email, phone FROM legal_services.clients;"
},
{
"role": "user",
"content": "Now, filter this list to include only cli... | You are an SQL statement expert. Given the table 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, -- unique identifier for the client
first_n... |
[
{
"role": "user",
"content": "Show me all servers where current_players is 0, and include their server_id, server_name, and region."
},
{
"role": "assistant",
"content": "SELECT server_id, server_name, region FROM gaming_technology.servers WHERE current_players = 0;"
},
{
"role": "user",... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.servers ( server_id uuid, game_id uuid, server_name text, region text, ip_address text, port integer,... |
[
{
"role": "user",
"content": "For each token listed in token_dexpool_info, can you show the total net_flow and average ROI from smart_money_token_performance, along with the token's symbol and chain?"
},
{
"role": "assistant",
"content": "SELECT tdi.token_symbol, tdi.chain, SUM(sm.net_flow) AS 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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "List all unique document types along with the count of documents for each type."
},
{
"role": "assistant",
"content": "SELECT document_type, COUNT(*) AS document_count FROM legal_services.documents GROUP BY document_type;"
},
{
"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 legal_services.documents ( document_id text, case_id text, document_name text, document_type text, storage_path text, u... |
[
{
"role": "user",
"content": "List the names and descriptions of all DApps."
},
{
"role": "assistant",
"content": "SELECT name, description FROM trading_platform.dapps;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.utxos ( utxo_id text, transaction_id text, output_index integer, address text, amount numeric, spent b... |
[
{
"role": "user",
"content": "For each wallet that currently holds more than 5000 units of any ERC20 token, show the wallet address and contract address."
},
{
"role": "assistant",
"content": "SELECT contract_address, wallet_address, CAST(amount AS numeric) AS amount\nFROM erc20_balances\nWHERE ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc20_balances ( block_number bigint NOT NULL, contract_address varchar NOT NULL, wallet_address varchar NOT NULL, amou... |
[
{
"role": "user",
"content": "Show me all active policies with coverage limits above $1,000,000, along with their customer IDs and agent IDs."
},
{
"role": "assistant",
"content": "SELECT policy_id, customer_id, agent_id, coverage_limit FROM insurance.policies WHERE status = 'active' AND coverag... | You are an SQL statement expert. Given the table 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": "List all staff members who processed payments for guest ID 'G123', including their first name, last name, and the payment ID."
},
{
"role": "assistant",
"content": "SELECT T1.first_name, T1.last_name, T2.payment_id FROM staff AS T1 JOIN payments AS T2 ON T1.staff_id... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.staff ( staff_id text PRIMARY KEY, property_id text, first_name text, last_name text, position t... |
[
{
"role": "user",
"content": "Show me a list of all patient names along with the full names of their doctors for appointments scheduled in February 2024."
},
{
"role": "assistant",
"content": "SELECT p.first_name AS patient_first_name, p.last_name AS patient_last_name, d.first_name AS doctor_fir... | You are an SQL statement expert. Given the table 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 policies where the total percentage share of beneficiaries exceeds 100%, along with the policy IDs and the sum of percentage shares."
},
{
"role": "assistant",
"content": "SELECT policy_id, SUM(percentage_share) AS total_percentage FROM insurance.policy_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text... |
[
{
"role": "user",
"content": "Retrieve all users and their associated wallet identifiers."
},
{
"role": "assistant",
"content": "SELECT T1.username , T2.wallet_id FROM blockchain.users AS T1 JOIN blockchain.wallets AS T2 ON T1.user_id = T2.user_id"
},
{
"role": "user",
"content": ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.nodes (
node_id character varying(64) NOT NULL, -- unique identifier for the node
ip_address charac... |
[
{
"role": "user",
"content": "How many active insurance policies are there for each plan_id? Show plan_id and active_count."
},
{
"role": "assistant",
"content": "SELECT plan_id,\n COUNT(*) AS active_count\nFROM healthcare.patient_insurance\nWHERE expiration_date IS NULL OR expiration_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 healthcare.patient_insurance ( patient_insurance_id.text, patient_id.text, plan_id.text, policy_number.text, group_numb... |
[
{
"role": "user",
"content": "List all securities (security_id, ticker_symbol, security_name) that are traded on the NASDAQ exchange and have a daily trading volume exceeding 1 million shares, along with the employee details (employee_id, first_name, last_name) who last updated these securities."
},
{
... | You are an SQL statement expert. Given the table 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, customer_id text, account_number text, account_type text, balance numeri... |
[
{
"role": "user",
"content": "List all pairs of clients who registered in the same month and year. Show both clients’ first and last names, plus the month and year they share."
},
{
"role": "assistant",
"content": "SELECT c1.first_name AS first_name_1,\n c1.last_name AS last_name_1,... | You are an SQL statement expert. Given the table 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, -- unique identifier for the client
first_n... |
[
{
"role": "user",
"content": "Count the number of smart contracts deployed for each unique creator address."
},
{
"role": "assistant",
"content": "SELECT creator_address, COUNT(*) FROM blockchain.smart_contracts GROUP BY creator_address;"
},
{
"role": "user",
"content": "Show me only... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.smart_contracts ( contract_id.text, creator_address.text, code.text, timestamp.timestamp )
|
[
{
"role": "user",
"content": "List the full names and email addresses of staff members who have delivered at least one service order in the past 30 days, along with the count of orders they delivered. Sort by count descending."
},
{
"role": "assistant",
"content": "SELECT st.staff_id,\n st... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.staff ( staff_id text, property_id text, first_name text, last_name text, position text, work_em... |
[
{
"role": "user",
"content": "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": "Show me the total number of reservations for each property along with the property's name."
},
{
"role": "assistant",
"content": "SELECT p.property_id, p.property_name, COUNT(r.reservation_id) AS reservation_count\nFROM hospitality_technology.properties p\nLEFT JOIN... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2... |
[
{
"role": "user",
"content": "List all NFT collections and their current floor price."
},
{
"role": "assistant",
"content": "SELECT name, floor_price FROM nft_collections"
},
{
"role": "user",
"content": "Also include the number of tokens in each collection."
},
{
"role": "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 erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ... |
[
{
"role": "user",
"content": "Show me the top 5 token balances by amount for wallet '0xabc123abcdef' in the erc20_balances table."
},
{
"role": "assistant",
"content": "SELECT contract_address, amount\nFROM erc20_balances\nWHERE wallet_address = '0xabc123abcdef'\nORDER BY CAST(amount AS numeric)... | You are an SQL statement expert. Given the table 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_timestamp timestamp(3) NOT NULL, transaction_index integ... |
[
{
"role": "user",
"content": "Show the case number, case name, and the full name of the lead lawyer, along with the total hours spent on each case."
},
{
"role": "assistant",
"content": "SELECT c.case_number, c.case_name, CONCAT(l.first_name, ' ', l.last_name) AS lead_lawyer_name, COALESCE(SUM(t... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.lawyers ( lawyer_id text PRIMARY KEY, first_name text, last_name text, bar_number text UNIQUE, firm_id t... |
[
{
"role": "user",
"content": "List the total number of maintenance logs and the average cost for each service_type."
},
{
"role": "assistant",
"content": "SELECT service_type, COUNT(*) AS log_count, AVG(cost) AS avg_cost\nFROM transportation.maintenance_logs\nGROUP BY service_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 transportation.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "Which exchanges hold the highest total USD value of tokens on the Ethereum chain, and what are their top 3 tokens by USD value?"
},
{
"role": "assistant",
"content": "SELECT exchange, token_symbol, usd_value FROM (SELECT exchange, token_symbol, usd_value, ROW_NUMBER... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE cex_token_balance ( snapshot_time text, chain text, address text, exchange text, token_address text, token_symbol text,... |
[
{
"role": "user",
"content": "Show the names and policy numbers of all insured patients whose policy is currently expired."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, pi.policy_number, pi.expiration_date\nFROM healthcare.patients p\nJOIN healthcare.patient_insurance ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients (
patient_id character varying(64) NOT NULL, -- unique identifier for the patient
first_na... |
[
{
"role": "user",
"content": "Show me the top 5 Sui NFT collections with the highest number of unique owners, along with their names and collection types."
},
{
"role": "assistant",
"content": "SELECT name, collection_type, COUNT(DISTINCT owner) AS unique_owners FROM sui_nfts WHERE owner IS NOT ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE erc1155_approval_for_all ( block_number.bigint, block_timestamp.timestamp, transaction_index.integer, transaction_hash.... |
[
{
"role": "user",
"content": "List all players and the number of distinct games they have grabbed in-game items from, as well as the name of each game."
},
{
"role": "assistant",
"content": "SELECT p.player_id, p.username, g.game_id, g.title, COUNT(DISTINCT pi.item_id) AS distinct_items_acquired... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat... |
[
{
"role": "user",
"content": "Which agencies have at least one service with a standard fee equal to zero? Show the agency name and the service name."
},
{
"role": "assistant",
"content": "SELECT a.agency_name, s.service_name\nFROM government_services.agencies a\nJOIN government_services.services... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE government_services.agencies ( agency_id character varying(64) NOT NULL, agency_name character varying(255) NOT NULL, j... |
[
{
"role": "user",
"content": "For each contract that has deployed tokens, show the contract address, the name and symbol of each token it deployed, and the deployment status of the contract."
},
{
"role": "assistant",
"content": "SELECT c.address AS contract_address, t.token_name, 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 character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL... |
[
{
"role": "user",
"content": "Find all distinct pairs of customers having the same first_name but living in different cities. Display a.customer_id, a.first_name, a.city AS city_a, b.customer_id, b.city AS city_b."
},
{
"role": "assistant",
"content": "SELECT a.customer_id AS customer_id_a,\n ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.