conversations listlengths 2 8 | system stringlengths 276 8.4k |
|---|---|
[
{
"role": "user",
"content": "List properties and the average base rate of their room types."
},
{
"role": "assistant",
"content": "SELECT T1.property_name , AVG(T2.base_rate) FROM hospitality_technology.properties AS T1 JOIN hospitality_technology.room_types AS T2 ON T1.property_id = T2.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.room_types (
room_type_id character varying(64) NOT NULL, -- unique identifier for the room ... |
[
{
"role": "user",
"content": "Show me all addresses with a balance greater than 1000, ordered by balance in descending order."
},
{
"role": "assistant",
"content": "SELECT address_id, public_key, balance FROM blockchain.addresses WHERE balance > 1000 ORDER BY balance DESC;"
},
{
"role": ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.addresses (
address_id character varying(128) NOT NULL, -- unique identifier for the address
public... |
[
{
"role": "user",
"content": "Show me all loans and the type of account each loan is associated with. Include the loan ID and the account type."
},
{
"role": "assistant",
"content": "SELECT l.loan_id, a.account_type FROM financial_services.loans l JOIN financial_services.accounts a ON l.account_... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac... |
[
{
"role": "user",
"content": "Show me all maintenance logs for 'Oil Change' services performed in the last 3 months, including the vehicle ID, service date, and cost."
},
{
"role": "assistant",
"content": "SELECT vehicle_id, service_date, cost FROM transportation.maintenance_logs WHERE service_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.maintenance_logs (
log_id character varying(64) NOT NULL, -- unique identifier for the maintenance ... |
[
{
"role": "user",
"content": "List payment records in USD including guest names and processing staff names."
},
{
"role": "assistant",
"content": "SELECT p.payment_id,\n p.amount,\n p.currency_code,\n g.guest_name,\n s.staff_name\nFROM hospitality_technology.payments p\nJ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ... |
[
{
"role": "user",
"content": "Show me all smart contracts created by addresses that have created more than 5 contracts, along with the count of contracts each creator has made."
},
{
"role": "assistant",
"content": "SELECT sc.contract_id, sc.creator_address, COUNT(*) OVER (PARTITION BY sc.creato... | You are an SQL statement expert. Given the table 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": "Show me the top 3 smart money token inflows by USD value where the trade type is buying (type = 1), including the token symbol and narrative."
},
{
"role": "assistant",
"content": "SELECT token_symbol, narrative, usd_value FROM smart_money_token_inflow WHERE 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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i... |
[
{
"role": "user",
"content": "能否帮我查询特定列车(train_id 为 'train_789')上的所有车辆信息,并关联到该列车所在的路线信息?"
},
{
"role": "assistant",
"content": "SMEMBERS train:train_789:cars\nHGETALL car:<car_id> for each car_id in result\nHGETALL train:train_789\nSMEMBERS schedule:sched_1122:bookings\nHGETALL booking:<booking_... | 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 to store station details. Key format: station:<station_id>
// Example:
// HSET stat... |
[
{
"role": "user",
"content": "List all pairs of locations within the same state_province where the two locations are of different types. For each pair, show the first location's name, type, city, and the second location's name, type, city, and their shared state_province."
},
{
"role": "assistant",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.locations (
location_id character varying(64) NOT NULL, -- unique identifier for the location
n... |
[
{
"role": "user",
"content": "Show me the content and ID of all posts that have received a like, along with the username of each user who liked the post."
},
{
"role": "assistant",
"content": "SELECT\n P.post_id,\n P.content,\n U.username\nFROM\n social_media.posts AS P\nJOIN\n so... | You are an SQL statement expert. Given the table 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": "How many unique items does each player have in their inventory right now?"
},
{
"role": "assistant",
"content": "SELECT player_id, COUNT(DISTINCT item_id) AS unique_items FROM gaming_technology.player_inventory GROUP BY player_id;"
},
{
"role": "user",
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.player_inventory ( inventory_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, ite... |
[
{
"role": "user",
"content": "Which users have participated in conversations that are not group chats? Please show their usernames and the conversation IDs."
},
{
"role": "assistant",
"content": "SELECT u.username, cp.conversation_id\nFROM social_media.conversation_participants cp\nJOIN social_m... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "Which users have sent messages in private conversations? Please show their usernames and the conversation IDs."
},
{
"role": "assistant",
"content": "SELECT DISTINCT u.username, m.conversation_id\nFROM social_media.messages m\nJOIN social_media.users u ON m.sender_u... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t... |
[
{
"role": "user",
"content": "List pairs of law firms that are located at the same address. Display the names of both firms and the shared address, ensuring the address is not null."
},
{
"role": "assistant",
"content": "SELECT\n t1.firm_name AS firm1_name,\n t2.firm_name AS firm2_name,\n 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.law_firms ( firm_id character varying(64) NOT NULL, firm_name character varying(200) NOT NULL, address t... |
[
{
"role": "user",
"content": "Count how many follow relationships were created in June 2024."
},
{
"role": "assistant",
"content": "SELECT COUNT(follow_id) FROM social_media.follows WHERE created_at >= '2024-06-01' AND created_at < '2024-07-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.posts ( post_id text, user_id text, content text, media_url text, media_type text, created_at timestamp, u... |
[
{
"role": "user",
"content": "Which five companies have the most clients, and how many clients does each have?"
},
{
"role": "assistant",
"content": "SELECT company_name, COUNT(*) AS client_count\nFROM legal_services.clients\nGROUP BY company_name\nORDER BY client_count DESC\nLIMIT 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 legal_services.clients (
client_id character varying(64) NOT NULL, -- unique identifier for the client
first_n... |
[
{
"role": "user",
"content": "Show me service orders and any associated review comments for reservation ID 'RES007'. List the order ID, service ID, quantity, total price from the order, and the review comment if available."
},
{
"role": "assistant",
"content": "SELECT so.order_id, so.service_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.rooms ( room_id text PRIMARY KEY, property_id text, room_number text, room_type_id text, floor i... |
[
{
"role": "user",
"content": "I need a list of patients along with their chronic diagnosis codes and diagnosis dates."
},
{
"role": "assistant",
"content": "SELECT p.first_name, p.last_name, d.diagnosis_code, d.diagnosis_date FROM healthcare.patients p JOIN healthcare.diagnoses d ON p.patient_id... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "List each public post's ID and the count of notifications it has received. Only consider notifications where target_entity_type is 'post'."
},
{
"role": "assistant",
"content": "SELECT p.post_id, COUNT(n.notification_id) AS notification_count\nFROM social_media.post... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.posts ( post_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, content text, medi... |
[
{
"role": "user",
"content": "For each user, list all pairs of read and unread notifications, showing the recipient_user_id, the unread notification_id and type, and the read notification_id and type."
},
{
"role": "assistant",
"content": "SELECT\n n_unread.recipient_user_id,\n n_unread.notifi... | You are an SQL statement expert. Given the table 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.notifications ( notification_id character varying(64) NOT NULL, recipient_user_id character varying(64) NO... |
[
{
"role": "user",
"content": "List all public reviews from the past 30 days with the property name and overall rating."
},
{
"role": "assistant",
"content": "SELECT r.review_id, p.property_name, r.rating_overall, r.review_date\nFROM hospitality_technology.reviews AS r\nJOIN hospitality_technolog... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "Show me each guest's full name and the number of unique properties they have made reservations for."
},
{
"role": "assistant",
"content": "SELECT g.first_name || ' ' || g.last_name AS full_name,\n COUNT(DISTINCT r.property_id) AS property_count\nFROM hospitali... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO... |
[
{
"role": "user",
"content": "What are the average liquidity and price of tokens on the BSC chain?"
},
{
"role": "assistant",
"content": "SELECT AVG(liquidity) AS avg_liquidity, AVG(price) AS avg_price FROM token_dexpool_info WHERE chain = 'BSC';"
},
{
"role": "user",
"content": "Can... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexpool token_name character varying(10... |
[
{
"role": "user",
"content": "Show me the details of tokens in the token_info_avalanche table that have the tick 'AVAX'."
},
{
"role": "assistant",
"content": "SELECT * FROM token_info_avalanche WHERE tick = 'AVAX';"
},
{
"role": "user",
"content": "Okay, now refine that. Just show m... | 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(6) NOT NULL, block_number bigint NOT NULL, t... |
[
{
"role": "user",
"content": "For each fundraising round, what is the average valuation of the participating projects? Show the round name and the average valuation."
},
{
"role": "assistant",
"content": "SELECT rounds_name, AVG(valuation) AS avg_valuation FROM project_fundraising_record WHERE v... | You are an SQL statement expert. Given the table 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": "For each user, retrieve their first and last log actions along with the respective timestamps."
},
{
"role": "assistant",
"content": "SELECT t.user_id,\n lf.action AS first_action,\n lf.logged_at AS first_time,\n ll.action AS last_action,\n l... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.logs ( log_id text PRIMARY KEY, user_id text, action text, details text, logged_at timestamp )
|
[
{
"role": "user",
"content": "List the user IDs of all private profiles who last updated their settings in 2024."
},
{
"role": "assistant",
"content": "SELECT user_id FROM social_media.user_settings WHERE private_profile = true AND updated_at >= '2024-01-01' AND updated_at < '2025-01-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.user_settings ( setting_id text, user_id text, theme text, email_notifications_enabled boolean, push_notif... |
[
{
"role": "user",
"content": "List all staff members who have an access level greater than 3, showing their staff ID, first name, and last name."
},
{
"role": "assistant",
"content": "SELECT staff_id, first_name, last_name FROM hospitality_technology.staff WHERE access_level > 3;"
},
{
"... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.rooms ( room_id text, property_id text, room_number text, room_type_id text, floor integer, stat... |
[
{
"role": "user",
"content": "Show me asset IDs and DApp names for metadata entries linking assets to DApps where metadata.value matches a dapp_id."
},
{
"role": "assistant",
"content": "SELECT m.asset_id, d.name AS dapp_name\nFROM trading_platform.metadata m\nJOIN trading_platform.dapps d\n 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 trading_platform.wallets ( wallet_id character varying(64) NOT NULL, user_id character varying(64) NOT NULL, address ch... |
[
{
"role": "user",
"content": "List the first and last names of all doctors whose email address ends with '@hospital.org'."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name FROM healthcare.doctors WHERE email LIKE '%@hospital.org';"
}
] | You are an SQL statement expert. Given the table 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": "For each trip, show the route number, origin location id, destination location id, and the number of passengers."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, r.route_number, t.origin_location_id, t.destination_location_id, t.passenger_count\nFROM transpo... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "For each claim, show the claim ID, policy ID, and the product name of the insurance product that applies to the policy."
},
{
"role": "assistant",
"content": "SELECT c.claim_id, c.policy_id, ip.product_name FROM insurance.claims c JOIN insurance.insurance_products i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.claims ( claim_id text PRIMARY KEY, policy_id text, customer_id text, incident_date timestamp, reported_date ... |
[
{
"role": "user",
"content": "Give me the case_id and the count of appointments and documents for each case where at least one appointment exists."
},
{
"role": "assistant",
"content": "SELECT a.case_id, COUNT(DISTINCT a.appointment_id) AS appointment_count, COUNT(DISTINCT d.document_id) AS 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": "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": "For each route, show the route number and the total number of trips associated with it."
},
{
"role": "assistant",
"content": "SELECT T2.route_number, count(T1.trip_id) FROM transportation.trips AS T1 JOIN transportation.routes AS T2 ON T1.route_id = T2.route_id GRO... | You are an SQL statement expert. Given the table 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": "List the first name, last name, and contact email of all agents whose status is 'Active'."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, contact_email 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": "Show me all active agents who have a commission rate above 0.08, along with their agency names and the count of claims they've handled."
},
{
"role": "assistant",
"content": "SELECT a.agent_id, a.first_name, a.last_name, a.agency_name, a.commission_rate, COUNT(cl.cl... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE insurance.customers ( customer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name... |
[
{
"role": "user",
"content": "Show all token transfers where the token was created by a contract with status 'active'. Include transfer ID, token symbol, value, and the contract address."
},
{
"role": "assistant",
"content": "SELECT tt.transfer_id, tk.token_symbol, tt.value, tk.contract_address\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,... |
[
{
"role": "user",
"content": "What is the average total_supply for each decimals value?"
},
{
"role": "assistant",
"content": "SELECT decimals,\n AVG(total_supply) AS avg_total_supply\nFROM web3.tokens\nGROUP BY decimals;"
},
{
"role": "user",
"content": "Actually, I only want ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.tokens ( token_id text PRIMARY KEY, contract_address text, token_name text, token_symbol text, decimals int, total... |
[
{
"role": "user",
"content": "Show me all contracts deployed on the 'ethereum' network along with their deployer addresses and deployment timestamps, sorted by the most recent deployments first."
},
{
"role": "assistant",
"content": "SELECT address, deployer_address, deployed_at FROM web3.contra... | You are an SQL statement expert. Given the table 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": "Provide a list of all drivers and for each, show their driver_id, full name, the total number of completed trips they've driven, and the sum of all fares from bookings on those completed trips. Include drivers even if they have no completed trips. Order by total_fares descendin... | You are an SQL statement expert. Given the table 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": "List all fuel logs for vehicle 'VHCL123', showing the fuel type, quantity, and log timestamp."
},
{
"role": "assistant",
"content": "SELECT fuel_type, quantity, log_timestamp FROM transportation.fuel_logs WHERE vehicle_id = 'VHCL123';"
},
{
"role": "user",
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.fuel_logs ( fuel_log_id text, vehicle_id text, trip_id text, log_timestamp timestamp, fuel_type text, qu... |
[
{
"role": "user",
"content": "I need the average close_price per sector for the last month."
},
{
"role": "assistant",
"content": "SELECT s.sector, AVG(m.close_price) AS avg_close_price\nFROM financial_services.market_data m\nJOIN financial_services.securities s ON m.security_id = s.security_id\... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.market_data ( data_point_id bigserial NOT NULL, security_id character varying(64) NOT NULL, data_tim... |
[
{
"role": "user",
"content": "List pairs of game titles in the same genre but developed by different developers."
},
{
"role": "assistant",
"content": "SELECT g1.title AS game1_title,\n g2.title AS game2_title,\n g1.genre\nFROM gaming_technology.games g1\nJOIN gaming_technology.games... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date... |
[
{
"role": "user",
"content": "List all trades for asset 'BTC' where the trade quantity is greater than 5."
},
{
"role": "assistant",
"content": "SELECT trade_id, order_id, buyer_id, seller_id, quantity, price, traded_at FROM trading_platform.trades WHERE asset_id = 'BTC' AND quantity > 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 trading_platform.trades ( trade_id character varying(64) NOT NULL, order_id character varying(64) NOT NULL, buyer_id ch... |
[
{
"role": "user",
"content": "Show me the usernames and emails of all users who have placed at least one 'buy' order for the asset named 'Bitcoin'."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T1.username, T1.email FROM trading_platform.users AS T1 JOIN trading_platform.orders 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 trading_platform.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp ... |
[
{
"role": "user",
"content": "List all insurance plan names and their providers where the website is not null and the plan_type is 'HMO'."
},
{
"role": "assistant",
"content": "SELECT plan_name, insurance_provider\nFROM healthcare.insurance_plans\nWHERE website IS NOT NULL\n AND plan_type = 'HM... | You are an SQL statement expert. Given the table 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": "Count how many medications each manufacturer provides."
},
{
"role": "assistant",
"content": "SELECT manufacturer, COUNT(*) FROM healthcare.medications GROUP BY manufacturer;"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id character varying(64) NOT NULL, medication_name character varying(255) NOT NULL,... |
[
{
"role": "user",
"content": "Provide a report of each user with their username and the count of all log entries from the last 30 days."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.username, COUNT(l.log_id) AS log_count\nFROM trading_platform.users u\nLEFT JOIN trading_platform.log... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE trading_platform.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username ch... |
[
{
"role": "user",
"content": "Show all diagnosis codes and descriptions for patients diagnosed by doctor 'doctor_789'."
},
{
"role": "assistant",
"content": "SELECT patient_id, diagnosis_code, description FROM healthcare.diagnoses WHERE doctor_id = 'doctor_789';"
},
{
"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 healthcare.diagnoses ( diagnosis_id.text, record_id.text, patient_id.text, doctor_id.text, diagnosis_code.text, code_ty... |
[
{
"role": "user",
"content": "How many drivers and passengers have email addresses ending with 'company.com'? Return the count for each group."
},
{
"role": "assistant",
"content": "SELECT 'drivers' AS role, COUNT(*) AS count\nFROM transportation.drivers\nWHERE email LIKE '%@company.com'\nUNION ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... |
[
{
"role": "user",
"content": "Can you provide the total number of accounts and the average balance for each account_type?"
},
{
"role": "assistant",
"content": "SELECT account_type, COUNT(*) AS total_accounts, AVG(balance) AS avg_balance\nFROM financial_services.accounts\nGROUP BY account_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 financial_services.accounts ( account_id.text, customer_id.text, account_number.text, account_type.text, balance.numeri... |
[
{
"role": "user",
"content": "List all rooms along with their room type name and features."
},
{
"role": "assistant",
"content": "SELECT T1.room_number, T2.type_name, T1.features FROM rooms AS T1 JOIN room_types AS T2 ON T1.room_type_id = T2.room_type_id"
},
{
"role": "user",
"conten... | You are an SQL statement expert. Given the table 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": "List all time entries that have not been billed. Include the entry ID, date worked, hours spent, and description."
},
{
"role": "assistant",
"content": "SELECT entry_id, date_worked, hours_spent, description FROM time_entries WHERE is_billed = 0;"
},
{
"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 legal_services.clients ( client_id.text, first_name.text, last_name.text, company_name.text, email.text, phone.text, ad... |
[
{
"role": "user",
"content": "Count how many diagnoses were recorded each month in 2024. Show the month (as the first day of the month) and the count."
},
{
"role": "assistant",
"content": "SELECT DATE_TRUNC('month', diagnosis_date)::date AS diagnosis_month, COUNT(*) FROM healthcare.diagnoses WH... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments (
appointment_id character varying(64) NOT NULL, -- unique identifier for the appointment
... |
[
{
"role": "user",
"content": "List all wallet addresses that hold any NFT currently. Show the wallet address and the count of distinct token IDs they hold."
},
{
"role": "assistant",
"content": "SELECT wallet_address, COUNT(DISTINCT token_id) FROM nft_holders GROUP BY wallet_address;"
},
{
... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t... |
[
{
"role": "user",
"content": "Can you provide the total investment amount and the number of projects for each fundraising round?"
},
{
"role": "assistant",
"content": "SELECT rounds_name, SUM(investment_value) AS total_investment, COUNT(DISTINCT project_name) AS project_count FROM project_fundra... | You are an SQL statement expert. Given the table 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 the first_name, last_name, and email of all clients whose email domain is 'gmail.com'."
},
{
"role": "assistant",
"content": "SELECT first_name, last_name, email FROM legal_services.clients WHERE SUBSTRING(email FROM POSITION('@' IN email) + 1) = 'gmail.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 legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad... |
[
{
"role": "user",
"content": "Give me a list of all unpaid invoices along with the first and last names of the clients and the issue date of each invoice."
},
{
"role": "assistant",
"content": "SELECT i.invoice_number, i.issue_date, c.first_name, c.last_name\nFROM legal_services.invoices i\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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Find pairs of distinct token transfers that occurred in the same transaction and were initiated by the same sender address. List the transaction ID, the common sender address, and both transfer IDs."
},
{
"role": "assistant",
"content": "SELECT\n t1.transaction_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 web3.token_transfers (
transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer
token... |
[
{
"role": "user",
"content": "Show me all business center services (category = 'Business Center') along with their property IDs and descriptions, where the service is available."
},
{
"role": "assistant",
"content": "SELECT service_name, property_id, description FROM hospitality_technology.servi... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.services (
service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ... |
[
{
"role": "user",
"content": "List all medical records created by doctor 'doc001' for patient 'pat456', displaying the record ID and record date."
},
{
"role": "assistant",
"content": "SELECT record_id, record_date\nFROM healthcare.medical_records\nWHERE doctor_id = 'doc001' AND patient_id = '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 healthcare.medical_records (
record_id character varying(64) NOT NULL, -- unique identifier for the medical record... |
[
{
"role": "user",
"content": "List all transactions where the recipient address is not specified (i.e., to_address is NULL), showing transaction_id, from_address, value, and block_number."
},
{
"role": "assistant",
"content": "SELECT transaction_id, from_address, value, block_number\nFROM web3.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 web3.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction
fr... |
[
{
"role": "user",
"content": "For each game, show the game title, the total duration of all sessions in seconds, and the average score."
},
{
"role": "assistant",
"content": "SELECT g.title, SUM(gs.duration_seconds) AS total_duration_seconds, AVG(gs.score) AS average_score FROM gaming_technology... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id.uuid, title.text, developer_id.uuid, publisher_id.uuid, genre.text, release_date.date... |
[
{
"role": "user",
"content": "Which drivers have licenses expiring before 2025-01-01, and what are their first and last names along with the license expiry date?"
},
{
"role": "assistant",
"content": "SELECT driver_id, first_name, last_name, license_expiry_date FROM transportation.drivers WHERE ... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens... |
[
{
"role": "user",
"content": "List all accounts opened in the last 18 months, including the account number, account type, and the full name of the customer."
},
{
"role": "assistant",
"content": "SELECT a.account_number, a.account_type, c.first_name, c.last_name, a.opened_date FROM financial_ser... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE financial_services.accounts (
account_id character varying(64) NOT NULL, -- unique identifier for the account
c... |
[
{
"role": "user",
"content": "How many passenger records were created in the year 2023?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) FROM transportation.passengers WHERE EXTRACT(YEAR FROM created_at) = 2023;"
},
{
"role": "user",
"content": "What about the number of passeng... | You are an SQL statement expert. Given the table 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.passengers (
passenger_id character varying(64) NOT NULL, -- unique identifier for the passenger
... |
[
{
"role": "user",
"content": "Show me the average difficulty for blocks that have a previous block versus those that don't have a previous block."
},
{
"role": "assistant",
"content": "SELECT CASE WHEN previous_block_id IS NULL THEN 'No Previous Block' ELSE 'Has Previous Block' END AS block_type... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta... |
[
{
"role": "user",
"content": "What is the average daily trading volume for each security_id in the market_data table from the last 30 days, considering only data points where the close_price was higher than the open_price?"
},
{
"role": "assistant",
"content": "SELECT security_id, AVG(volume) 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 financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad... |
[
{
"role": "user",
"content": "Can you find all appointments where the duration is less than 20 minutes and the status is not 'Cancelled'? For each, show the appointment_id, appointment_time, status, and doctor_id."
},
{
"role": "assistant",
"content": "SELECT appointment_id, appointment_time, 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 healthcare.appointments (
appointment_id character varying(64) NOT NULL, -- unique identifier for the appointment
... |
[
{
"role": "user",
"content": "Show me all users who have placed orders but have no trades, along with their order count and average order quantity."
},
{
"role": "assistant",
"content": "SELECT u.user_id, u.email, COUNT(o.order_id) AS order_count, AVG(o.quantity) AS avg_order_quantity FROM tradi... | You are an SQL statement expert. Given the table 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": "How many rooms are there on each floor?"
},
{
"role": "assistant",
"content": "SELECT floor, COUNT(*) FROM hospitality_technology.rooms GROUP BY floor"
},
{
"role": "user",
"content": "Only show floors with more than 10 rooms."
},
{
"role": "assi... | You are an SQL statement expert. Given the table 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": "Find all wallets that were created by users with IDs starting with 'admin_' and show their addresses along with creation timestamps."
},
{
"role": "assistant",
"content": "SELECT address, created_at FROM web3.wallets WHERE user_id LIKE 'admin_%';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp )
|
[
{
"role": "user",
"content": "Show me the count of documents uploaded by each lawyer. Display the uploader ID and the total count of documents."
},
{
"role": "assistant",
"content": "SELECT uploaded_by_lawyer_id, COUNT(*) AS document_count FROM documents GROUP BY 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 all users who registered with a Gmail email address, along with their usernames and registration dates."
},
{
"role": "assistant",
"content": "SELECT username, email FROM blockchain.users WHERE email LIKE '%@gmail.com';"
},
{
"role": "user",
"con... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE blockchain.users ( user_id text, username text, email text, password_hash text )
|
[
{
"role": "user",
"content": "List all properties located in the USA with a star rating of 4.0 or higher, along with their city and property type."
},
{
"role": "assistant",
"content": "SELECT property_name, city, property_type, star_rating FROM hospitality_technology.properties WHERE country_co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE hospitality_technology.properties (
property_id character varying(64) NOT NULL, -- unique identifier for the prope... |
[
{
"role": "user",
"content": "For each completed trip, list the trip ID, the driver's full name, and the name of the origin location."
},
{
"role": "assistant",
"content": "SELECT t.trip_id, d.first_name || ' ' || d.last_name AS driver_name, l.name AS origin_location_name\nFROM transportation.tr... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE transportation.vehicles (
vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle
lice... |
[
{
"role": "user",
"content": "List the usernames of users who have commented on posts that are not replies to other comments."
},
{
"role": "assistant",
"content": "SELECT DISTINCT T2.username FROM social_media.comments AS T1 JOIN social_media.users AS T2 ON T1.user_id = T2.user_id WHERE T1.pare... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "How many likes has post 'P789' received in total?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*) AS total_likes\nFROM social_media.likes\nWHERE post_id = 'P789';"
}
] | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE social_media.users (
user_id character varying(64) NOT NULL, -- unique identifier for the user
username charac... |
[
{
"role": "user",
"content": "Find all pairs of transactions where both transactions have the same nonce and from_address, but different transaction_id. Show both transaction IDs, the shared from_address, shared nonce, and their block numbers."
},
{
"role": "assistant",
"content": "SELECT t1.tra... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE web3.transactions (
transaction_id character varying(64) NOT NULL, -- unique identifier for the transaction
fr... |
[
{
"role": "user",
"content": "Show me all diesel fuel logs where the quantity is more than 50 liters, including the vehicle_id, trip_id, and total_cost."
},
{
"role": "assistant",
"content": "SELECT fuel_log_id, vehicle_id, trip_id, total_cost FROM transportation.fuel_logs WHERE fuel_type = 'die... | You are an SQL statement expert. Given the table 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.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var... |
[
{
"role": "user",
"content": "Find all pairs of tokens that have the same contract_address but different token_symbols. Show both token_ids, each token's symbol, and the shared contract_address."
},
{
"role": "assistant",
"content": "SELECT t1.token_id AS token_id_1, t2.token_id AS token_id_2, 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 web3.tokens ( token_id text PRIMARY KEY, contract_address text, token_name text, token_symbol text, decimals int, total... |
[
{
"role": "user",
"content": "List all cases where the client and the lead lawyer belong to companies or law firms with the same phone number. For each such case, please show the case name, client name, client company, lead lawyer name, and the shared phone number."
},
{
"role": "assistant",
"co... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI... |
[
{
"role": "user",
"content": "Show prescription IDs, patient full names, and medication names for all active prescriptions of 'Atorvastatin'."
},
{
"role": "assistant",
"content": "SELECT pr.prescription_id, p.first_name || ' ' || p.last_name AS patient_name, m.medication_name FROM healthcare.pr... | You are an SQL statement expert. Given the table 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 all insurance plans where the plan_type is 'EPO', showing plan_id, plan_name, and insurance_provider."
},
{
"role": "assistant",
"content": "SELECT plan_id, plan_name, insurance_provider\nFROM healthcare.insurance_plans\nWHERE plan_type = 'EPO';"
}
] | You are an SQL statement expert. Given the table 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": "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": "For each maintenance log, find the upcoming scheduled service by matching next_service_due_date to another log's service_date. List the original log_id, the matching upcoming log_id, and both service_dates."
},
{
"role": "assistant",
"content": "SELECT l1.log_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 transportation.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser... |
[
{
"role": "user",
"content": "Show all prescription details for patient with ID 'patient_999'."
},
{
"role": "assistant",
"content": "SELECT * FROM healthcare.prescriptions WHERE patient_id = 'patient_999';"
},
{
"role": "user",
"content": "Filter this list to only include prescripti... | You are an SQL statement expert. Given the table 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.prescriptions ( prescription_id character varying(64) NOT NULL, record_id character varying(64) NOT NULL, pa... |
[
{
"role": "user",
"content": "How many hashtags are there whose tag_name contains 'tech'?"
},
{
"role": "assistant",
"content": "SELECT COUNT(*)\nFROM social_media.hashtags\nWHERE tag_name LIKE '%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 social_media.comments (
comment_id character varying(64) NOT NULL, -- unique identifier for the comment
post_id... |
[
{
"role": "user",
"content": "Find all medications whose generic_name matches the medication_name of another entry, displaying the brand medication_id, brand medication_name, generic medication_id, and generic medication_name."
},
{
"role": "assistant",
"content": "SELECT b.medication_id AS bran... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.medications ( medication_id.text, medication_name.text, generic_name.text, manufacturer.text, ndc_code.text,... |
[
{
"role": "user",
"content": "List all items that are currently owned by at least one player. Show the item ID and item name."
},
{
"role": "assistant",
"content": "SELECT DISTINCT t1.item_id, t1.item_name FROM gaming_technology.in_game_items AS t1 JOIN gaming_technology.player_inventory AS t2 O... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE gaming_technology.games ( game_id uuid PRIMARY KEY, title text, developer_id uuid, publisher_id uuid, genre text, relea... |
[
{
"role": "user",
"content": "List pairs of drivers whose license expiry dates fall within 30 days of each other. Show both driver_ids, names, and the two expiry dates."
},
{
"role": "assistant",
"content": "SELECT d1.driver_id AS driver1_id, d1.first_name AS driver1_first, d1.last_name AS drive... | You are an SQL statement expert. Given the table 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 all in-game items along with their rarity and the total number of times each item has been acquired by players."
},
{
"role": "assistant",
"content": "SELECT igi.item_name, igi.rarity, COALESCE(SUM(pi.quantity),0) AS total_acquired\nFROM gaming_technology.in... | You are an SQL statement expert. Given the table 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": "Show the names of all insurance plans and the number of patients enrolled in each plan."
},
{
"role": "assistant",
"content": "SELECT ip.plan_name, COUNT(pi.patient_id) AS enrolled_patients FROM healthcare.insurance_plans ip JOIN healthcare.patient_insurance pi ON i... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ... |
[
{
"role": "user",
"content": "List all pairs of time entries worked by the same lawyer on the same day but billed at different rates. Include both entry IDs, the lawyer_id, the date_worked, and each billing_rate."
},
{
"role": "assistant",
"content": "SELECT t1.entry_id AS entry1_id,\n t2.... | You are an SQL statement expert. Given the table 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": "Retrieve all notifications with status 'failed' along with the citizen's full name and contact_phone for those notifications that occurred in the past 30 days."
},
{
"role": "assistant",
"content": "SELECT n.notification_id,\n n.sent_at,\n n.status,\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.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d... |
[
{
"role": "user",
"content": "Find all events with the name 'Transfer' that were emitted in the last 24 hours, including their contract IDs and transaction IDs, sorted by emitted timestamp in descending order."
},
{
"role": "assistant",
"content": "SELECT event_id, contract_id, transaction_id, 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 web3.events ( event_id text PRIMARY KEY, contract_id text, event_name text, data text, emitted_at timestamp, transactio... |
[
{
"role": "user",
"content": "I need to find passengers who have a specific phone number prefix '+1555'. Can you help with that?"
},
{
"role": "assistant",
"content": "db.passengers.find({ phone_number: { $regex: '^\\+1555' } }, { first_name: 1, last_name: 1, phone_number: 1, email: 1, _id: 0 })... | You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement.
##Table Structure
// db.createCollection('passengers')
// Optional: db.passengers.createIndex({ passenger_id: 1 }, ... |
[
{
"role": "user",
"content": "List all user IDs that user 'user123' is following, including the date they started following."
},
{
"role": "assistant",
"content": "SELECT following_user_id, created_at FROM social_media.follows WHERE follower_user_id = 'user123';"
},
{
"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 social_media.follows ( follow_id text, follower_user_id text, following_user_id text, created_at timestamp )
|
[
{
"role": "user",
"content": "Show all appointments along with the related medical record's record_id and chief complaint, for appointments scheduled in June 2024."
},
{
"role": "assistant",
"content": "SELECT a.appointment_id, a.patient_id, a.doctor_id, a.appointment_time, mr.record_id, mr.chie... | You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question.
##Table Structure
CREATE TABLE healthcare.appointments ( appointment_id.text, patient_id.text, doctor_id.text, appointment_time.timestamp, duration_mi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.