conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "Show me the date of birth and email for all passengers." }, { "role": "assistant", "content": "SELECT date_of_birth, email FROM transportation.passengers;" }, { "role": "user", "content": "Can you also include their phone number and creation date?" }, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "For each player, show their player_id and the number of unique games they have played sessions on." }, { "role": "assistant", "content": "SELECT player_id, COUNT(DISTINCT game_id) AS unique_games\nFROM gaming_technology.game_sessions\nGROUP BY player_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 gaming_technology.players ( player_id.uuid, username.text, email.text, password_hash.text, registration_date.timestampt...
[ { "role": "user", "content": "How many available rooms and available services are there for each property?" }, { "role": "assistant", "content": "SELECT\n r.property_id,\n SUM(CASE WHEN r.status = 'Available' THEN 1 ELSE 0 END) AS available_rooms_count,\n SUM(CASE WHEN s.is_available = TRUE 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.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat...
[ { "role": "user", "content": "Show the policy number, start date, and the first and last name of the agent for all policies that started in 2024." }, { "role": "assistant", "content": "SELECT p.policy_number, p.start_date, a.first_name AS agent_first_name, a.last_name AS agent_last_name\nFROM 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.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,...
[ { "role": "user", "content": "How many insurance policies have 'Group' in their group_number?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM healthcare.patient_insurance WHERE group_number ILIKE '%Group%';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patient_insurance ( patient_insurance_id text, patient_id text, plan_id text, policy_number text, group_numb...
[ { "role": "user", "content": "Show me all messages sent in the system, along with their sender's username and the time they were sent." }, { "role": "assistant", "content": "SELECT m.message_id, m.content, u.username, m.sent_at\nFROM social_media.messages m\nJOIN social_media.users u ON m.sender...
You are an SQL statement expert. Given the table 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": "For each vehicle, list its make, model, the total cost of all its maintenance logs, and the total number of completed trips it has made." }, { "role": "assistant", "content": "SELECT\n v.make,\n v.model,\n COALESCE(SUM(ml.cost), 0) AS total_maintenance_cost,\n C...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id text PRIMARY KEY, license_plate text, vin text, make text, model text, year int, t...
[ { "role": "user", "content": "Can you list all item names along with their type, rarity, and cost amount for every item in the database?" }, { "role": "assistant", "content": "SELECT item_name, item_type, rarity, cost_amount FROM gaming_technology.in_game_items;" }, { "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.in_game_items ( item_id uuid NOT NULL DEFAULT gen_random_uuid(), game_id uuid NOT NULL, item_name cha...
[ { "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, -- unique identifier for the block previous_block...
[ { "role": "user", "content": "For each token, show its token name, token symbol, the address of the contract it was created on, and the deployer address of that contract." }, { "role": "assistant", "content": "SELECT t.token_id, t.token_name, t.token_symbol, t.contract_address, c.deployer_addres...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "role": "user", "content": "For all currently active policies, show the policy number, the customer's first and last name, and the total amount paid for that policy across all premium payments." }, { "role": "assistant", "content": "SELECT T1.policy_number, T2.first_name, T2.last_name, SUM(T3....
You are an SQL statement expert. Given the table 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 the total number of customers and their average age grouped by city." }, { "role": "assistant", "content": "SELECT city, COUNT(customer_id) AS total_customers, AVG(EXTRACT(YEAR FROM NOW()) - EXTRACT(YEAR FROM date_of_birth)) AS average_age 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.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad...
[ { "role": "user", "content": "Can you show me the number of lawyers grouped by specialization?" }, { "role": "assistant", "content": "SELECT specialization, COUNT(*) AS lawyer_count FROM lawyers GROUP BY specialization;" }, { "role": "user", "content": "Include only specializations t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph...
[ { "role": "user", "content": "What is the minimum, maximum, and average commission rate among all agents?" }, { "role": "assistant", "content": "SELECT MIN(commission_rate) AS min_commission_rate, MAX(commission_rate) AS max_commission_rate, AVG(commission_rate) AS average_commission_rate FROM 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.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 loans (loan_id, loan_type, principal_amount) where the remaining term is less than 12 months, along with the account_id and monthly_payment." }, { "role": "assistant", "content": "SELECT loan_id, loan_type, principal_amount, account_id, monthly_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 financial_services.loans ( loan_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL UNIQUE, lo...
[ { "role": "user", "content": "Can you show me all doctors affiliated with hospital ID 'HOSP1001', including their doctor ID, full name, and specialty?" }, { "role": "assistant", "content": "SELECT doctor_id, first_name, last_name, specialty FROM healthcare.doctors WHERE hospital_affiliation_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.doctors ( doctor_id.text, first_name.text, last_name.text, specialty.text, license_number.text, phone_number...
[ { "role": "user", "content": "Show all prescriptions made in 2024 for medications prescribed during appointments scheduled at location 'LOC001', including prescription_id, patient_id, medication_id, and appointment_time." }, { "role": "assistant", "content": "SELECT pr.prescription_id, pr.patien...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "List the policy number, start date, product name, and base premium for policies where the base premium of the associated product is greater than 1000." }, { "role": "assistant", "content": "SELECT T1.policy_number, T1.start_date, T2.product_name, T2.base_premium 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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "Could you list the title of each game and the total quantity of items acquired by players for that specific game?" }, { "role": "assistant", "content": "SELECT g.title, SUM(pi.quantity) AS total_acquired_quantity FROM gaming_technology.games g JOIN 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": "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": "Show me all fuel logs where the location is 'LOC456', including the vehicle ID, fuel type, and quantity." }, { "role": "assistant", "content": "SELECT fuel_log_id, vehicle_id, fuel_type, quantity FROM transportation.fuel_logs WHERE location_id = 'LOC456';" }, { ...
You are an SQL statement expert. Given the table 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": "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": "Provide a count of cases for each case type." }, { "role": "assistant", "content": "SELECT case_type, count(*) FROM legal_services.cases GROUP BY case_type" }, { "role": "user", "content": "Only include counts for 'Civil Litigation' and 'Criminal Defense...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.cases ( case_id text, case_number text, case_name text, client_id text, lead_lawyer_id text, case_type t...
[ { "role": "user", "content": "Show me all bookings for trips going to locations in 'California' state, including the passenger's first name, last name, booking_id, and the city of the destination." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, b.booking_id, l.city AS de...
You are an SQL statement expert. Given the table 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": "I want to get the total number of appointments scheduled at each agency in 2024. Please provide the agency name and the appointment count." }, { "role": "assistant", "content": "SELECT a.agency_name,\n COUNT(ap.appointment_id) AS appointment_count\nFROM govern...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "List all securities that have had at least one market data entry where the closing price was higher than the opening price, including their security name and ticker symbol." }, { "role": "assistant", "content": "SELECT DISTINCT T1.security_name, T1.ticker_symbol 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 financial_services.transactions ( transaction_id text, account_id text, related_account_id text, transaction_type text,...
[ { "role": "user", "content": "Show a summary of each user, including their user_id, the count of orders they've placed, and the total traded value as buyers." }, { "role": "assistant", "content": "SELECT o.user_id,\n COUNT(o.order_id) AS order_count,\n SUM(t.quantity * t.price) AS to...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timesta...
[ { "role": "user", "content": "Find all vehicles that share the same make and model but were manufactured in different years. Show both vehicle IDs, the make, model, and their respective years." }, { "role": "assistant", "content": "SELECT v1.vehicle_id AS vehicle1_id,\n v2.vehicle_id AS ve...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "Which doctors have both a listed email address and a license number that starts with the letter 'A'? Show their ID, full name, specialty, and email." }, { "role": "assistant", "content": "SELECT doctor_id, first_name, last_name, specialty, email\nFROM healthcare.doc...
You are an SQL statement expert. Given the table 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": "Which customers have traded securities with the highest average trading amount per trade across all their accounts? Show me the customer full name, email, and the average trade amount for each customer." }, { "role": "assistant", "content": "SELECT c.first_name || '...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h...
[ { "role": "user", "content": "What is the average market cap for all tokens belonging to the 'GameFi' narrative?" }, { "role": "assistant", "content": "SELECT AVG(market_cap) FROM token_basic_info WHERE narrative = 'GameFi'" } ]
You are an SQL statement expert. Given the table 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": "Find the contract ID, address, and deployer address for all contracts that have not emitted any events." }, { "role": "assistant", "content": "SELECT c.contract_id, c.address, c.deployer_address FROM web3.contracts AS c LEFT JOIN web3.events AS e ON c.contract_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.contracts ( contract_id.text, address.text, abi.text, bytecode.text, deployer_address.text, deployed_at.timestamp,...
[ { "role": "user", "content": "Show me the number of guests for each city they reside in." }, { "role": "assistant", "content": "SELECT city, count(*) AS guest_count FROM hospitality_technology.guests WHERE city IS NOT NULL GROUP BY city;" }, { "role": "user", "content": "Now, only sh...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.guests ( guest_id text PRIMARY KEY, first_name text, last_name text, email text, phone_number te...
[ { "role": "user", "content": "Show 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": "Summarize trade activity by account and execution venue, showing the total quantity of shares traded and the average commission paid." }, { "role": "assistant", "content": "SELECT account_id, execution_venue, SUM(quantity) AS total_quantity, AVG(commission) AS avera...
You are an SQL statement expert. Given the table 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.trades ( trade_id text, account_id text, security_id text, order_id text, trade_type text, quantity ...
[ { "role": "user", "content": "Provide the count of applications grouped by their status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS application_count\nFROM government_services.applications\nGROUP BY status;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.services ( service_id character varying(64) NOT NULL, agency_id character varying(64) NOT NULL, ser...
[ { "role": "user", "content": "Show me the total principal_amount of all loans for each loan_type." }, { "role": "assistant", "content": "SELECT loan_type, SUM(principal_amount) AS total_principal\nFROM financial_services.loans\nGROUP BY loan_type;" }, { "role": "user", "content": "Ca...
You are an SQL statement expert. Given the table 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 policy beneficiaries who were added in the last 6 months, along with their policy details and percentage shares." }, { "role": "assistant", "content": "SELECT pb.*, pp.policy_id, pp.customer_id, pp.payment_date FROM insurance.policy_beneficiaries pb 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 insurance.premium_payments ( payment_id text PRIMARY KEY, policy_id text, customer_id text, payment_date timestamp, amo...
[ { "role": "user", "content": "Count the number of trips for each route type." }, { "role": "assistant", "content": "SELECT R.type, COUNT(T.trip_id) FROM transportation.trips AS T JOIN transportation.routes AS R ON T.route_id = R.route_id GROUP BY R.type;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id.text, route_number.text, description.text, origin_location_id.text, destination_locati...
[ { "role": "user", "content": "List all invoices that do not have any associated documents for their case. Show the invoice number, total amount, and case_id." }, { "role": "assistant", "content": "SELECT i.invoice_number, i.total_amount, i.case_id\nFROM legal_services.invoices i\nLEFT JOIN legal...
You are an SQL statement expert. Given the table 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, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "Find the average settlement_amount of closed claims for each claim handler. Return claim_handler_id and avg_settlement_amount." }, { "role": "assistant", "content": "SELECT c.claim_handler_id, AVG(c.settlement_amount) AS avg_settlement_amount\nFROM insurance.claims ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_hash text,...
[ { "role": "user", "content": "Show a list of departments with more than 5 employees. Include the department name and the count." }, { "role": "assistant", "content": "SELECT department, COUNT(*) AS employee_count\nFROM government_services.employees\nGROUP BY department\nHAVING COUNT(*) > 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 government_services.employees ( employee_id.text, agency_id.text, first_name.text, last_name.text, job_title.text, depa...
[ { "role": "user", "content": "Show each wallet address, the user who owns it, and the number of UTXOs associated with that address." }, { "role": "assistant", "content": "SELECT w.address, w.user_id, COUNT(u.utxo_id) AS utxo_count\nFROM trading_platform.wallets w\nLEFT JOIN trading_platform.utxo...
You are an SQL statement expert. Given the table 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": "Find the total number of likes made on posts versus comments. Show two columns: like_type (either 'post' or 'comment') and like_count." }, { "role": "assistant", "content": "SELECT CASE WHEN post_id IS NOT NULL THEN 'post' ELSE 'comment' END AS like_type, COUNT(*) 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.likes ( like_id text PRIMARY KEY, user_id text, post_id text, comment_id text, created_at timestamp )
[ { "role": "user", "content": "For each driver, show the driver's full name and the total number of trips they have driven. Only include drivers whose status is 'Active' and sort the result by trip count in descending order." }, { "role": "assistant", "content": "SELECT d.driver_id,\n d.fir...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "List tokens with smart money ROI greater than 5 on the Ethereum chain and show their current market cap." }, { "role": "assistant", "content": "SELECT T2.token_symbol, T2.market_cap, T1.roi FROM smart_money_token_performance AS T1 JOIN token_basic_info AS T2 ON T1.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 token_basic_info ( coin_id character varying(100) NOT NULL, -- the id of the token token_name character varying(100) NO...
[ { "role": "user", "content": "What is the total balance and the number of accounts for each currency, including only accounts opened in the last 2 years?" }, { "role": "assistant", "content": "SELECT currency , SUM(balance) AS total_balance , COUNT(*) AS account_count FROM financial_services.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 financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri...
[ { "role": "user", "content": "List all medical report documents with descriptions containing 'x-ray', showing their claim IDs and upload dates." }, { "role": "assistant", "content": "SELECT claim_id, document_id, uploaded_at FROM insurance.claim_documents WHERE document_type = 'medical_report' 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 insurance.claim_documents ( document_id text, claim_id text, document_type text, file_name text, file_path text, file_s...
[ { "role": "user", "content": "Show me all premium payments where the actual payment date was after the due date. Include the payment ID, amount paid, payment date, and due date." }, { "role": "assistant", "content": "SELECT payment_id, amount_paid, payment_date, due_date FROM insurance.premium_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.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "List the username and full name of all users who have set their profile to private." }, { "role": "assistant", "content": "SELECT u.username, u.full_name FROM social_media.users u JOIN social_media.user_settings us ON u.user_id = us.user_id WHERE us.private_profile ...
You are an SQL statement expert. Given the table 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": "Count how many non-primary insurance policies have a group number specified." }, { "role": "assistant", "content": "SELECT COUNT(*) FROM healthcare.patient_insurance WHERE is_primary = FALSE AND group_number 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 healthcare.patient_insurance ( patient_insurance_id character varying(64) NOT NULL, -- unique identifier for this p...
[ { "role": "user", "content": "List all likes that were made on comments. Show the like ID, user ID, comment ID, and the creation time." }, { "role": "assistant", "content": "SELECT like_id, user_id, comment_id, created_at\nFROM social_media.likes\nWHERE comment_id IS NOT NULL;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.likes ( like_id text PRIMARY KEY, user_id text, post_id text, comment_id text, created_at timestamp )
[ { "role": "user", "content": "Retrieve each completed booking's booking_id, passenger full name, trip_id, scheduled_departure, and fare for bookings where the trip's passenger_count is at least 10." }, { "role": "assistant", "content": "SELECT b.booking_id, p.first_name || ' ' || p.last_name AS ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "Show me all trips that were delayed by more than 30 minutes, including their vehicle_id, driver_id, and the delay time in minutes." }, { "role": "assistant", "content": "SELECT trip_id, vehicle_id, driver_id, EXTRACT(EPOCH FROM (actual_departure - scheduled_departur...
You are an SQL statement expert. Given the table 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": "List all active SUI coins showing coin_type, balance, and owner from sui_coins." }, { "role": "assistant", "content": "SELECT coin_type, balance, owner\nFROM sui_coins\nWHERE status = 'exists';" }, { "role": "user", "content": "Add symbol and decimals fr...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc20_balances ( block_number bigint, contract_address varchar, wallet_address varchar, amount varchar, pk varchar ) CR...
[ { "role": "user", "content": "How many unique IP addresses are there in the nodes table?" }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT ip_address) AS unique_ip_count FROM blockchain.nodes;" }, { "role": "user", "content": "Can you break this down by port numbers, showi...
You are an SQL statement expert. Given the table 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": "Show me the names of law firms founded after 2010, along with the full name of their managing partner." }, { "role": "assistant", "content": "SELECT f.firm_name, l.first_name, l.last_name FROM legal_services.law_firms AS f JOIN legal_services.lawyers AS l ON f.manag...
You are an SQL statement expert. Given the table 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": "Which vehicles are assigned to each depot? Display the depot ID, vehicle's license_plate, make, and model." }, { "role": "assistant", "content": "SELECT depot_id, license_plate, make, model\nFROM transportation.vehicles\nWHERE depot_id IS NOT NULL;" }, { "ro...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, -- unique identifier for the vehicle lice...
[ { "role": "user", "content": "Show me the total balance for each SUI coin type for coins with status 'exists'. Include the coin type and the sum of balances." }, { "role": "assistant", "content": "SELECT coin_type, SUM(CAST(balance AS DECIMAL)) AS total_balance FROM sui_coins WHERE status = 'exi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc1155_approval_for_all ( block_number bigint, block_timestamp timestamp, transaction_index integer, transaction_hash ...
[ { "role": "user", "content": "List each achievement name, the number of players who unlocked it, and the latest unlock time." }, { "role": "assistant", "content": "SELECT a.name,\n COUNT(pa.player_id) AS unlock_count,\n MAX(pa.unlocked_at) AS latest_unlocked_at\nFROM gaming_techn...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id.uuid, name.text, country.text, founded_year.integer, website.text, created_...
[ { "role": "user", "content": "List the count of events for each contract deployed by address '0x123abc...'" }, { "role": "assistant", "content": "SELECT c.address, COUNT(e.event_id) FROM web3.contracts c JOIN web3.events e ON c.contract_id = e.contract_id WHERE c.deployer_address = '0x123abc...'...
You are an expert in writing database language. You can write a corresponding database language query to answer the user's question based on the table structure described by the table creation statement. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, address character varyi...
[ { "role": "user", "content": "Provide a summary for each user, showing their associated KYC status and the total number of UTXOs connected to them." }, { "role": "assistant", "content": "SELECT kyc.user_id, kyc.status, COUNT(u.utxo_id) AS utxo_count FROM trading_platform.kyc_audit kyc JOIN 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.utxos ( utxo_id.text, transaction_id.text, output_index.integer, address.text, amount.numeric, spent.b...
[ { "role": "user", "content": "How many unique email domains are there among all registered users?" }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT SUBSTRING(email FROM POSITION('@' IN email)+1)) AS unique_domains FROM blockchain.users;" }, { "role": "user", "content": "Ca...
You are an SQL statement expert. Given the table 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": "Find all pairs of bookings on the same trip, showing both booking IDs, passenger IDs, and booking times." }, { "role": "assistant", "content": "SELECT b1.booking_id AS booking_id1,\n b1.passenger_id AS passenger1,\n b1.booking_time AS time1,\n b2.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 transportation.bookings ( booking_id text, passenger_id text, trip_id text, seat_number text, booking_time timestamp, s...
[ { "role": "user", "content": "For each game session, list session_id, player_id, and the number of achievements that the player had unlocked before the session start_time." }, { "role": "assistant", "content": "```sql\nSELECT\n gs.session_id,\n gs.player_id,\n COUNT(pa.achievement_id) AS achi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "List pairs of token transfers that occurred within the same transaction and for the same token, but were sent to different recipient addresses. Show both transfer IDs and the shared transaction ID and token ID." }, { "role": "assistant", "content": "SELECT t1.transf...
You are an SQL statement expert. Given the table 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": "What are the top 5 most recently registered verified citizens? Return the citizen ID, full name, and registration date." }, { "role": "assistant", "content": "SELECT citizen_id,\n first_name || ' ' || last_name AS full_name,\n registration_date\nFROM 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.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "Find all transactions where the from_address is the same as the to_address, indicating self-transactions, and show the transaction_id, value, and gas_used." }, { "role": "assistant", "content": "SELECT transaction_id, value, gas_used FROM web3.transactions WHERE 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 web3.transactions ( transaction_id character varying(64) NOT NULL, from_address character varying(128) NOT NULL, to_add...
[ { "role": "user", "content": "For each claim, show the corresponding product_type of the insurance product for the related policy." }, { "role": "assistant", "content": "SELECT cl.claim_id, ip.product_type\nFROM insurance.claims cl\nJOIN insurance.policies p ON cl.policy_id = p.policy_id\nJOIN 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.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "List all token transfers where the from_address is '0x1234' and the value is greater than 1000." }, { "role": "assistant", "content": "SELECT * FROM web3.token_transfers WHERE from_address = '0x1234' AND value > 1000;" }, { "role": "user", "content": "Ac...
You are an SQL statement expert. Given the table 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": "List each driver's first name, last name, and hire_date." }, { "role": "assistant", "content": "SELECT first_name, last_name, hire_date\nFROM transportation.drivers;" }, { "role": "user", "content": "Now include the number of drivers hired on the same da...
You are an SQL statement expert. Given the table 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": "Find all pairs of lawyers who were hired on the exact same date but have different specializations. Return each lawyer's name, hire_date, and both specializations." }, { "role": "assistant", "content": "SELECT a.lawyer_id AS lawyer1_id,\n a.first_name AS 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 legal_services.lawyers ( lawyer_id.text, first_name.text, last_name.text, bar_number.text, firm_id.text, email.text, ph...
[ { "role": "user", "content": "List each hashtag_id along with the total number of distinct posts it's linked to." }, { "role": "assistant", "content": "SELECT hashtag_id, COUNT(DISTINCT post_id) AS post_count\nFROM social_media.post_hashtags\nGROUP BY hashtag_id;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, full_name text, profile_p...
[ { "role": "user", "content": "Which room types have a base rate above 250 USD, and what are their maximum occupancies?" }, { "role": "assistant", "content": "SELECT room_type_id, type_name, base_rate, max_occupancy\nFROM hospitality_technology.room_types\nWHERE base_rate > 250;" }, { "ro...
You are an SQL statement expert. Given the table 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": "Can you provide the total number of sessions and the average session duration in seconds for each game_id and server_id pair?" }, { "role": "assistant", "content": "SELECT game_id, server_id, COUNT(*) AS total_sessions, AVG(duration_seconds) AS avg_duration_seconds\...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.game_sessions ( session_id uuid NOT NULL DEFAULT gen_random_uuid(), player_id uuid NOT NULL, game_id ...
[ { "role": "user", "content": "For each appointment, show the appointment ID, scheduled start time, and the category of the service associated with it." }, { "role": "assistant", "content": "SELECT a.appointment_id, a.scheduled_start_time, s.category\nFROM government_services.appointments a\nJOIN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id character varying(64) NOT NULL, -- unique identifier for the citizen ...
[ { "role": "user", "content": "List all patients who have been prescribed medications manufactured by 'AstraZeneca', showing patient ID, first and last name, medication name, and manufacturer." }, { "role": "assistant", "content": "SELECT DISTINCT p.patient_id, p.first_name, p.last_name, m.medica...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "Show me all pairs of time entries that are associated with the same invoice, including their entry IDs, lawyer IDs, and the shared invoice ID." }, { "role": "assistant", "content": "SELECT te1.entry_id AS entry1_id,\n te2.entry_id AS entry2_id,\n te1.law...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the time entry ...
[ { "role": "user", "content": "What is the average age of customers created in the last year?" }, { "role": "assistant", "content": "SELECT AVG(DATE_PART('year', CURRENT_DATE) - DATE_PART('year', date_of_birth)) FROM financial_services.customers WHERE created_at >= CURRENT_DATE - INTERVAL '1 year...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id text PRIMARY KEY, first_name text, last_name text, date_of_birth date, ssn_h...
[ { "role": "user", "content": "List all fuel logs for vehicle 'VHCL123', including the fuel type, quantity, and total cost." }, { "role": "assistant", "content": "SELECT fuel_log_id, fuel_type, quantity, total_cost FROM transportation.fuel_logs WHERE vehicle_id = 'VHCL123';" }, { "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 transportation.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, qu...
[ { "role": "user", "content": "Show me all insurance products of type 'Travel', including their product_id, product_name, and base_premium." }, { "role": "assistant", "content": "SELECT product_id, product_name, base_premium\nFROM insurance.insurance_products\nWHERE product_type = 'Travel';" } ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text, customer_id text, product_id text, agent_id text, policy_number text, start_date d...
[ { "role": "user", "content": "List all properties with a star rating of 5.0, showing their name and city." }, { "role": "assistant", "content": "SELECT property_name, city FROM hospitality_technology.properties WHERE star_rating = 5.0;" }, { "role": "user", "content": "Now, also incl...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "List all pairs of vehicles in the same depot with different status. Include both vehicle IDs with their statuses and the depot_id." }, { "role": "assistant", "content": "SELECT v1.vehicle_id AS vehicle1_id,\n v1.status AS status1,\n v2.vehicle_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 transportation.vehicles ( vehicle_id.text, license_plate.text, vin.text, make.text, model.text, year.integer, type.text...
[ { "role": "user", "content": "Show each agency's name, jurisdiction level, and the count of its active services in the 'Healthcare' category." }, { "role": "assistant", "content": "SELECT a.agency_name, a.jurisdiction_level, COUNT(s.service_id) AS active_healthcare_services\nFROM government_serv...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "Get all beneficiaries added in the last 30 days. Include beneficiary_id, policy_id, first_name, last_name, and added_at, ordered by added_at descending." }, { "role": "assistant", "content": "SELECT beneficiary_id,\n policy_id,\n first_name,\n last...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id text, policy_id text, customer_id text, first_name text, last_name text...
[ { "role": "user", "content": "I’d like to see a list of appointments along with any prescriptions made on the same day. Include appointment_id, prescription_id, medication_name, and appointment_time." }, { "role": "assistant", "content": "SELECT a.appointment_id, p.prescription_id, m.medication_...
You are an SQL statement expert. Given the table 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...
[ { "role": "user", "content": "Show each contract's address along with the total number of events it has emitted and the total number of transactions sent to it." }, { "role": "assistant", "content": "SELECT\n c.address,\n COUNT(e.event_id) AS event_count,\n COUNT(t.transaction_id) AS tx_count...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id character varying(64) NOT NULL, -- unique identifier for the contract address cha...
[ { "role": "user", "content": "Show me the count of service orders for each distinct status." }, { "role": "assistant", "content": "SELECT status, COUNT(order_id) FROM hospitality_technology.service_orders GROUP BY status;" }, { "role": "user", "content": "Also, include the total quan...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.reservations ( reservation_id character varying(64) NOT NULL, property_id character varying(64) ...
[ { "role": "user", "content": "List all staff who have ever managed a property, showing the staff full name and the property name they managed." }, { "role": "assistant", "content": "SELECT s.first_name, s.last_name, p.property_name\nFROM hospitality_technology.staff s\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.text, property_name.text, address_line1.text, address_line2.text, city....
[ { "role": "user", "content": "Show me all trades (trade_id, security_id, total_amount) where the trade_type is 'Buy' and the execution_venue is 'NYSE', along with the loan details (loan_type, principal_amount) for accounts that have both trades and loans." }, { "role": "assistant", "content": "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.trades ( trade_id character varying(64) NOT NULL, account_id character varying(64) NOT NULL, securit...
[ { "role": "user", "content": "List all premium payments made by Bank Transfer where the amount_paid is greater than 5000. Show payment_id, policy_id, customer_id, amount_paid, and payment_date, ordered by amount_paid descending." }, { "role": "assistant", "content": "SELECT payment_id,\n 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.policies ( policy_id character varying(64) NOT NULL, -- unique identifier for the policy customer_id ...
[ { "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": "Retrieve the total number of agents managed by each manager, showing the manager_id and the count." }, { "role": "assistant", "content": "SELECT manager_id, COUNT(*) FROM insurance.agents GROUP BY manager_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 insurance.agents ( agent_id.text, first_name.text, last_name.text, agency_name.text, license_number.text, license_state...
[ { "role": "user", "content": "List all appointments and all diagnoses made by the *same doctor*. Show the appointment ID, doctor ID, appointment time, and diagnosis ID." }, { "role": "assistant", "content": "SELECT a.appointment_id, a.doctor_id, a.appointment_time, d.diagnosis_id FROM healthcare...
You are an SQL statement expert. Given the table 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 the first and last name of each citizen along with the city and state of the service location for their agency." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, sl.city, sl.state\nFROM government_services.citizens c\nJOIN government_serv...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "Show me the total quantity of fuel consumed and the total cost for each vehicle that has fuel log entries, including the vehicle's make and model." }, { "role": "assistant", "content": "SELECT T1.vehicle_id, T2.make, T2.model, SUM(T1.quantity) AS total_fuel_quantity...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "Show me the full name of guests who have left reviews along with the overall rating they gave." }, { "role": "assistant", "content": "SELECT g.first_name, g.last_name, r.rating_overall FROM hospitality_technology.reviews r JOIN hospitality_technology.guests g ON r.g...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, -- unique identifier for the room ...
[ { "role": "user", "content": "I need to get the earliest and latest fuel log entries for each vehicle, including their timestamps and the cost difference between those entries." }, { "role": "assistant", "content": "WITH earliest AS (\n SELECT vehicle_id,\n fuel_log_id AS earliest_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 transportation.fuel_logs ( fuel_log_id.text, vehicle_id.text, trip_id.text, log_timestamp.timestamp, fuel_type.text, qu...
[ { "role": "user", "content": "For each chain, identify the token with the highest price and the token with the lowest price. Show chain, high_price_token, max_price, low_price_token, and min_price." }, { "role": "assistant", "content": "WITH prices AS (\n SELECT chain,\n MAX(price) AS 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 token_basic_info ( coin_id.text, token_name.text, token_symbol.text, token_address.text, chain.text, price.numeric, pri...
[ { "role": "user", "content": "Show me the number of distinct room types offered by each property, including the property name and the count." }, { "role": "assistant", "content": "SELECT T1.property_name, COUNT(DISTINCT T2.room_type_id) FROM hospitality_technology.properties AS T1 JOIN 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, -- unique identifier for the prope...