conversations
listlengths
2
8
system
stringlengths
276
8.4k
[ { "role": "user", "content": "Which room types offer both 'Sea View' and 'Balcony' amenities? Show their type names, property IDs, and base rates." }, { "role": "assistant", "content": "SELECT type_name, property_id, base_rate FROM hospitality_technology.room_types WHERE amenities LIKE '%Sea Vie...
You are an SQL statement expert. Given the table 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, property_id.text, type_name.text, description.text, base_rate.nu...
[ { "role": "user", "content": "Find the day with the highest total game session count. Show the date and the total session count." }, { "role": "assistant", "content": "SELECT DATE(start_time) AS session_date, COUNT(*) AS total_sessions\nFROM gaming_technology.game_sessions\nGROUP BY session_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 gaming_technology.game_sessions ( session_id uuid PRIMARY KEY, player_id uuid, game_id uuid, server_id uuid, start_time...
[ { "role": "user", "content": "Retrieve the number of drivers grouped by their status." }, { "role": "assistant", "content": "SELECT status,\n COUNT(*) AS driver_count\nFROM transportation.drivers\nGROUP BY status;" }, { "role": "user", "content": "Now, only show statuses where ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.drivers ( driver_id text, employee_id text, first_name text, last_name text, license_number text, licens...
[ { "role": "user", "content": "List all reservations scheduled to start in the next 7 days, including reservation_id, guest_id, check_in_date, type_name, and base_rate. Order by check_in_date ascending." }, { "role": "assistant", "content": "SELECT r.reservation_id, r.guest_id, r.check_in_date, r...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id text, property_id text, type_name text, description text, base_rate nu...
[ { "role": "user", "content": "Provide a count of transactions grouped by their status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) FROM web3.transactions GROUP BY status;" }, { "role": "user", "content": "Now, only show the statuses that have more than 50 transacti...
You are an SQL statement expert. Given the table 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": "What is the timestamp of the most recent log entry for each user?" }, { "role": "assistant", "content": "SELECT user_id, MAX(logged_at) AS latest_log_time FROM logs GROUP BY user_id;" }, { "role": "user", "content": "For each user, show the action and ti...
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 trading_platform.logs ( log_id.text, user_id.text, action.text, details.text, logged...
[ { "role": "user", "content": "List booking IDs and fares for bookings associated with trips using vehicles that had maintenance logs recorded in the last 90 days." }, { "role": "assistant", "content": "SELECT T1.booking_id , T1.fare FROM transportation.bookings AS T1 JOIN transportation.trips 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 transportation.maintenance_logs ( log_id character varying(64) NOT NULL, vehicle_id character varying(64) NOT NULL, ser...
[ { "role": "user", "content": "Show me the number of primary insurance policies per insurance provider, including the provider name and the count." }, { "role": "assistant", "content": "SELECT ip.insurance_provider, COUNT(*) AS primary_policy_count\nFROM healthcare.patient_insurance pi\nJOIN heal...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.doctors ( doctor_id text, first_name text, last_name text, specialty text, license_number text, phone_number...
[ { "role": "user", "content": "Can you list each in-game item type and for each, show the number of players who have items of that type and the total quantity held across all players?" }, { "role": "assistant", "content": "SELECT i.item_type, COUNT(DISTINCT pi.player_id) AS player_count, COALESCE...
You are an SQL statement expert. Given the table 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, player_id uuid, game_id uuid, server_id uuid, start_time timestamp w...
[ { "role": "user", "content": "For each account type, what is the total principal amount outstanding on loans and the average interest rate?" }, { "role": "assistant", "content": "SELECT T2.account_type, SUM(T1.current_principal_balance) AS total_current_loan_principal, AVG(T1.interest_rate) AS 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 PRIMARY KEY, customer_id text, account_number text, account_type text, ba...
[ { "role": "user", "content": "Show me the appointment ID, subject, and the full name of the lawyer for all appointments where a location is specified." }, { "role": "assistant", "content": "SELECT T2.appointment_id, T2.subject, T1.first_name, T1.last_name FROM legal_services.lawyers AS T1 JOIN l...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.lawyers ( lawyer_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_nam...
[ { "role": "user", "content": "How many users have their profile pictures set and also have written a bio?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS user_count\nFROM social_media.users\nWHERE profile_picture_url IS NOT NULL AND profile_picture_url <> ''\n AND bio IS NOT NULL AND ...
You are an SQL statement expert. Given the table 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": "What are the average and maximum fare amounts for each booking status?" }, { "role": "assistant", "content": "SELECT status, AVG(fare) AS avg_fare, MAX(fare) AS max_fare\nFROM transportation.bookings\nGROUP BY status;" }, { "role": "user", "content": "On...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.bookings ( booking_id.text, passenger_id.text, trip_id.text, seat_number.text, booking_time.timestamp, s...
[ { "role": "user", "content": "List all cryptocurrency assets that have been traded more than 100 times." }, { "role": "assistant", "content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) AS trade_count FROM trading_platform.assets a JOIN trading_platform.trades t ON a.asset_id = t.ass...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "Find all clients and lawyers who share the same phone area code, and show each client's first and last name, each lawyer's first and last name, and the shared area code." }, { "role": "assistant", "content": "SELECT c.first_name AS client_first_name, c.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 legal_services.clients ( client_id text, first_name text, last_name text, company_name text, email text, phone text, ad...
[ { "role": "user", "content": "Show the prescription ID, medication name, and patient full name for all prescriptions issued in the last 30 days." }, { "role": "assistant", "content": "SELECT pr.prescription_id, m.medication_name, CONCAT(p.first_name, ' ', p.last_name) AS patient_name\nFROM healt...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "Show me the first name, last name, and email address for all passengers who are part of the loyalty program with ID 'Gold'." }, { "role": "assistant", "content": "SELECT first_name , last_name , email FROM transportation.passengers WHERE loyalty_program_id = '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 transportation.routes ( route_id text PRIMARY KEY, route_number text, description text, origin_location_id text, destin...
[ { "role": "user", "content": "Can you show me all policy numbers along with their product names for policies that have a deductible higher than 2000, and where the associated product is currently active?" }, { "role": "assistant", "content": "SELECT p.policy_number, ip.product_name\nFROM insuran...
You are an SQL statement expert. Given the table 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": "Show me all appointments where the subject contains the word 'Meeting', including the appointment ID, start time, end time, and subject." }, { "role": "assistant", "content": "SELECT appointment_id , start_time , end_time , subject FROM legal_services.appointment...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id text PRIMARY KEY, first_name text, last_name text, company_name text, email text UNI...
[ { "role": "user", "content": "Show me all diesel fuel logs from the last month with their vehicle details, including make, model and license plate." }, { "role": "assistant", "content": "SELECT f.fuel_log_id, f.log_timestamp, f.quantity, f.total_cost, v.make, v.model, v.license_plate FROM transp...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.vehicles ( vehicle_id character varying(64) NOT NULL, license_plate character varying(32) NOT NULL UNIQU...
[ { "role": "user", "content": "List the plan_name, contact_phone, and website for all insurance plans offered by 'Optima Health'." }, { "role": "assistant", "content": "SELECT plan_name,\n contact_phone,\n website\nFROM healthcare.insurance_plans\nWHERE insurance_provider = 'Optima He...
You are an SQL statement expert. Given the table 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.insurance_plans ( plan_id text PRIMARY KEY, plan_name text, insurance_provider text, plan_type text, contact...
[ { "role": "user", "content": "List all patients who have non-primary insurance plans from providers containing 'Care' in their name, including the policy number and expiration date." }, { "role": "assistant", "content": "SELECT pi.patient_id, pi.policy_number, pi.expiration_date 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.doctors ( doctor_id character varying(64) NOT NULL, -- unique identifier for the doctor first_name ...
[ { "role": "user", "content": "List the number of available services per department for each property, displaying the property name and department along with the count of services." }, { "role": "assistant", "content": "SELECT p.property_name,\n s.department,\n COUNT(*) AS service_cou...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.services ( service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ...
[ { "role": "user", "content": "For each insurance product, show its product_id, product_type, and the next product_id created after it in the same product_type, labeled as next_product_id." }, { "role": "assistant", "content": "SELECT p1.product_id,\n p1.product_type,\n p2.product_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.insurance_products ( product_id.text, product_name.text, product_type.text, description.text, base_premium.nu...
[ { "role": "user", "content": "Show me the total transaction amount sent by each sender address in the last 7 days, along with their current balance from the addresses table." }, { "role": "assistant", "content": "SELECT t.sender_address, SUM(t.amount) AS total_sent, a.balance FROM blockchain.tra...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.blocks ( block_id character varying(64) NOT NULL, previous_block_id character varying(64), timestamp timesta...
[ { "role": "user", "content": "Show all SUI coins owned by each address where the coin's status is 'exists'. Include the coin_type, owner, and balance." }, { "role": "assistant", "content": "SELECT coin_type, owner, balance\nFROM sui_coins\nWHERE status = 'exists';" }, { "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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "List the contact phone and website for all insurance plans provided by 'Continental Health'." }, { "role": "assistant", "content": "SELECT plan_name, contact_phone, website\nFROM healthcare.insurance_plans\nWHERE insurance_provider = 'Continental Health';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "List all insurance plans, showing their ID, name, provider, and plan type." }, { "role": "assistant", "content": "SELECT plan_id, plan_name, insurance_provider, plan_type FROM healthcare.insurance_plans;" }, { "role": "user", "content": "Filter the list ...
You are an SQL statement expert. Given the table 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": "How can I pair developers that share the same website domain? Show domain, dev1, dev2." }, { "role": "assistant", "content": "SELECT split_part(website, '/', 3) AS domain,\n d1.name AS dev1,\n d2.name AS dev2\nFROM gaming_technology.developers d1\nJOIN g...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.developers ( developer_id uuid PRIMARY KEY, name text, country text, founded_year int, website text, ...
[ { "role": "user", "content": "List all property pairs that share the same postal_code, showing each pair's property IDs, names, and the postal_code." }, { "role": "assistant", "content": "SELECT a.property_id AS property_id_1,\n a.property_name AS property_name_1,\n b.property_id AS ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "Show me all cryptocurrency assets that have metadata entries for both 'category' and 'blockchain_network', along with their corresponding values." }, { "role": "assistant", "content": "SELECT m1.asset_id, m1.value AS category, m2.value AS blockchain_network FROM tra...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.wallets ( wallet_id.text, user_id.text, address.text, private_key.text, created_at.timestamp ) CREATE ...
[ { "role": "user", "content": "For each loan type, show the total outstanding principal balance and the number of active loans." }, { "role": "assistant", "content": "SELECT loan_type, SUM(current_principal_balance) AS total_outstanding_balance, COUNT(*) AS active_loan_count FROM 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.loans ( loan_id text, account_id text, loan_type text, principal_amount numeric, current_principal_b...
[ { "role": "user", "content": "Find pairs of servers in the same region where one server's current_players is more than twice that of another. Return the region, server1 name, server2 name, and their current_players counts." }, { "role": "assistant", "content": "SELECT s1.region,\n s1.serve...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.servers ( server_id.uuid, game_id.uuid, server_name.text, region.text, ip_address.text, port.integer,...
[ { "role": "user", "content": "How many players registered in each year? Show the year and the registration count." }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM registration_date) AS year,\n COUNT(*) AS registrations\nFROM gaming_technology.players\nGROUP BY 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 gaming_technology.players ( player_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the player ...
[ { "role": "user", "content": "Show all token symbols along with the names of any other tokens on the same contract address." }, { "role": "assistant", "content": "SELECT t1.token_symbol, t2.token_name AS other_token_name, t1.contract_address\nFROM web3.tokens t1\nJOIN web3.tokens t2\n ON t1.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 web3.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for the token contract_address cha...
[ { "role": "user", "content": "Which games have the highest number of different in-game items of type 'Weapon'? Show the game title and the count." }, { "role": "assistant", "content": "SELECT g.title AS game_title, COUNT(*) AS weapon_count\nFROM gaming_technology.in_game_items i\nJOIN gaming_tec...
You are an SQL statement expert. Given the table 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": "For each client, what is the total number of unique case IDs they have invoices for, and the sum of amounts invoiced? Show the client_id, case count, and total amount." }, { "role": "assistant", "content": "SELECT client_id, COUNT(DISTINCT case_id) AS case_count, SU...
You are an SQL statement expert. Given the table 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": "Retrieve all users and their associated wallet identifiers." }, { "role": "assistant", "content": "SELECT T1.username , T2.wallet_id FROM blockchain.users AS T1 JOIN blockchain.wallets AS T2 ON T1.user_id = T2.user_id" }, { "role": "user", "content": ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE blockchain.nodes ( node_id character varying(64) NOT NULL, -- unique identifier for the node ip_address charac...
[ { "role": "user", "content": "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.wallets ( wallet_id text PRIMARY KEY, user_id text, address text, private_key text, created_at timesta...
[ { "role": "user", "content": "List all users who have pending orders for cryptocurrency assets, along with the asset_id and order quantity." }, { "role": "assistant", "content": "SELECT u.user_id, u.email, o.asset_id, o.quantity FROM trading_platform.users u JOIN trading_platform.orders o ON u.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 trading_platform.users ( user_id text, username text, email text, password_hash text, created_at timestamp ) CREATE TAB...
[ { "role": "user", "content": "Show the usernames and registration dates of all players whose last_login is NULL." }, { "role": "assistant", "content": "SELECT username, registration_date FROM gaming_technology.players WHERE last_login IS NULL;" }, { "role": "user", "content": "Please...
You are an SQL statement expert. Given the table 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(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "Show me the total transfer volume and number of transfers for each token tick on Bitcoin in the past 7 days." }, { "role": "assistant", "content": "SELECT tick, SUM(amt) AS total_volume, COUNT(*) AS transfer_count\nFROM token_activities_bitcoin\nWHERE block_timestam...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp, block_number bigint, transaction_hash text, transaction_index bigint, from_add...
[ { "role": "user", "content": "List all pairs of customers who have the same date of birth but live in different states. For each pair, show both customer IDs, their full names, and the states they reside in." }, { "role": "assistant", "content": "SELECT a.customer_id AS customer_id_a, a.first_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 financial_services.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, ad...
[ { "role": "user", "content": "Show me the total number of users." }, { "role": "assistant", "content": "SELECT COUNT(*) FROM web3.users;" }, { "role": "user", "content": "Now, show me the username and email address for the user with the most recently created account." }, { "r...
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.users ( user_id text PRIMARY KEY, username text, email text, password_hash text...
[ { "role": "user", "content": "Identify pairs of consecutive fueling events for each vehicle where the interval between them is greater than 7 days. For each pair include vehicle_id, first fuel_log_id and timestamp, second fuel_log_id and timestamp, and days difference between events." }, { "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 character varying(64) NOT NULL, -- unique identifier for the fuel log entry...
[ { "role": "user", "content": "List all patients who have a current prescription that was prescribed by a doctor with a specialty of 'Endocrinology'. Show patient full name, prescription ID, medication name, and prescription date." }, { "role": "assistant", "content": "SELECT p.patient_id, p.firs...
You are an SQL statement expert. Given the table 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": "List each property with the total number of active staff members and the average base rate of its room types." }, { "role": "assistant", "content": "SELECT p.property_id, p.property_name, COUNT(s.staff_id) AS active_staff_count, ROUND(AVG(rt.base_rate), 2) AS avg_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.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "List all pairs of clients who registered in the same month and year. Show both clients’ first and last names, plus the month and year they share." }, { "role": "assistant", "content": "SELECT c1.first_name AS first_name_1,\n c1.last_name AS last_name_1,...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE legal_services.clients ( client_id character varying(64) NOT NULL, -- unique identifier for the client first_n...
[ { "role": "user", "content": "Show all DApps whose name starts with the letter 'C'." }, { "role": "assistant", "content": "SELECT * FROM trading_platform.dapps WHERE name ILIKE 'C%';" }, { "role": "user", "content": "Could you instead make it case-sensitive so only names that start w...
You are an SQL statement expert. Given the table 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.dapps ( dapp_id.text, name.text, description.text, url.text )
[ { "role": "user", "content": "List the service_id, service_name, and agency_id for all active services that have an online application URL provided." }, { "role": "assistant", "content": "SELECT service_id,\n service_name,\n agency_id\nFROM government_services.services\nWHERE is_acti...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "I’d like to find all pairs of securities that belong to the same sector." }, { "role": "assistant", "content": "SELECT a.security_id, a.ticker_symbol, b.security_id AS pair_security_id, b.ticker_symbol AS pair_ticker_symbol, a.sector\nFROM financial_services.securit...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.securities ( security_id text PRIMARY KEY, ticker_symbol text, isin_code text, cusip_code text, secu...
[ { "role": "user", "content": "Show me all employees (employee_id, first_name, last_name) who work in the 'Investment' department and were hired in the last 5 years, along with their job titles." }, { "role": "assistant", "content": "SELECT e.employee_id, e.first_name, e.last_name, e.job_title 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 financial_services.customers ( customer_id text, first_name text, last_name text, date_of_birth date, ssn_hash text, ad...
[ { "role": "user", "content": "Show me the top 5 ERC20 tokens with the highest total supply, along with their names and contract addresses, but only include tokens with decimals equal to 18." }, { "role": "assistant", "content": "SELECT name, contract_address, total_supply FROM token_metas WHERE ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_metas ( block_timestamp timestamp(6) NOT NULL, block_number bigint NOT NULL, transaction_hash varchar NOT NULL, t...
[ { "role": "user", "content": "Retrieve each passenger's full name, their email, booking status, and the name of the origin location for all bookings." }, { "role": "assistant", "content": "SELECT p.first_name || ' ' || p.last_name AS full_name, p.email, b.status, l.name AS origin_location_name\n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var...
[ { "role": "user", "content": "Find all users who created accounts in the last 30 days and show their usernames and email addresses, sorted by creation date in descending order." }, { "role": "assistant", "content": "SELECT username, email FROM web3.users WHERE created_at >= NOW() - INTERVAL '30 ...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, username character varying(128) NOT NULL, email character varying(...
[ { "role": "user", "content": "List each citizen's full name and the number of documents they have uploaded per service category." }, { "role": "assistant", "content": "SELECT c.first_name || ' ' || c.last_name AS full_name,\n s.category,\n COUNT(d.document_id) AS document_count\nFROM...
You are an SQL statement expert. Given the table 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": "Could you provide a summary of the total balance for each account type?" }, { "role": "assistant", "content": "SELECT account_type, SUM(balance) FROM financial_services.accounts GROUP BY account_type;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri...
[ { "role": "user", "content": "List the email and full name of all users whose account was updated in June 2024." }, { "role": "assistant", "content": "SELECT email, full_name\nFROM social_media.users\nWHERE updated_at >= '2024-06-01' AND updated_at < '2024-07-01';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Show the first name, last name, and job title for all employees working for agencies with a jurisdiction level of 'State'." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, e.job_title FROM government_services.employees e JOIN government_servi...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.agencies ( agency_id text PRIMARY KEY, agency_name text, jurisdiction_level text, primary_contact_e...
[ { "role": "user", "content": "List all appointments that have not been assigned to any employee. Show the appointment ID and the scheduled start time." }, { "role": "assistant", "content": "SELECT appointment_id, scheduled_start_time\nFROM government_services.appointments\nWHERE employee_id IS N...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id.text, national_id_number.text, first_name.text, last_name.text, date_of_birth...
[ { "role": "user", "content": "Find all customers who have made a premium payment and list their first name, last name, email, and the total amount they have paid across all their payments." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T1.email, SUM(T2.amount_paid) 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 insurance.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "List appointment IDs, times, patient full name, and doctor full name for all appointments scheduled in February 2024." }, { "role": "assistant", "content": "SELECT T1.appointment_id, T1.appointment_time, T2.first_name, T2.last_name, T3.first_name, T3.last_name 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 healthcare.patients ( patient_id character varying(64) NOT NULL, -- unique identifier for the patient first_na...
[ { "role": "user", "content": "What is the total transaction amount for each transaction_type in the last 30 days?" }, { "role": "assistant", "content": "SELECT transaction_type, SUM(amount) AS total_amount FROM financial_services.transactions WHERE transaction_date >= CURRENT_DATE - INTERVAL '30...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, first_name character varying(100) NOT NULL, ...
[ { "role": "user", "content": "Show me all police report documents with their claim IDs and file sizes, sorted by file size in descending order." }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_size_bytes FROM insurance.claim_documents WHERE document_type = 'police report...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, claim_id text, document_type text, file_name text, file_path ...
[ { "role": "user", "content": "Retrieve all prescriptions linked to chronic diagnoses. Show prescription_id, diagnosis_id, diagnosis_code, and prescription_date." }, { "role": "assistant", "content": "SELECT pr.prescription_id,\n d.diagnosis_id,\n d.diagnosis_code,\n pr.prescrip...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "List all maintenance logs for vehicles whose fuel type is 'Diesel', showing the log ID, vehicle make and model, service date, and service type." }, { "role": "assistant", "content": "SELECT ml.log_id, v.make, v.model, ml.service_date, ml.service_type\nFROM transport...
You are an SQL statement expert. Given the table 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": "For each transaction, find the next transaction initiated by the same sender. List the original transaction_id, the next transaction_id, the sender address, and the time difference in hours between them." }, { "role": "assistant", "content": "SELECT t1.transaction_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 web3.transactions ( transaction_id text, from_address text, to_address text, value numeric, gas_used integer, gas_price...
[ { "role": "user", "content": "Show the number of delivered service orders for each unique status value." }, { "role": "assistant", "content": "SELECT status, COUNT(*) AS delivered_order_count\nFROM hospitality_technology.service_orders\nWHERE staff_id_delivered IS NOT NULL\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 hospitality_technology.service_orders ( order_id.text, reservation_id.text, guest_id.text, service_id.text, staff_id_or...
[ { "role": "user", "content": "How many prescriptions exist for each medication? Show medication name and total prescriptions, sorted by total descending." }, { "role": "assistant", "content": "SELECT m.medication_name, COUNT(p.prescription_id) AS total_prescriptions FROM healthcare.prescriptions...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ch...
[ { "role": "user", "content": "List each game title along with the number of servers currently online for that game, only include games that have more than 3 online servers." }, { "role": "assistant", "content": "SELECT g.title, COUNT(s.server_id) AS online_server_count\nFROM gaming_technology.ga...
You are an SQL statement expert. Given the table 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(), username character varying(100) NOT NULL...
[ { "role": "user", "content": "Could you list projects that have completed more than one fundraising round, showing the project name and the number of rounds?" }, { "role": "assistant", "content": "SELECT project_name, COUNT(*) AS round_count FROM project_fundraising_record GROUP BY project_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 project_fundraising_record ( id character varying(32) NOT NULL, -- fundraising record id project_id character varying(...
[ { "role": "user", "content": "Show me each service order along with the next order placed by the same guest, including both order IDs and the time difference in minutes between the two orders." }, { "role": "assistant", "content": "SELECT a.order_id,\n b.order_id AS next_order_id,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.service_orders ( order_id.text, reservation_id.text, guest_id.text, service_id.text, staff_id_or...
[ { "role": "user", "content": "How many distinct tokens did smart money buy on the 'BSC' chain in 2023?" }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT token_address) AS distinct_tokens_bought\nFROM smart_money_token_inflow\nWHERE type = 1\n AND chain = 'BSC'\n AND to_char(cast(tok...
You are an SQL statement expert. Given the table 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": "Show each lawyer's first and last name along with the number of open cases they lead, ordered by the highest number of open cases first." }, { "role": "assistant", "content": "SELECT l.first_name, l.last_name, COUNT(c.case_id) AS open_case_count\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.lawyers ( lawyer_id character varying(64) NOT NULL, -- unique identifier for the lawyer first_n...
[ { "role": "user", "content": "Show me all policy beneficiaries associated with customer ID 'CUST100'." }, { "role": "assistant", "content": "SELECT * FROM insurance.policy_beneficiaries WHERE customer_id = 'CUST100';" }, { "role": "user", "content": "From those results, only include ...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, policy_id text, customer_id text, first_name text, la...
[ { "role": "user", "content": "Can you show me the total number of items acquired by each player, along with the title of each game and the player's ID?" }, { "role": "assistant", "content": "SELECT pi.player_id, g.title AS game_title, SUM(pi.quantity) AS total_items_acquired\nFROM gaming_technol...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), title character varying(200) NOT NULL, devel...
[ { "role": "user", "content": "List staff members who responded to public reviews with an overall rating of 3 or less. Include the staff member's first name, last name, and the review ID." }, { "role": "assistant", "content": "SELECT T1.first_name, T1.last_name, T2.review_id FROM staff AS T1 JOIN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.staff ( staff_id text PRIMARY KEY, property_id text, first_name text, last_name text, position t...
[ { "role": "user", "content": "List all premium payments along with the email of the customer and the document_id of any claim documents related to claims made on the same policy." }, { "role": "assistant", "content": "SELECT pp.payment_id, pp.amount_paid, pp.payment_date, c.email, cd.document_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.customers ( customer_id.text, first_name.text, last_name.text, date_of_birth.date, ssn_hash.text, address_lin...
[ { "role": "user", "content": "List all properties together with the floor numbers and room numbers of their rooms located in cities with a star rating greater than 4." }, { "role": "assistant", "content": "SELECT p.property_id, p.property_name, p.city, p.star_rating, r.floor, r.room_number\nFROM...
You are an SQL statement expert. Given the table 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": "Find all applications whose last update occurred on a weekend. Show application_id, citizen full name, last_updated_at, and status." }, { "role": "assistant", "content": "SELECT\na.application_id,\n(c.first_name || ' ' || c.last_name) AS full_name,\na.last_updated_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 government_services.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT...
[ { "role": "user", "content": "Get each user's total 'buy' order value (quantity * price) as total_buy_value." }, { "role": "assistant", "content": "SELECT u.user_id, SUM(o.quantity * o.price) AS total_buy_value\nFROM trading_platform.users u\nJOIN trading_platform.orders o ON u.user_id = o.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 trading_platform.users ( user_id.text, username.text, email.text, password_hash.text, created_at.timestamp ) CREATE TAB...
[ { "role": "user", "content": "Count the total number of invoices issued in each calendar year and month. Show the year, month, and the count, ordered chronologically." }, { "role": "assistant", "content": "SELECT EXTRACT(YEAR FROM issue_date) AS issue_year, EXTRACT(MONTH FROM issue_date) AS issu...
You are an SQL statement expert. Given the table 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 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": "Show the names and cities of all service locations, along with the agency ID, for locations whose postal code starts with '10'." }, { "role": "assistant", "content": "SELECT location_name, city, agency_id FROM government_services.service_locations WHERE postal_code ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.service_locations ( location_id character varying(64) NOT NULL, -- unique identifier for the ph...
[ { "role": "user", "content": "Which customers have more than one account? Please include customer_id and the number of accounts they hold." }, { "role": "assistant", "content": "SELECT customer_id, COUNT(account_id) AS account_count FROM financial_services.accounts GROUP BY customer_id HAVING 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 financial_services.accounts ( account_id character varying(64) NOT NULL, customer_id character varying(64) NOT NULL, ac...
[ { "role": "user", "content": "List all cancelled policies with their cancellation reasons and premium amounts." }, { "role": "assistant", "content": "SELECT policy_id, policy_number, cancellation_reason, premium_amount FROM insurance.policies WHERE status = 'Cancelled';" }, { "role": "us...
You are an SQL statement expert. Given the table 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": "Which wallet addresses currently hold at least 2 different ERC721 NFTs on Ethereum? Show each wallet address and the count of distinct token_ids." }, { "role": "assistant", "content": "SELECT nh.wallet_address, COUNT(DISTINCT nh.token_id) AS distinct_token_count\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 token_metas ( block_timestamp.timestamp, block_number.bigint, transaction_hash.text, transaction_index.bigint, from_add...
[ { "role": "user", "content": "What is the total revenue generated by ticket sales at the station with ID 'ST101' for the past month?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide information on the revenue generated by ticket sales as this data is not available in the cur...
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE train_station_management.s...
[ { "role": "user", "content": "List the names of all law firms along with the names (first and last) of lawyers who are partners in those firms." }, { "role": "assistant", "content": "SELECT lf.firm_name, l.first_name, l.last_name\nFROM legal_services.law_firms lf\nJOIN legal_services.lawyers l O...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE 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 premium payments that are currently overdue (status = 'overdue'), showing their policy IDs and due dates." }, { "role": "assistant", "content": "SELECT payment_id, policy_id, due_date FROM insurance.premium_payments WHERE status = 'overdue';" }, { "...
You are an SQL statement expert. Given the table 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": "Show me all appointment times and statuses for appointments scheduled at location 'loc_101' with doctor 'doc_567'." }, { "role": "assistant", "content": "SELECT a.appointment_time, a.status FROM healthcare.appointments a WHERE a.location_id = 'loc_101' AND a.doctor_...
You are an SQL statement expert. Given the table 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, patient_id character varying(64) NOT NULL, doc...
[ { "role": "user", "content": "Show the booking ID, first and last name of the passenger, and the status of each booking." }, { "role": "assistant", "content": "SELECT b.booking_id, p.first_name, p.last_name, b.status\nFROM transportation.bookings b\nJOIN transportation.passengers p ON b.passenge...
You are an SQL statement expert. Given the table 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": "List all cryptocurrency assets that have been traded at least 50 times, along with their average trade price." }, { "role": "assistant", "content": "SELECT a.asset_id, a.name, a.symbol, COUNT(t.trade_id) AS trade_count, AVG(t.price) AS avg_price FROM trading_platfor...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.users ( user_id character varying(64) NOT NULL, -- unique identifier for the user username ch...
[ { "role": "user", "content": "For each medical record, display the record date, doctor full name, and medication name for any prescription linked to that record." }, { "role": "assistant", "content": "SELECT mr.record_date, d.first_name || ' ' || d.last_name AS doctor_full_name, m.medication_nam...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id text, first_name text, last_name text, date_of_birth date, gender text, address text, ...
[ { "role": "user", "content": "Can you list all patients along with the insurance plan names they are enrolled in? Please include patient ID, first name, last name, and plan name." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, ip.plan_name\nFROM 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.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "Show me all trips that were delayed by more than 30 minutes, along with their vehicle and driver details, and include the origin and destination city names." }, { "role": "assistant", "content": "SELECT t.trip_id, t.vehicle_id, t.driver_id, t.scheduled_departure, 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.trips ( trip_id character varying(64) NOT NULL, route_id character varying(64), vehicle_id character var...
[ { "role": "user", "content": "For each user, count how many different conversations they have participated in. Show user_id and conversation_count." }, { "role": "assistant", "content": "SELECT user_id, COUNT(DISTINCT conversation_id) AS conversation_count\nFROM social_media.conversation_partici...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.follows ( follow_id.text, follower_user_id.text, following_user_id.text, created_at.timestamp ) CREATE TAB...
[ { "role": "user", "content": "What is the performance review score for employee with ID 'EMP456' for the last quarter?" }, { "role": "assistant", "content": "I'm sorry, but I can't assist with information about performance review scores as this data is not included in the employees table." } ]
You are an SQL statement expert and you can refuse the user's question if the question is not related to the table structure. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE manufacturing.employees ( ...
[ { "role": "user", "content": "I need a count of appointments per patient that took place between '2024-04-01' and '2024-04-30', showing patient_id, first_name, last_name, and the total number of appointments." }, { "role": "assistant", "content": "SELECT p.patient_id, p.first_name, p.last_name, ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id.text, first_name.text, last_name.text, date_of_birth.date, gender.text, address.text, ...
[ { "role": "user", "content": "Find the top 5 most recently created users along with their email domains (the part after '@' in their email addresses)." }, { "role": "assistant", "content": "SELECT username, SUBSTRING(email FROM POSITION('@' IN email)+1) AS email_domain FROM web3.users ORDER BY c...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.users ( user_id text PRIMARY KEY, username text, email text, password_hash text, created_at timestamp )