conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "Can you list each player along with the number of rare items they currently have in their inventory, and also show the total quantity of these rare items?" }, { "role": "assistant", "content": "SELECT p.username, COUNT(DISTINCT pi.item_id) AS num_rare_items, COALESC...
You are an SQL statement expert. Given the table 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 product types that have both active and inactive products, list each pair of product IDs along with the shared product_type and their is_active statuses." }, { "role": "assistant", "content": "SELECT p1.product_id AS active_id, p2.product_id AS inactive_id, p1.p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "Show me the top 3 fundraising rounds by investment value in the last 6 months, including project name and valuation." }, { "role": "assistant", "content": "SELECT project_name, rounds_name, investment_value, valuation\nFROM project_fundraising_record\nWHERE investme...
You are an SQL statement expert. Given the table 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": "Find all properties in California (state_province = 'California') that have a phone number and email address listed." }, { "role": "assistant", "content": "SELECT property_name, city, phone_number, email_address FROM hospitality_technology.properties WHERE state_pro...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "Show me a list of cases, including the case number, case name, and the full name of the client associated with each case that has at least one appointment." }, { "role": "assistant", "content": "SELECT DISTINCT T1.case_number, T1.case_name, T2.first_name, T2.last_na...
You are an SQL statement expert. Given the table 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": "List all users whose email domain is 'gmail.com' and show their usernames and creation dates." }, { "role": "assistant", "content": "SELECT username, created_at FROM web3.users WHERE email LIKE '%@gmail.com' ORDER BY created_at;" }, { "role": "user", "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 web3.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp )
[ { "role": "user", "content": "List all SUI coins with status 'exists', including their coin_type, balance, and owner address." }, { "role": "assistant", "content": "SELECT object_id, coin_type, balance, owner\nFROM sui_coins\nWHERE status = 'exists';" }, { "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 token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "Count the total number of employees who have a direct manager assigned." }, { "role": "assistant", "content": "SELECT COUNT(employee_id) FROM government_services.employees WHERE manager_employee_id IS NOT NULL;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth...
[ { "role": "user", "content": "List all service orders, including the service name and quantity, along with the full name of the staff member who placed the order." }, { "role": "assistant", "content": "SELECT so.order_id, s.service_name, so.quantity, st.first_name, st.last_name FROM hospitality_...
You are an SQL statement expert. Given the table 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 the client ID, full name, and the total number of invoices they have received." }, { "role": "assistant", "content": "SELECT c.client_id, c.first_name, c.last_name, COUNT(i.invoice_id) AS invoice_count\nFROM legal_services.clients c\nLEFT JOIN legal_services.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 legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "List all staff members who were hired in the last year, including their position and hire date." }, { "role": "assistant", "content": "SELECT staff_id, first_name, last_name, position, hire_date FROM hospitality_technology.staff WHERE hire_date >= CURRENT_DATE - INT...
You are an SQL statement expert. Given the table 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, -- unique identifier for the staff member ...
[ { "role": "user", "content": "List all employees and the department their manager belongs to. Include the employee's full name." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, m.department AS manager_department FROM financial_services.employees AS e LEFT JOIN financial_s...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri...
[ { "role": "user", "content": "Show me all asset types along with the count of distinct assets and the count of log actions for each type." }, { "role": "assistant", "content": "SELECT a.type, COUNT(DISTINCT a.asset_id) AS asset_count, COUNT(l.log_id) AS action_count FROM trading_platform.assets ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.assets ( asset_id text, name text, symbol text, type text ) CREATE TABLE trading_platform.logs ( log_i...
[ { "role": "user", "content": "List all invoice numbers and their total amount for invoices that are overdue. Show the client ID and the due date as well." }, { "role": "assistant", "content": "SELECT invoice_number, total_amount, client_id, due_date FROM legal_services.invoices WHERE due_date < ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.invoices ( invoice_id text, invoice_number text, client_id text, case_id text, issue_date date, due_date...
[ { "role": "user", "content": "Show me the email and full name of passengers who are enrolled in a loyalty program, along with the date they joined, ordered by most recent sign-up." }, { "role": "assistant", "content": "SELECT email, CONCAT(first_name, ' ', last_name) AS full_name, created_at FRO...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.passengers ( passenger_id character varying(64) NOT NULL, -- unique identifier for the passenger ...
[ { "role": "user", "content": "For each agency, show the name and the number of distinct document types that have been submitted for applications of services they provide." }, { "role": "assistant", "content": "SELECT ag.agency_name, COUNT(DISTINCT d.document_type) AS document_type_count\nFROM go...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "Show me the top 10 NFT collections with the highest token count, along with their names, symbols, and floor prices." }, { "role": "assistant", "content": "SELECT name, symbol, floor_price, token_count FROM nft_collections ORDER BY token_count DESC LIMIT 10;" }, ...
You are an SQL statement expert. Given the table 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": "Show me all reviews with ratings of 5 stars, including the property name and review date." }, { "role": "assistant", "content": "SELECT r.review_id, p.property_name, r.review_date FROM hospitality_technology.reviews r JOIN hospitality_technology.properties p ON r.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 hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "Identify all instances where a vehicle's odometer_reading decreased compared to its previous fuel log entry." }, { "role": "assistant", "content": "SELECT curr.vehicle_id,\n prev.fuel_log_id AS previous_log_id,\n prev.odometer_reading AS previous_readi...
You are an SQL statement expert. Given the table 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": "Identify duplicate transaction_ref values and list each reference with the pair of payment_ids that share it." }, { "role": "assistant", "content": "SELECT p1.transaction_ref, p1.payment_id AS payment_id_1, p2.payment_id AS payment_id_2\nFROM hospitality_technology....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.payments ( payment_id character varying(64) NOT NULL, -- unique identifier for the payment ...
[ { "role": "user", "content": "Find all pairs of vehicles that have the same make and model but different fuel types. For each pair, display the first vehicle_id, the second vehicle_id, make, model, fuel_type of the first as fuel_type1 and of the second as fuel_type2." }, { "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.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "I want to see each server's name, region, and the number of game sessions that have been started on that server." }, { "role": "assistant", "content": "SELECT s.server_name, s.region, COUNT(gs.session_id) AS session_count\nFROM gaming_technology.servers s\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 gaming_technology.developers ( developer_id uuid NOT NULL DEFAULT gen_random_uuid(), name character varying(150) NOT NU...
[ { "role": "user", "content": "Which agencies have at least one accessible service location and how many active services does each of those agencies offer? Provide agency_id, agency_name, location_count, and active_service_count." }, { "role": "assistant", "content": "SELECT a.agency_id, a.agency...
You are an SQL statement expert. Given the table 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.text, agency_name.text, jurisdiction_level.text, primary_contact_email.text, m...
[ { "role": "user", "content": "Please show the names and bar numbers of all lawyers who have led appointments with more than 3 different clients." }, { "role": "assistant", "content": "SELECT l.first_name, l.last_name, l.bar_number\nFROM legal_services.lawyers l\nJOIN legal_services.appointments ...
You are an SQL statement expert. Given the table 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": "Which users have commented on posts that include hashtags? Show their user IDs and the hashtag IDs." }, { "role": "assistant", "content": "SELECT DISTINCT c.user_id, ph.hashtag_id\nFROM social_media.comments c\nJOIN social_media.post_hashtags ph ON c.post_id = ph.po...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t...
[ { "role": "user", "content": "Which achievements were unlocked by the same player at exactly the same timestamp?" }, { "role": "assistant", "content": "SELECT a.player_id,\n a.achievement_id AS ach1,\n b.achievement_id AS ach2,\n a.unlocked_at\nFROM gaming_technology.player_ach...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.player_achievements ( player_achievement_id uuid, player_id uuid, achievement_id uuid, unlocked_at ti...
[ { "role": "user", "content": "Count the number of law firms founded in each decade. Show the decade (e.g., 1990s, 2000s) and the count." }, { "role": "assistant", "content": "SELECT CONCAT(FLOOR(EXTRACT(YEAR FROM founded_date) / 10) * 10, 's') AS decade, COUNT(*) AS firm_count FROM law_firms WHE...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "Find all invoices with status 'Paid' where the total amount is between 2000 and 5000. Show invoice number, total amount, issue date, and due date. Sort the results by issue date descending." }, { "role": "assistant", "content": "SELECT invoice_number, total_amount, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer first_n...
[ { "role": "user", "content": "Show me all nodes that were last seen in the past 30 days, along with their IP addresses and ports." }, { "role": "assistant", "content": "SELECT node_id, ip_address, port, last_seen FROM blockchain.nodes WHERE last_seen >= NOW() - INTERVAL '30 days';" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen timestamp )
[ { "role": "user", "content": "List all NFT collections where the floor price is greater than 0.5 ETH, including their names and contract addresses." }, { "role": "assistant", "content": "SELECT name, contract_address FROM nft_collections WHERE CAST(floor_price AS decimal) > 0.5 AND floor_price_s...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash varchar, transaction_index bigint, from_...
[ { "role": "user", "content": "Find narratives with a market cap greater than $500,000,000 and a 7-day price change percentage above 5%. Show the narrative, market_cap, and price_change_percentage_7d." }, { "role": "assistant", "content": "SELECT narrative, market_cap, price_change_percentage_7d ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE narrative_info ( narrative.text, top_3_coins.text, price_change_percentage_1h.numeric, price_change_percentage_24h.nume...
[ { "role": "user", "content": "For each property, list the names of all available services in the 'Wellness' category. Show property name and service name." }, { "role": "assistant", "content": "SELECT T1.property_name, T2.service_name FROM hospitality_technology.properties AS T1 JOIN hospitality...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "List pairs of invoice numbers for the same case, including their issue dates." }, { "role": "assistant", "content": "SELECT T1.invoice_number AS invoice1_number, T2.invoice_number AS invoice2_number, T1.case_id, T1.issue_date AS invoice1_issue_date, T2.issue_date 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 legal_services.invoices ( invoice_id text PRIMARY KEY, invoice_number text UNIQUE, client_id text, case_id text, issue_...
[ { "role": "user", "content": "Show me all patients who have been prescribed medications with dosage greater than 100mg, along with their full names and the medication details." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, m.medication_name, m.generic_name, pr.dosage, p...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "List all token transfers, showing the transfer ID, value, and the symbol of the token transferred." }, { "role": "assistant", "content": "SELECT T1.transfer_id, T1.value, T2.token_symbol FROM web3.token_transfers AS T1 JOIN web3.tokens AS T2 ON T1.token_id = T2.toke...
You are an SQL statement expert. Given the table 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 patients with active chronic diagnoses, including their diagnosis descriptions and dates." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, d.description, d.diagnosis_date FROM healthcare.patients p JOIN healthcare.diagn...
You are an SQL statement expert. Given the table 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": "For each security traded on the 'LSE', what is the total quantity traded and the average price_per_unit? Include the security_name and ticker_symbol." }, { "role": "assistant", "content": "SELECT s.security_name,\n s.ticker_symbol,\n SUM(t.quantity) 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 financial_services.accounts ( account_id text PRIMARY KEY, customer_id text, account_number text, account_type text, ba...
[ { "role": "user", "content": "Show me the top 5 tokens by market cap on the Ethereum chain, along with their 24-hour trading volume and price from the token_basic_info table." }, { "role": "assistant", "content": "SELECT token_name, token_symbol, market_cap, total_volume, price FROM token_basic_...
You are an SQL statement expert. Given the table 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, token_name character varying(100) NOT NULL, token_symbol ch...
[ { "role": "user", "content": "Show me all completed trips where the actual departure was more than 15 minutes later than the scheduled departure, along with their vehicle and driver IDs." }, { "role": "assistant", "content": "SELECT trip_id, vehicle_id, driver_id, scheduled_departure, actual_dep...
You are an SQL statement expert. Given the table 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, -- unique identifier for a specific trip instance ...
[ { "role": "user", "content": "Which narrative from narrative_info has the highest token_num, and what is the total market cap and 24h volume for that narrative?" }, { "role": "assistant", "content": "SELECT narrative, market_cap, volume_24h, token_num\nFROM narrative_info\nORDER BY token_num DES...
You are an SQL statement expert. Given the table 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": "Show prescription ID, patient ID, and medication ID for prescriptions that have a start date before their end date." }, { "role": "assistant", "content": "SELECT prescription_id, patient_id, medication_id FROM healthcare.prescriptions WHERE start_date IS NOT NULL AN...
You are an SQL statement expert. Given the table 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 text PRIMARY KEY, record_id text, patient_id text, doctor_id text, medicatio...
[ { "role": "user", "content": "List the medication_name and manufacturer for all medications where the description is null or an empty string." }, { "role": "assistant", "content": "SELECT medication_name, manufacturer FROM healthcare.medications WHERE description IS NULL OR description = '';" ...
You are an SQL statement expert. Given the table 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": "List all events emitted by contracts where the transaction status was 'failed'." }, { "role": "assistant", "content": "SELECT e.* FROM web3.events e JOIN web3.transactions t ON e.transaction_id = t.transaction_id WHERE t.status = 'failed';" }, { "role": "use...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.events ( event_id character varying(64) NOT NULL, -- unique identifier for the event contract_id characte...
[ { "role": "user", "content": "List all vehicles and their last maintenance service date along with the odometer reading, including only those that have not had a fuel refill in the past 30 days." }, { "role": "assistant", "content": "SELECT m.vehicle_id,\n m.last_service_date,\n m.la...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id character varying(64) NOT NULL, route_number character varying(32) NOT NULL UNIQUE, de...
[ { "role": "user", "content": "Can you provide the total capacity of all train cars for a specific train with train_id 'TR789'?" }, { "role": "assistant", "content": "SELECT SUM(capacity) AS total_capacity\nFROM train_cars\nWHERE train_id = 'TR789';" } ]
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 // PUT /stations { "mappings": { "properties": { "station_id": { "type": "keyword" },...
[ { "role": "user", "content": "Show me the top 5 buyers by total trade volume (quantity * price) in the last 30 days, along with their trade count." }, { "role": "assistant", "content": "SELECT buyer_id, COUNT(trade_id) AS trade_count, SUM(quantity * price) AS total_volume FROM trading_platform.t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.trades ( trade_id character varying(64) NOT NULL, order_id character varying(64) NOT NULL, buyer_id ch...
[ { "role": "user", "content": "For each department, what is the earliest and latest employee hire date?" }, { "role": "assistant", "content": "SELECT department, MIN(hire_date) AS earliest_hire_date, MAX(hire_date) AS latest_hire_date FROM financial_services.employees GROUP BY department;" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.employees ( employee_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ...
[ { "role": "user", "content": "List all likes made by user 'U100' on posts, including the like_id and the post_id." }, { "role": "assistant", "content": "SELECT like_id, post_id FROM social_media.likes WHERE user_id = 'U100' AND post_id IS NOT NULL;" }, { "role": "user", "content": "N...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.likes ( like_id.text, user_id.text, post_id.text, comment_id.text, created_at.timestamp )
[ { "role": "user", "content": "Find all addresses that have only sent tokens (appear in from_address) but have never received any (do not appear in to_address)." }, { "role": "assistant", "content": "SELECT DISTINCT from_address FROM web3.token_transfers WHERE from_address NOT IN (SELECT DISTINCT...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id text PRIMARY KEY, token_id text, from_address text, to_address text, value numeric, ...
[ { "role": "user", "content": "Show all rooms that are on floor 3." }, { "role": "assistant", "content": "SELECT room_id, property_id, room_number FROM hospitality_technology.rooms WHERE floor = 3;" }, { "role": "user", "content": "For these rooms, include the property name and room n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "Which narrative and chain combination saw the highest total USD buy value in the first half of 2023? Also list the total token amount bought for each." }, { "role": "assistant", "content": "SELECT narrative, chain, SUM(usd_value) AS total_usd_bought, SUM(token_amoun...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE smart_money_token_inflow ( token_address character varying(100) NOT NULL, -- the token's address token_symbol character...
[ { "role": "user", "content": "List the top 5 tokens by net_flow, showing token_symbol, net_flow, pnl, and price." }, { "role": "assistant", "content": "SELECT token_symbol,\n net_flow,\n pnl,\n price\nFROM smart_money_token_performance\nORDER BY net_flow 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 smart_money_token_performance ( token_address.text, token_symbol.text, pnl.numeric, net_flow.numeric, avg_cost.numeric,...
[ { "role": "user", "content": "For each property, show the total number of service orders, the total quantity of items ordered, and the total price of those orders." }, { "role": "assistant", "content": "SELECT T2.property_name, COUNT(T1.order_id) AS total_orders, SUM(T1.quantity) AS total_quanti...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for a specifi...
[ { "role": "user", "content": "Show a list of all game developers with their name and founded year." }, { "role": "assistant", "content": "SELECT\n name,\n founded_year\nFROM gaming_technology.developers;" }, { "role": "user", "content": "Please filter the list to only include devel...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player ...
[ { "role": "user", "content": "List all appointments scheduled in the next 30 days with appointment_id, client_id, case_id, and any invoice_id linked to that case." }, { "role": "assistant", "content": "SELECT\n a.appointment_id,\n a.client_id,\n a.case_id,\n i.invoice_id\nFROM legal_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 legal_services.law_firms ( firm_id character varying(64) NOT NULL, -- unique identifier for the law firm firm_...
[ { "role": "user", "content": "Show me the total transaction amount sent by each sender_address in the last 30 days, along with the count of transactions for each sender." }, { "role": "assistant", "content": "SELECT sender_address, SUM(amount) AS total_amount, COUNT(*) AS transaction_count FROM ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.transactions ( transaction_id text, block_id text, sender_address text, receiver_address text, amount numeri...
[ { "role": "user", "content": "I want to list each public post along with its content, the author's username, and the total number of comments it has received. Order the results by comment count descending." }, { "role": "assistant", "content": "SELECT p.post_id,\n u.username,\n p.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 social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Can you help me retrieve the list of components made of a specific material along with their supplier details?" }, { "role": "assistant", "content": "SMEMBERS material_components:mat:TI64\nHGETALL component:<component_id>\nHGET component:<component_id> supplier_id" ...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure Use Hashes. Key pattern: 'component:<component_id>'. Example: HSET component:LGSTRUT01 part_numbe...
[ { "role": "user", "content": "What is the average investment value for projects that completed Series A funding rounds?" }, { "role": "assistant", "content": "SELECT AVG(investment_value) AS average_investment FROM project_fundraising_record WHERE rounds_name = 'Series 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 project_fundraising_record ( id.text, project_id.text, project_name.text, rounds_name.text, investment_value.numeric, i...
[ { "role": "user", "content": "List all room types with their type name, base rate, and the name of the property they belong to." }, { "role": "assistant", "content": "SELECT rt.room_type_id, rt.type_name, rt.base_rate, p.property_name\nFROM hospitality_technology.room_types rt\nJOIN hospitality_...
You are an SQL statement expert. Given the table 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 claims reported in 2024, including the claim ID, incident date, estimated loss, and the full name of the agent who handled it." }, { "role": "assistant", "content": "SELECT T1.claim_id, T1.incident_date, T1.estimated_loss, T2.first_name, T2.last_name FROM 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 insurance.claims ( claim_id text, policy_id text, customer_id text, incident_date timestamp, reported_date timestamp, d...
[ { "role": "user", "content": "Show me the invoice number, total amount, and due date for all invoices, along with the corresponding client ID." }, { "role": "assistant", "content": "SELECT invoice_number, total_amount, due_date, client_id FROM legal_services.invoices;" }, { "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 legal_services.invoices ( invoice_id character varying(64) NOT NULL, -- unique identifier for the invoice invo...
[ { "role": "user", "content": "Show me all room types with a base rate over $200 and max occupancy of at least 4, along with their property IDs and amenities." }, { "role": "assistant", "content": "SELECT room_type_id, property_id, type_name, base_rate, max_occupancy, amenities FROM hospitality_t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text, type_name text, description text, ...
[ { "role": "user", "content": "What is the detailed repair history of the equipment used by the staff with staff_id 'STAFF123' during maintenance tasks?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the detailed repair history of equipment used by staff memb...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.m...
[ { "role": "user", "content": "List all staff members, showing their full name, position, and the name of the property where they work." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T1.position, T2.property_name FROM hospitality_technology.staff AS T1 JOIN hospitality...
You are an SQL statement expert. Given the table 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 reservations along with the guest's full name and the room number." }, { "role": "assistant", "content": "SELECT T1.reservation_id, T3.first_name, T3.last_name, T2.room_number FROM hospitality_technology.reservations AS T1 JOIN hospitality_technology.rooms ...
You are an SQL statement expert. Given the table 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": "Can you show a list of all distinct medication IDs along with the count of prescriptions for each medication, including only medications that have been prescribed more than 50 times? Also, please display the total quantity dispensed for each medication." }, { "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 healthcare.prescriptions ( prescription_id character varying(64) NOT NULL, -- unique identifier for the prescriptio...
[ { "role": "user", "content": "How many games are available on each platform?" }, { "role": "assistant", "content": "SELECT platform, COUNT(*) AS game_count\nFROM gaming_technology.games\nGROUP BY platform;" }, { "role": "user", "content": "Exclude platforms with fewer than five 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": "For each wallet, list its address, the associated user_id, and the contract address if the wallet's address was also used to deploy any contracts." }, { "role": "assistant", "content": "SELECT w.address AS wallet_address, w.user_id, c.address AS contract_address\nFR...
You are an SQL statement expert. Given the table 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 count of loans grouped by their status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) FROM financial_services.loans GROUP BY status" }, { "role": "user", "content": "Additionally, show the total current principal balance for ea...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.loans ( loan_id.text, account_id.text, loan_type.text, principal_amount.numeric, current_principal_b...
[ { "role": "user", "content": "List all depots (location type 'Depot') and the number of vehicles assigned to each. Include the depot name and city." }, { "role": "assistant", "content": "SELECT T1.name , T1.city , COUNT(T2.vehicle_id) FROM transportation.locations AS T1 LEFT 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, -- unique identifier for the vehicle lice...
[ { "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.username, u.email, COUNT(c.contract_id) AS contract_count FROM web3.users u JOIN web3...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_address.text, deployed_at.timestamp,...
[ { "role": "user", "content": "Show me all room types with 'King' in the bed_type field, along with their property IDs and base rates." }, { "role": "assistant", "content": "SELECT room_type_id, property_id, base_rate FROM hospitality_technology.room_types WHERE bed_type LIKE '%King%';" }, { ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text, type_name text, description text, ...
[ { "role": "user", "content": "List all cryptocurrency assets that have been traded more than 50 times but have never been traded in quantities greater than 100." }, { "role": "assistant", "content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) AS trade_count FROM trading_platform.asse...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id text, username text, email text, password_hash text, created_at timestamp ) CREATE TAB...
[ { "role": "user", "content": "Show me the top 5 NFT collections on Ethereum with the highest number of unique owners, along with their names and floor prices." }, { "role": "assistant", "content": "SELECT nc.name, nc.floor_price, COUNT(DISTINCT nh.wallet_address) AS unique_owners FROM nft_collec...
You are an SQL statement expert. Given the table 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": "Show me the total quantity and total price for each service ordered by each guest." }, { "role": "assistant", "content": "SELECT guest_id, service_id, SUM(quantity) AS total_quantity, SUM(total_price) AS total_price FROM hospitality_technology.service_orders GROUP B...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, reservation_id text, guest_id text, service_id text,...
[ { "role": "user", "content": "For each chain, identify the token with the highest Smart Money Realized Ratio. Show the chain, token symbol, and realized ratio." }, { "role": "assistant", "content": "WITH RankedPerformance AS ( SELECT chain, token_symbol, realized_ratio, pnl, net_flow, roi, ROW_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 token_basic_info ( coin_id text, token_name text, token_symbol text, token_address text, chain text, price numeric, pri...
[ { "role": "user", "content": "List the first and last names of employees who verified documents, along with the document type they verified." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, d.document_type\nFROM government_services.documents d\nJOIN government_services.em...
You are an SQL statement expert. Given the table 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": "I want to list each security alongside another security issued by the same issuer." }, { "role": "assistant", "content": "SELECT a.security_id, a.ticker_symbol, b.security_id AS other_security_id, b.ticker_symbol AS other_ticker, a.issuer_name\nFROM financial_servic...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu...
[ { "role": "user", "content": "Show the first name, last name, and contact information for beneficiaries added before 2023." }, { "role": "assistant", "content": "SELECT first_name, last_name, contact_info FROM insurance.policy_beneficiaries WHERE added_at < '2023-01-01';" }, { "role": "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 insurance.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text...
[ { "role": "user", "content": "Show me all users who have liked both a comment and a post, including their user IDs." }, { "role": "assistant", "content": "SELECT DISTINCT l1.user_id\nFROM social_media.likes l1\nJOIN social_media.likes l2 ON l1.user_id = l2.user_id\nWHERE l1.post_id IS NOT NULL 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 social_media.comments ( comment_id character varying(64) NOT NULL, -- unique identifier for the comment post_id...
[ { "role": "user", "content": "Show the top 5 properties by average overall review rating." }, { "role": "assistant", "content": "SELECT p.property_name, AVG(r.rating_overall) AS avg_rating\nFROM hospitality_technology.properties p\nJOIN hospitality_technology.reviews r\n ON p.property_id = r.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 hospitality_technology.properties ( property_id character varying(64) NOT NULL, -- unique identifier for the prope...
[ { "role": "user", "content": "I need a list of users who have commented on their own posts. For each, return user_id, username, and the total number of such comments, ordered by comment count descending." }, { "role": "assistant", "content": "SELECT u.user_id,\n u.username,\n COUNT(c...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "How many unique IP addresses are there in the nodes table?" }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT ip_address) FROM blockchain.nodes;" }, { "role": "user", "content": "Can you break this down by port numbers, showing the count of nod...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.nodes ( node_id text PRIMARY KEY, ip_address text, port int, last_seen timestamp )
[ { "role": "user", "content": "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": "Show me the highest and lowest close price for each security in the 'Healthcare' sector, along with the security name." }, { "role": "assistant", "content": "SELECT s.security_name, MAX(md.close_price) AS highest_close, MIN(md.close_price) AS lowest_close\nFROM fina...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.securities ( security_id character varying(64) NOT NULL, -- unique identifier for the security ...
[ { "role": "user", "content": "List all group chats and the total count of messages sent in each one." }, { "role": "assistant", "content": "SELECT T1.group_name, count(T2.message_id) AS message_count FROM social_media.conversations AS T1 JOIN social_media.messages AS T2 ON T1.conversation_id = 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 social_media.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username charac...
[ { "role": "user", "content": "List all agents who have been terminated, showing their full name, agency name, and termination date." }, { "role": "assistant", "content": "SELECT first_name, last_name, agency_name, termination_date\nFROM insurance.agents\nWHERE 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.agents ( agent_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name chara...
[ { "role": "user", "content": "List all the appointments that overlap in time for the same location, showing both appointment IDs, their start and end times, and the location." }, { "role": "assistant", "content": "SELECT a1.appointment_id AS appointment_id_1, a2.appointment_id AS 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.appointments ( appointment_id.text, client_id.text, lawyer_id.text, case_id.text, start_time.timestamp, ...
[ { "role": "user", "content": "Calculate the total price for all service orders, grouped by their status." }, { "role": "assistant", "content": "SELECT status, SUM(total_price) AS total_revenue FROM hospitality_technology.service_orders GROUP BY status;" }, { "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 hospitality_technology.rooms ( room_id text, property_id text, room_number text, room_type_id text, floor integer, stat...
[ { "role": "user", "content": "For every manufacturer, show the total number of medications they produce, and the number of those that have an NDC code starting with '5'." }, { "role": "assistant", "content": "SELECT manufacturer, COUNT(*) AS total_medications, COUNT(CASE WHEN ndc_code LIKE '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 healthcare.medications ( medication_id character varying(64) NOT NULL, -- unique identifier for the medication type...
[ { "role": "user", "content": "How many users registered on each weekday? Return the weekday name and registration count." }, { "role": "assistant", "content": "SELECT\n to_char(created_at, 'FMDay') AS weekday,\n COUNT(*) AS registration_count\nFROM web3.users\nGROUP BY 1\nORDER BY registration...
You are an SQL statement expert. Given the table 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.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp )
[ { "role": "user", "content": "List all managers (employees who have other employees reporting to them) along with the count of their direct reports, showing only those with more than 5 reports." }, { "role": "assistant", "content": "SELECT e.employee_id, e.first_name, e.last_name, COUNT(r.employ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.employees ( employee_id text PRIMARY KEY, first_name text, last_name text, job_title text, departmen...
[ { "role": "user", "content": "What is the current location of train number Acela 2151?" }, { "role": "assistant", "content": "I'm sorry, but I don't have access to real-time location data for trains. The database only contains static information such as train ID, model, capacity, and maintenance...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.t...
[ { "role": "user", "content": "For each passenger, show their full name, email, and the number of unique trips they have participated in." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, p.email, COUNT(DISTINCT b.trip_id) AS unique_trips\nFROM transportation.passengers p\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.trips ( trip_id text PRIMARY KEY, route_id text, vehicle_id text, driver_id text, scheduled_departure ti...
[ { "role": "user", "content": "List the comment_id, comment content, and associated hashtag_id for each comment on posts that have at least one hashtag by joining comments and post_hashtags tables." }, { "role": "assistant", "content": "SELECT cm.comment_id, cm.content, ph.hashtag_id\nFROM social...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id text PRIMARY KEY, post_id text, user_id text, parent_comment_id text, content text, ...
[ { "role": "user", "content": "How many notifications related to services were sent for each service category in the past 7 days?" }, { "role": "assistant", "content": "SELECT\n s.category,\n COUNT(n.notification_id) AS notification_count\nFROM\n government_services.notifications n\n JOIN gov...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.services ( service_id text PRIMARY KEY, agency_id text, service_name text, description text, catego...
[ { "role": "user", "content": "Which developers founded after 2010 have published games using the 'Unreal Engine'? List the developer's name, country, game title, and the release year." }, { "role": "assistant", "content": "SELECT d.name AS developer_name, d.country, g.title AS game_title, EXTRAC...
You are an SQL statement expert. Given the table 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": "Get the average total_price of service orders per department for the current month. Include department and avg_order_value." }, { "role": "assistant", "content": "SELECT s.department,\n AVG(o.total_price) AS avg_order_value\nFROM hospitality_technology.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 hospitality_technology.properties ( property_id.text, property_name.text, address_line1.text, address_line2.text, city....
[ { "role": "user", "content": "Which games have the highest average item cost for Legendary rarity items? Please show the game title, genre, and the average cost of those items." }, { "role": "assistant", "content": "SELECT g.title, g.genre, AVG(igi.cost_amount) AS avg_legendary_cost\nFROM gaming...
You are an SQL statement expert. Given the table 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...