conversations
listlengths
2
8
system
stringlengths
301
7.4k
[ { "role": "user", "content": "What is the total market cap for all tokens listed on the 'Polygon' chain?" }, { "role": "assistant", "content": "SELECT SUM(market_cap) FROM token_dexpool_info WHERE chain = 'Polygon';" }, { "role": "user", "content": "Only sum the market cap for tokens...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexpool token_name character varying(10...
[ { "role": "user", "content": "List all peer logs, showing the user_id and the action taken, ordered by the most recent log entry." }, { "role": "assistant", "content": "SELECT user_id, action, logged_at\nFROM trading_platform.logs\nORDER BY logged_at DESC;" } ]
You are an SQL statement expert. Given the table 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": "How many distinct projects conducted fundraising in April 2023?" }, { "role": "assistant", "content": "SELECT COUNT(DISTINCT project_id) AS num_projects\nFROM project_fundraising_record\nWHERE investment_date LIKE '2023-04%';" }, { "role": "user", "conte...
You are an SQL statement expert. Given the table 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": "List tokens with trend rank 5 or better and a price below $1. Show symbol, price, and trend rank." }, { "role": "assistant", "content": "SELECT token_symbol, price, trend_rank FROM token_dexpool_info WHERE trend_rank IS NOT NULL AND trend_rank <= 5 AND price < 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 token_dexpool_info ( pair_address character varying(512) NOT NULL, -- the id of dexpool token_name character varying(10...
[ { "role": "user", "content": "Show me all maintenance logs for 'Engine Repair' service type where the cost is greater than 400, including the vehicle ID, service date, cost, and mechanic name." }, { "role": "assistant", "content": "SELECT vehicle_id, service_date, cost, mechanic_name 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.maintenance_logs ( log_id character varying(64) NOT NULL, -- unique identifier for the maintenance ...
[ { "role": "user", "content": "List all employees and the branch they work at, along with their job title and department." }, { "role": "assistant", "content": "SELECT employee_id, first_name || ' ' || last_name AS full_name, job_title, department, branch_id\nFROM financial_services.employees;" ...
You are an SQL statement expert. Given the table 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": "Find all claims with a settlement amount between 5000 and 10000. List the claim ID, incident date, and settlement date." }, { "role": "assistant", "content": "SELECT claim_id, incident_date, settlement_date\nFROM insurance.claims\nWHERE settlement_amount BETWEEN 500...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, customer_id chara...
[ { "role": "user", "content": "Show me all drivers hired in 2023, including their full name and email address." }, { "role": "assistant", "content": "SELECT first_name, last_name, email FROM transportation.drivers WHERE hire_date >= '2023-01-01' AND hire_date < '2024-01-01';" }, { "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.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens...
[ { "role": "user", "content": "I'm interested in pairs of players who registered on the exact same calendar date and in the same country. Can you show two columns, player1_id and player2_id, along with that date and country code?" }, { "role": "assistant", "content": "SELECT p1.player_id AS playe...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid PRIMARY KEY, username text, email text, password_hash text, registration_dat...
[ { "role": "user", "content": "For each customer, provide a summary of their account statuses, showing their full name, account status, and the count of accounts for each status." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, a.status, COUNT(a.account_id) AS account_coun...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id character varying(64) NOT NULL, -- unique identifier for the account c...
[ { "role": "user", "content": "For each state, show the total number of service locations and the number of employees working at agencies within those states." }, { "role": "assistant", "content": "SELECT sl.state, COUNT(DISTINCT sl.location_id) AS location_count, COUNT(DISTINCT e.employee_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 government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "Show the route number and description for routes that have bookings associated with them." }, { "role": "assistant", "content": "SELECT DISTINCT T1.route_number, T1.description FROM transportation.routes AS T1 JOIN transportation.bookings AS T2 ON T1.route_id = T2.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.drivers ( driver_id text PRIMARY KEY, employee_id text, first_name text, last_name text, license_number ...
[ { "role": "user", "content": "Show me all products where the description or coverage details contain the word 'insurance'." }, { "role": "assistant", "content": "SELECT product_id, product_name, product_type, description, coverage_details FROM insurance.insurance_products WHERE description LIKE ...
You are an SQL statement expert. Given the table 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": "List pairs of documents uploaded by the same lawyer, showing uploader ID and both document names." }, { "role": "assistant", "content": "SELECT d1.uploaded_by_lawyer_id, d1.document_name AS doc1, d2.document_name AS doc2 FROM legal_services.documents d1 JOIN legal_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 legal_services.documents ( document_id character varying(64) NOT NULL, -- unique identifier for the document c...
[ { "role": "user", "content": "Find all patients who have both a primary insurance plan and at least one completed appointment, along with their insurance policy numbers and the count of appointments." }, { "role": "assistant", "content": "SELECT p.first_name, p.last_name, pi.policy_number, 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 healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "List the file name and document type for all documents uploaded by the user with ID 'agent456'." }, { "role": "assistant", "content": "SELECT file_name, document_type FROM insurance.claim_documents WHERE uploaded_by = 'agent456';" }, { "role": "user", "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 insurance.claim_documents ( document_id character varying(64) NOT NULL, claim_id character varying(64) NOT NULL, docume...
[ { "role": "user", "content": "List employees and the name of the agency they work for, who were hired in the year 2023." }, { "role": "assistant", "content": "SELECT e.first_name, e.last_name, a.agency_name FROM government_services.employees AS e JOIN government_services.agencies AS a ON e.agenc...
You are an SQL statement expert. Given the table 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 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 vehicles and their last maintenance service date along with the odometer reading, including only those that have not had a fuel refill in the past 30 days." }, { "role": "assistant", "content": "SELECT m.vehicle_id,\n m.last_service_date,\n m.la...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE transportation.routes ( route_id character varying(64) NOT NULL, route_number character varying(32) NOT NULL UNIQUE, de...
[ { "role": "user", "content": "Show me the record_id, patient_id, prescription_id, medication_id, start_date, and the systolic blood pressure from the associated medical record for all prescriptions." }, { "role": "assistant", "content": "SELECT p.prescription_id,\n p.medication_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 healthcare.medical_records ( record_id character varying(64) NOT NULL, patient_id character varying(64) NOT NULL, appoi...
[ { "role": "user", "content": "Find all metadata entries where the key is 'token_name' and display the asset_id along with its value." }, { "role": "assistant", "content": "SELECT asset_id, value\nFROM trading_platform.metadata\nWHERE key = 'token_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 trading_platform.users ( user_id character varying(64) NOT NULL, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "List all cases opened in the 'State Court' jurisdiction in the year 2023, including their name, number, and client ID." }, { "role": "assistant", "content": "SELECT case_name, case_number, client_id FROM legal_services.cases WHERE court_jurisdiction = 'State Court' ...
You are an SQL statement expert. Given the table 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 documents uploaded by lawyers from the 'Smith Legal Group' firm, including document_name, upload_timestamp, and the lawyer's first and last name." }, { "role": "assistant", "content": "SELECT d.document_name, d.upload_timestamp, l.first_name, l.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 legal_services.clients ( client_id character varying(64) NOT NULL, -- unique identifier for the client first_n...
[ { "role": "user", "content": "Show me all contracts deployed on the 'ethereum' network along with their deployer addresses and the length of their ABI in characters, sorted by ABI length in descending order." }, { "role": "assistant", "content": "SELECT address, deployer_address, LENGTH(abi) 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 web3.contracts ( contract_id character varying(64) NOT NULL, address character varying(128) NOT NULL, abi text NOT NULL...
[ { "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": "Get me all unbilled billable time entries with their entry_id, case_id, lawyer_id, hours_spent, and billing_rate." }, { "role": "assistant", "content": "SELECT entry_id,\n case_id,\n lawyer_id,\n hours_spent,\n billing_rate\nFROM legal_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 legal_services.time_entries ( entry_id character varying(64) NOT NULL, -- unique identifier for the time entry ...
[ { "role": "user", "content": "List all games along with the count of in-game items they have. Only include games with more than 10 items and sort by the item count in descending order." }, { "role": "assistant", "content": "SELECT g.game_id, g.title, COUNT(i.item_id) AS item_count\nFROM gaming_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 gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), title character varying(200) NOT NULL, devel...
[ { "role": "user", "content": "List the usernames and the IDs of conversations they have joined." }, { "role": "assistant", "content": "SELECT T1.username, T2.conversation_id FROM social_media.users AS T1 JOIN social_media.conversation_participants AS T2 ON T1.user_id = T2.user_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 character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "List the distinct cities where service locations are present." }, { "role": "assistant", "content": "SELECT DISTINCT city FROM government_services.service_locations;" } ]
You are an SQL statement expert. Given the table 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 text, agency_id text, location_name text, address text, city text, ...
[ { "role": "user", "content": "List all pairs of tokens that are deployed on the same contract address and have the same number of decimals. Show both token IDs, the shared contract_address, and the decimals value." }, { "role": "assistant", "content": "SELECT t1.token_id AS token_id_1, t2.token_...
You are an SQL statement expert. Given the table 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": "List all active SUI coins with status 'exists' in metadata, showing coin_type, symbol, name, balance, and description." }, { "role": "assistant", "content": "SELECT sc.coin_type, sm.symbol, sm.name, sc.balance, sm.description\nFROM sui_coins sc\nJOIN sui_coins_metad...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE erc1155_approval_for_all ( block_number bigint NOT NULL, -- Block number containing the transaction block_times...
[ { "role": "user", "content": "Find the average transaction value for successful transactions grouped by block number, showing only blocks with more than 10 transactions." }, { "role": "assistant", "content": "SELECT block_number, AVG(value) as avg_value, COUNT(*) as transaction_count FROM web3.t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.transactions ( transaction_id text PRIMARY KEY, from_address text, to_address text, value numeric, gas_used int, g...
[ { "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\nFROM trading_platform.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, username character varying(128) NOT NULL, email charac...
[ { "role": "user", "content": "List all non-primary insurance plans for patients, including their policy numbers and effective dates, sorted by expiration date." }, { "role": "assistant", "content": "SELECT patient_id, policy_number, effective_date FROM healthcare.patient_insurance WHERE is_prima...
You are an SQL statement expert. Given the table 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, patient_id character varying(64) NO...
[ { "role": "user", "content": "Show me all properties in California with their star ratings and the count of active staff members at each property, ordered by staff count in descending order." }, { "role": "assistant", "content": "SELECT p.property_id, p.property_name, p.star_rating, COUNT(s.staf...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id character varying(64) NOT NULL, property_name character varying(255) NO...
[ { "role": "user", "content": "List all public review comments along with the full name of the guest who submitted the review." }, { "role": "assistant", "content": "SELECT T1.review_id, T2.first_name, T2.last_name, T1.comment FROM hospitality_technology.reviews AS T1 JOIN hospitality_technology....
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text, property_name text, address_line1 text, address_line2 text, city ...
[ { "role": "user", "content": "List each user with 'pending' KYC status, including their user_id, the number of unread notifications they have, and the date of their latest unread notification." }, { "role": "assistant", "content": "SELECT k.user_id, COUNT(n.notification_id) AS unread_count, MAX(...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.orders ( order_id text PRIMARY KEY, user_id text, wallet_id text, asset_id text, order_type text, quan...
[ { "role": "user", "content": "List every guest along with every room type available in the system." }, { "role": "assistant", "content": "SELECT g.guest_id, g.first_name, g.last_name, rt.room_type_id, rt.type_name\nFROM hospitality_technology.guests g\nCROSS JOIN hospitality_technology.room_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 hospitality_technology.room_types ( room_type_id character varying(64) NOT NULL, -- unique identifier for the room ...
[ { "role": "user", "content": "List the top 5 largest PDF documents in claim_documents, showing document_id, claim_id, file_name, and file_size_bytes." }, { "role": "assistant", "content": "SELECT document_id,\n claim_id,\n file_name,\n file_size_bytes\nFROM insurance.claim_docu...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.claims ( claim_id.text, policy_id.text, customer_id.text, incident_date.timestamp, reported_date.timestamp, d...
[ { "role": "user", "content": "For each relationship type among policy beneficiaries, show the average percentage_share and the count of unique beneficiaries. Please order the results with the highest average percentage_share first." }, { "role": "assistant", "content": "SELECT relationship, AVG(...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policy_beneficiaries ( beneficiary_id.text, policy_id.text, customer_id.text, first_name.text, last_name.text...
[ { "role": "user", "content": "Show me 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": "Find all narratives that have a positive price change percentage over the last hour, 24 hours, and 7 days." }, { "role": "assistant", "content": "SELECT narrative FROM narrative_info WHERE price_change_percentage_1h > 0 AND price_change_percentage_24h > 0 AND price_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE narrative_info ( narrative text, top_3_coins text, price_change_percentage_1h numeric, price_change_percentage_24h nume...
[ { "role": "user", "content": "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": "List the five most recently issued policies with their policy_id, policy_number, issued_at, and status." }, { "role": "assistant", "content": "SELECT policy_id, policy_number, issued_at, status\nFROM insurance.policies\nORDER BY issued_at DESC\nLIMIT 5;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id text PRIMARY KEY, customer_id text, product_id text, agent_id text, policy_number text, ...
[ { "role": "user", "content": "Show me all items and the total quantity held by players for each item." }, { "role": "assistant", "content": "SELECT pi.item_id, SUM(pi.quantity) AS total_quantity\nFROM gaming_technology.player_inventory pi\nGROUP BY pi.item_id;" }, { "role": "user", "...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.games ( game_id uuid NOT NULL DEFAULT gen_random_uuid(), -- unique identifier for the game ti...
[ { "role": "user", "content": "List all pairs of drivers who share the same hire_date, showing both driver IDs, first and last names, and the hire_date." }, { "role": "assistant", "content": "SELECT d1.driver_id AS driver1_id,\n d1.first_name AS driver1_first_name,\n d1.last_name AS d...
You are an SQL statement expert. Given the table 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 pairs of active services in the same category where one service’s standard fee is higher than the other’s. Display the category, the higher-fee service name with its fee, and the lower-fee service name with its fee." }, { "role": "assistant", "content": "SE...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.services ( service_id text, agency_id text, service_name text, description text, category text, eli...
[ { "role": "user", "content": "List all appointments that are currently scheduled and show their appointment time." }, { "role": "assistant", "content": "SELECT appointment_id, patient_id, doctor_id, appointment_time FROM healthcare.appointments WHERE status = 'Scheduled';" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.patients ( patient_id character varying(64) NOT NULL, first_name character varying(100) NOT NULL, last_name ...
[ { "role": "user", "content": "List the usernames, emails, and group names for users who have sent messages in group chats and have enabled email notifications." }, { "role": "assistant", "content": "SELECT DISTINCT T1.username, T1.email, T4.group_name FROM social_media.users AS T1 JOIN social_me...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id character varying(64) NOT NULL, username character varying(50) NOT NULL UNIQUE, email char...
[ { "role": "user", "content": "Show the first and last names, email, and phone number for all patients who were added to the system in the last 90 days along with their emergency contact name." }, { "role": "assistant", "content": "SELECT first_name, last_name, email, phone_number, emergency_cont...
You are an SQL statement expert. Given the table 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 all reviews made by guests along with the guest_id, guest's reservation_id, and the related property's property_id and review_date." }, { "role": "assistant", "content": "SELECT r.review_id, r.guest_id, r.reservation_id, r.property_id, r.review_date\nFROM hospi...
You are an SQL statement expert. Given the table 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": "Can you show me a list of all players along with all in-game items they have access to, including the player_id, username, and item_name?" }, { "role": "assistant", "content": "SELECT p.player_id, p.username, i.item_name\nFROM gaming_technology.players p\nCROSS JOIN...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.players ( player_id uuid, username text, email text, password_hash text, registration_date timestamp ...
[ { "role": "user", "content": "Give me the list of DApp names and URLs whose description contains any asset symbol from the assets table." }, { "role": "assistant", "content": "SELECT DISTINCT d.name, d.url\nFROM trading_platform.dapps d\nJOIN trading_platform.assets a ON d.description ILIKE '%' ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.assets ( asset_id character varying(64) NOT NULL, -- unique identifier for the asset name cha...
[ { "role": "user", "content": "How many wallets has each user created since '2024-07-01'?" }, { "role": "assistant", "content": "SELECT user_id,\n COUNT(*) AS wallet_count\nFROM trading_platform.wallets\nWHERE created_at >= '2024-07-01'\nGROUP BY user_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 trading_platform.wallets ( wallet_id text, user_id text, address text, private_key text, created_at timestamp )
[ { "role": "user", "content": "Could you list all unique item types available in the system and the number of items that belong to each type?" }, { "role": "assistant", "content": "SELECT item_type, COUNT(item_id) AS item_count\nFROM gaming_technology.in_game_items\nGROUP BY item_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 gaming_technology.players ( player_id uuid, username text, email text, password_hash text, registration_date timestamp ...
[ { "role": "user", "content": "Show me the appointment ID, subject, and start time for appointments that are linked to a case, along with the case number and case name." }, { "role": "assistant", "content": "SELECT T1.appointment_id, T1.subject, T1.start_time, T2.case_number, T2.case_name FROM le...
You are an SQL statement expert. Given the table 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": "I need a list of all chronic diagnoses marked as 'Active', showing diagnosis_id, diagnosis_date, doctor_id, and the associated chief_complaint from medical_records." }, { "role": "assistant", "content": "SELECT d.diagnosis_id,\n d.diagnosis_date,\n d.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.medical_records ( record_id text PRIMARY KEY, patient_id text, appointment_id text, doctor_id text, record_d...
[ { "role": "user", "content": "Show all appointments that have a value in the notes field (not null or empty). Display appointment_id, appointment_time, and notes." }, { "role": "assistant", "content": "SELECT appointment_id, appointment_time, notes FROM healthcare.appointments WHERE notes IS NOT...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.appointments ( appointment_id.text, patient_id.text, doctor_id.text, appointment_time.timestamp, duration_mi...
[ { "role": "user", "content": "List all service orders with service name, guest's full name, order timestamp and status for orders with status 'Delivered'." }, { "role": "assistant", "content": "SELECT so.order_id, s.service_name, g.first_name || ' ' || g.last_name AS guest_full_name, so.order_ti...
You are an SQL statement expert. Given the table 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 the total number of policies in each status." }, { "role": "assistant", "content": "SELECT status, COUNT(*) FROM insurance.policies GROUP 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 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 drivers who have an email address but no contact number recorded in the system." }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name, email FROM transportation.drivers WHERE email IS NOT NULL AND contact_number IS 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 transportation.drivers ( driver_id character varying(64) NOT NULL, employee_id character varying(64) NOT NULL UNIQUE, f...
[ { "role": "user", "content": "Generate a summary for each account showing the total commissions from trades and total fees from completed transactions in April 2024." }, { "role": "assistant", "content": "SELECT t.account_id,\n SUM(COALESCE(t.commission,0)) AS total_trade_commission,\n ...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.customers ( customer_id character varying(64) NOT NULL, -- unique identifier for the customer ...
[ { "role": "user", "content": "Show me the number of direct replies each top-level comment has on post 'P200'." }, { "role": "assistant", "content": "SELECT c.comment_id, COUNT(r.comment_id) AS reply_count FROM comments AS c LEFT JOIN comments AS r ON r.parent_comment_id = c.comment_id WHERE c.po...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.comments ( comment_id.text, post_id.text, user_id.text, parent_comment_id.text, content.text, created_at.t...
[ { "role": "user", "content": "Show me the wallet addresses and their creation dates for wallets created in the last 30 days, sorted by creation date in descending order." }, { "role": "assistant", "content": "SELECT address, created_at FROM web3.wallets WHERE created_at >= CURRENT_DATE - INTERVA...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.wallets ( wallet_id character varying(64) NOT NULL, -- unique identifier for the wallet user_id character...
[ { "role": "user", "content": "List the number of employees hired in each department per year." }, { "role": "assistant", "content": "SELECT\n department,\n EXTRACT(YEAR FROM hire_date) AS hire_year,\n COUNT(employee_id) AS employee_count\nFROM financial_services.employees\nWHERE\n hire_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 financial_services.accounts ( account_id character varying(64) NOT NULL, -- unique identifier for the account c...
[ { "role": "user", "content": "For each transaction, find its immediate next transaction by the same sender, listing the original transaction_id, the next transaction_id, and the time difference in minutes between them." }, { "role": "assistant", "content": "SELECT t1.transaction_id AS current_tx...
You are an SQL statement expert. Given the table 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 PRIMARY KEY, from_address text, to_address text, value numeric, gas_used int, g...
[ { "role": "user", "content": "Show me all premium payments made in Q1 2023, along with their payment methods and amounts, sorted by payment date." }, { "role": "assistant", "content": "SELECT payment_method, amount_paid, payment_date FROM insurance.premium_payments WHERE payment_date BETWEEN '20...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.premium_payments ( payment_id character varying(64) NOT NULL, policy_id character varying(64) NOT NULL, custo...
[ { "role": "user", "content": "List all food and beverage services (category = 'Food & Beverage') with their names, prices, and units, where the price is less than $20." }, { "role": "assistant", "content": "SELECT service_name, price, unit FROM hospitality_technology.services WHERE category = 'F...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.services ( service_id character varying(64) NOT NULL, -- unique identifier for a chargeable ...
[ { "role": "user", "content": "Show me the first and last names of citizens, the appointment id, and the department of the employee who scheduled their appointment." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, a.appointment_id, e.department\nFROM government_services.ap...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text, national_id_number text, first_name text, last_name text, date_of_birth...
[ { "role": "user", "content": "List all service orders, including the service name and quantity, along with the full name of the staff member who placed the order." }, { "role": "assistant", "content": "SELECT so.order_id, s.service_name, so.quantity, st.first_name, st.last_name FROM hospitality_...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "Show me all active drivers whose licenses expire within the next 60 days, including their contact information." }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name, license_number, license_expiry_date, contact_number, email FROM transportat...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the driver employe...
[ { "role": "user", "content": "What is the schedule of trains arriving at station with ID 'ST789' tomorrow?" }, { "role": "assistant", "content": "I'm sorry, but I can't provide the train schedule for station ID 'ST789' as this information is not available in the current database. The table only ...
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": "Show the usernames of players and a count of how many different item types they have in their inventory." }, { "role": "assistant", "content": "SELECT T1.username, count(DISTINCT T3.item_type) FROM gaming_technology.players AS T1 JOIN gaming_technology.player_invent...
You are an SQL statement expert. Given the table 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 timestamp ...
[ { "role": "user", "content": "What is the average, minimum, and maximum interest_rate for each loan_type among active loans?" }, { "role": "assistant", "content": "SELECT loan_type,\n AVG(interest_rate) AS avg_interest_rate,\n MIN(interest_rate) AS min_interest_rate,\n MAX(inte...
You are an SQL statement expert. Given the table 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, -- unique identifier for the loan, could be same...
[ { "role": "user", "content": "Show me all room types with a base rate over $200 and max occupancy of at least 4, along with their property IDs and amenities." }, { "role": "assistant", "content": "SELECT room_type_id, property_id, type_name, base_rate, max_occupancy, amenities FROM hospitality_t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.room_types ( room_type_id text PRIMARY KEY, property_id text, type_name text, description text, ...
[ { "role": "user", "content": "How many hidden achievements are there?" }, { "role": "assistant", "content": "SELECT COUNT(*) FROM gaming_technology.achievements WHERE hidden = true;" }, { "role": "user", "content": "Also, what is the average point value of all achievements that are n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE gaming_technology.achievements ( achievement_id uuid PRIMARY KEY, game_id uuid, name text, description text, icon_url t...
[ { "role": "user", "content": "How many available services are there per department for each property? Include property_id, department, and the service count." }, { "role": "assistant", "content": "SELECT\n property_id,\n department,\n COUNT(*) AS available_services_count\nFROM hospitality_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 hospitality_technology.rooms ( room_id.text, property_id.text, room_number.text, room_type_id.text, floor.integer, stat...
[ { "role": "user", "content": "Find all contracts where the deployer address is the same as the contract address, indicating self-deployed contracts." }, { "role": "assistant", "content": "SELECT address, deployer_address FROM web3.contracts WHERE address = deployer_address;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.contracts ( contract_id text, address text, abi text, bytecode text, deployer_address text, deployed_at timestamp,...
[ { "role": "user", "content": "List all properties in the USA that have a phone number but no email address listed." }, { "role": "assistant", "content": "SELECT property_name, city, state_province FROM hospitality_technology.properties WHERE country_code = 'US' AND phone_number IS NOT NULL AND e...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "How many employees have a manager assigned to them?" }, { "role": "assistant", "content": "SELECT COUNT(*) AS employee_count\nFROM government_services.employees\nWHERE manager_employee_id IS NOT NULL;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.employees ( employee_id text, agency_id text, first_name text, last_name text, job_title text, depa...
[ { "role": "user", "content": "Show the ticker_symbol, security_name, and the number of loans that have that ticker_symbol as their collateral_description." }, { "role": "assistant", "content": "SELECT s.ticker_symbol, s.security_name, COUNT(l.loan_id) AS collateral_loan_count\nFROM financial_ser...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id text, customer_id text, account_number text, account_type text, balance numeri...
[ { "role": "user", "content": "I want to see all time entries where the description contains the word 'draft' and that have not been billed yet." }, { "role": "assistant", "content": "SELECT *\nFROM legal_services.time_entries\nWHERE description ILIKE '%draft%'\n AND is_billed = false;" }, {...
You are an SQL statement expert. Given the table 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": "Can you provide the total number of accounts and the average balance for each account_type?" }, { "role": "assistant", "content": "SELECT account_type, COUNT(*) AS total_accounts, AVG(balance) AS avg_balance\nFROM financial_services.accounts\nGROUP BY account_type;"...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE financial_services.accounts ( account_id.text, customer_id.text, account_number.text, account_type.text, balance.numeri...
[ { "role": "user", "content": "Show the document ID, claim ID, and file name for all documents with a MIME type starting with 'image/'." }, { "role": "assistant", "content": "SELECT document_id, claim_id, file_name FROM insurance.claim_documents WHERE mime_type LIKE 'image/%';" }, { "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 insurance.claim_documents ( document_id character varying(64) NOT NULL, claim_id character varying(64) NOT NULL, docume...
[ { "role": "user", "content": "Which users have participated in conversations that are not group chats? Please show their usernames and the conversation IDs." }, { "role": "assistant", "content": "SELECT u.username, cp.conversation_id\nFROM social_media.conversation_participants cp\nJOIN social_m...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "Which drivers have missing contact numbers or email addresses? Show their IDs and names." }, { "role": "assistant", "content": "SELECT driver_id, first_name, last_name FROM transportation.drivers WHERE contact_number IS NULL OR email IS NULL;" }, { "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.drivers ( driver_id.text, employee_id.text, first_name.text, last_name.text, license_number.text, licens...
[ { "role": "user", "content": "I want to list each public post along with its content, the author's username, and the total number of comments it has received. Order the results by comment count descending." }, { "role": "assistant", "content": "SELECT p.post_id,\n u.username,\n p.con...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE social_media.users ( user_id text, username text, email text, password_hash text, full_name text, profile_picture_url t...
[ { "role": "user", "content": "For each token, show the token_id and the total number of unique addresses that have ever received it." }, { "role": "assistant", "content": "SELECT token_id, COUNT(DISTINCT to_address) AS unique_recipients\nFROM web3.token_transfers\nGROUP BY token_id;" } ]
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE web3.token_transfers ( transfer_id character varying(64) NOT NULL, -- unique identifier for the transfer token...
[ { "role": "user", "content": "List tokens on the 'Arbitrum' chain with a 24-hour trading volume greater than 1,000,000 USD. Show symbol, volume, and price." }, { "role": "assistant", "content": "SELECT token_symbol, volume_24h, price FROM token_dexpool_info WHERE chain = 'Arbitrum' AND volume_24...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE token_dexpool_info ( pair_address character varying(512) NOT NULL, token_name character varying(100) NOT NULL, token_sy...
[ { "role": "user", "content": "What is the total amount of all payments recorded?" }, { "role": "assistant", "content": "SELECT SUM(amount) FROM government_services.payments;" }, { "role": "user", "content": "Now only include payments with status 'Completed'." }, { "role": "as...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE government_services.citizens ( citizen_id text PRIMARY KEY, national_id_number text, first_name text, last_name text, d...
[ { "role": "user", "content": "Which subscribers have more than one active insurance policy as of today? Show the subscriber_name and the count of such policies." }, { "role": "assistant", "content": "SELECT subscriber_name, COUNT(*) AS policy_count FROM healthcare.patient_insurance WHERE (expira...
You are an SQL statement expert. Given the table 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 the first name and last name of citizens along with their application reference number, status, and the agency name for services categorized as 'Healthcare'." }, { "role": "assistant", "content": "SELECT c.first_name, c.last_name, a.reference_number, a.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.citizens ( citizen_id character varying(64) NOT NULL, national_id_number character varying(128) NOT...
[ { "role": "user", "content": "Identify agents who have sold overlapping policies. Return agent_id, policy_number1, policy_number2, and their coverage dates." }, { "role": "assistant", "content": "SELECT p1.agent_id,\n p1.policy_number AS policy_number1,\n p2.policy_number AS policy_n...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE insurance.policies ( policy_id character varying(64) NOT NULL, -- unique identifier for the policy customer_id ...
[ { "role": "user", "content": "Show me the total number of bookings and total fare collected per trip. Only include trips that have collected more than 500 in total fare." }, { "role": "assistant", "content": "SELECT trip_id, COUNT(*) AS booking_count, SUM(fare) AS total_fare\nFROM transportation...
You are an SQL statement expert. Given the table 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 character varying(64) NOT NULL, -- unique identifier for the booking pass...
[ { "role": "user", "content": "List all transaction IDs that contain at least one UTXO marked as spent." }, { "role": "assistant", "content": "SELECT DISTINCT transaction_id FROM utxos WHERE spent = TRUE;" }, { "role": "user", "content": "Now, for those transaction IDs, also include t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE trading_platform.utxos ( utxo_id character varying(64) NOT NULL, -- unique identifier for the UTXO transaction...
[ { "role": "user", "content": "Find, for each token, how many unique recipient addresses it has. Show token_symbol, contract_address, and recipient_count, ordered by recipient_count descending." }, { "role": "assistant", "content": "SELECT t.token_symbol,\n t.contract_address,\n 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.tokens ( token_id character varying(64) NOT NULL, -- unique identifier for the token contract_address cha...
[ { "role": "user", "content": "Show the plan name and insurance provider for all insurance plans along with the total number of unique patients enrolled in each plan." }, { "role": "assistant", "content": "SELECT ip.plan_name, ip.insurance_provider, COUNT(DISTINCT pi.patient_id) AS enrolled_patie...
You are an SQL statement expert. Given the table 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 reviews for properties with a star rating of at least 4.5. Include the property_name, review_id, rating_overall, and review_date." }, { "role": "assistant", "content": "SELECT p.property_name, r.review_id, r.rating_overall, r.review_date\nFROM hospitality_t...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE hospitality_technology.properties ( property_id text PRIMARY KEY, property_name text, address_line1 text, address_line2...
[ { "role": "user", "content": "Can you show a list of all distinct medication IDs along with the count of prescriptions for each medication, including only medications that have been prescribed more than 50 times? Also, please display the total quantity dispensed for each medication." }, { "role": "a...
You are an SQL statement expert. Given the table structure described by the CREATE TABLE statement, write an SQL query that provides the solution to the user's question. ##Table Structure CREATE TABLE healthcare.prescriptions ( prescription_id character varying(64) NOT NULL, -- unique identifier for the prescriptio...
[ { "role": "user", "content": "Find all pairs of events that occurred in the same transaction but at different log indices, showing both event_ids, their event_names, the transaction_id, and each log_index." }, { "role": "assistant", "content": "SELECT a.event_id AS event_id1,\n a.event_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 web3.events ( event_id character varying(64) NOT NULL, contract_id character varying(64) NOT NULL, event_name character...